Consolidate 18 skills into 1 /impeccable skill with 20 commands

Biggest change in a while. Users previously had 18 standalone skill
entries cluttering their /menu; now they have one entry (/impeccable)
that routes to 20 specialized commands via argument dispatch. The pin
mechanism (/impeccable pin audit) restores standalone shortcuts on
demand for commands users hit all the time.

## Architecture

- Single /impeccable skill with command router section in SKILL.md
- 20 commands served via reference files under source/skills/impeccable/reference/
- /impeccable pin <command> creates a lightweight redirect shim so users
  who prefer /audit, /polish, etc. can still have them
- Context gathering (teach) auto-runs on first use
- command-metadata.json is the single source of truth for command
  descriptions, argument hints, and relationships

## Site rewrite

- Docs URL: /skills renamed to /docs (with /skills permanent redirects)
- Homepage hero frames Impeccable as "one skill with 20 commands"
- "Get Started" split into 50/50 install + how-to-use with editorial
  numbered steps, /impeccable shown as the home command with three modes
- New /docs overview: home command hero card + dense category rows
  matching the old cheatsheet density, with leads-to/pairs-with/
  combines-with relationship metadata served from a shared source
- Cheatsheet merged into /docs, /cheatsheet redirects
- Magazine spread and mobile cards show /impeccable as a stacked
  namespace label above the command name at full display size
- Periodic table updated with craft/teach/extract as first-class cells
- Skill detail pages generate from reference files, with an editorial
  wrapper per command for tagline + body
- Tutorials and anti-patterns pages updated to use /impeccable <cmd>

## Build system

- Dead code removed (scripts/lib/transformers/shared.js)
- Build log wording fixed ("1 skill" not "1 skills (1 user-invocable)")
- generateApiData fallback branch removed (throws loudly if metadata
  missing instead of silently degrading)
- Commands API includes editorial tagline alongside the long description;
  UI surfaces prefer tagline for human display, description for auto-
  trigger keyword matching

## Gitignore

- Added .claude/scheduled_tasks.lock, .claude/settings.local.json to
  ignore list (local Claude Code state that should not be tracked).
- Harness skill directories (.claude/skills/, .agents/skills/, etc.)
  remain tracked by design: npx skills reads them from this repo at
  install time and they enable clean submodule use.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-04-10 19:45:17 -07:00
co-authored by Claude Opus 4.6
parent f957fcad20
commit b0f44f83c6
469 changed files with 25435 additions and 22231 deletions
+137 -73
View File
@@ -5,7 +5,7 @@
* server/index.js (at module load), so dev and prod share the same
* code path and output shape.
*
* Output lives under public/skills/, public/anti-patterns/,
* Output lives under public/docs/, public/anti-patterns/,
* public/tutorials/, all gitignored. Bun's HTML loader picks them up
* the same way it picks up the hand-authored pages.
*/
@@ -17,6 +17,7 @@ import {
CATEGORY_ORDER,
CATEGORY_LABELS,
CATEGORY_DESCRIPTIONS,
COMMAND_RELATIONSHIPS,
LAYER_LABELS,
LAYER_DESCRIPTIONS,
GALLERY_ITEMS,
@@ -119,12 +120,19 @@ ${refBody}
const hasDemo = demoHtml.trim().length > 0;
// Sub-commands are accessed via /impeccable <name>. Show "/impeccable" as
// a smaller namespace label above the command name, matching the magazine
// spread treatment so the command name stays at full display size.
const titleHtml = skill.isSubCommand
? `<span class="skill-detail-title-namespace"><span class="skill-detail-title-slash">/</span>impeccable</span>${escapeHtml(skill.id)}`
: `<span class="skill-detail-title-slash">/</span>${escapeHtml(skill.id)}`;
return `
<article class="skill-detail">
<div class="skill-detail-hero${hasDemo ? ' skill-detail-hero--has-demo' : ''}">
<header class="skill-detail-header">
<p class="skill-detail-eyebrow"><a href="/skills">Skills</a> / ${escapeHtml(categoryLabel)}</p>
<h1 class="skill-detail-title"><span class="skill-detail-title-slash">/</span>${escapeHtml(skill.id)}</h1>
<p class="skill-detail-eyebrow"><a href="/docs">Docs</a> / ${escapeHtml(categoryLabel)}</p>
<h1 class="skill-detail-title">${titleHtml}</h1>
<p class="skill-detail-tagline">${escapeHtml(tagline)}</p>
${metaStrip}
</header>
@@ -135,8 +143,8 @@ ${refBody}
<section class="skill-source-card">
<header class="skill-source-card-header">
<span class="skill-source-card-label">SKILL.md</span>
<span class="skill-source-card-subtitle">The canonical skill definition your AI harness loads.</span>
<span class="skill-source-card-label">${skill.isSubCommand ? 'reference/' + escapeHtml(skill.id) + '.md' : 'SKILL.md'}</span>
<span class="skill-source-card-subtitle">${skill.isSubCommand ? 'Loaded when the impeccable skill routes to this command.' : 'The canonical skill definition your AI harness loads.'}</span>
</header>
<div class="skill-source-card-body prose">
${bodyHtml}
@@ -197,35 +205,28 @@ ${tutorials
`;
}
// Sub-command links that appear as indented entries after their parent skill.
const SUB_COMMANDS = {
impeccable: [
{ id: 'impeccable-craft', label: '/impeccable craft', href: '/skills/impeccable#craft' },
{ id: 'impeccable-teach', label: '/impeccable teach', href: '/skills/impeccable#teach' },
{ id: 'impeccable-extract', label: '/impeccable extract', href: '/skills/impeccable#extract' },
],
};
// Then the skills, grouped by category.
// Then the skills, grouped by category. The root "/impeccable" entry is
// shown with its slash; sub-commands are shown as bare names (since the
// invocation is /impeccable <name>). Within a category the list is
// alphabetical, except /impeccable always pins to the top of Create.
for (const category of CATEGORY_ORDER) {
const list = skillsByCategory[category] || [];
if (list.length === 0) continue;
const raw = skillsByCategory[category] || [];
if (raw.length === 0) continue;
const list = [...raw].sort((a, b) => {
if (a.id === 'impeccable') return -1;
if (b.id === 'impeccable') return 1;
return a.id.localeCompare(b.id);
});
html += `
<div class="skills-sidebar-group" data-category="${category}">
<p class="skills-sidebar-group-title">${escapeHtml(CATEGORY_LABELS[category])}</p>
<ul class="skills-sidebar-list">
${list
.flatMap((s) => {
.map((s) => {
const isCurrent = current?.kind === 'skill' && current.id === s.id;
const attr = isCurrent ? ' aria-current="page"' : '';
const items = [` <li><a href="/skills/${s.id}"${attr}>/${escapeHtml(s.id)}</a></li>`];
const subs = SUB_COMMANDS[s.id];
if (subs) {
for (const sub of subs) {
items.push(` <li class="skills-sidebar-sub"><a href="${sub.href}">${escapeHtml(sub.label)}</a></li>`);
}
}
return items;
const label = s.id === 'impeccable' ? '/impeccable' : escapeHtml(s.id);
return ` <li><a href="/docs/${s.id}"${attr}>${label}</a></li>`;
})
.join('\n')}
</ul>
@@ -244,52 +245,113 @@ ${list
* This is the orientation piece: what skills are, how to pick one,
* the six categories explained with inline cross-links to detail pages.
*/
function renderSkillsOverviewMain(skillsByCategory) {
const totalSkills = Object.values(skillsByCategory).reduce(
(sum, list) => sum + list.length,
0,
);
function renderSkillsOverviewMain(skillsByCategory, allSkills) {
// Build a lookup by id so we can pull taglines/descriptions for the cards.
const skillsById = Object.fromEntries(allSkills.map((s) => [s.id, s]));
const commandCount = allSkills.filter((s) => s.id !== 'impeccable').length;
// Short, clean tagline for the home command card. Fall back to the editorial
// tagline if set, otherwise use a default.
const impeccable = skillsById['impeccable'];
const homeTagline = impeccable?.editorial?.frontmatter?.tagline
|| 'The design intelligence behind every command.';
// Render a single command as a compact row: name on the left, description
// and relationship on the right. Matches the original cheatsheet density.
const renderCommandRow = (skill) => {
const tagline = skill.editorial?.frontmatter?.tagline || skill.description;
const shortTagline = tagline.length > 140 ? tagline.slice(0, 137) + '...' : tagline;
const rel = COMMAND_RELATIONSHIPS[skill.id] || {};
const isBeta = skill.id === 'overdrive';
let metaHtml = '';
if (rel.pairs) {
metaHtml = `<div class="command-row-rel">Pairs with <a href="/docs/${rel.pairs}">${rel.pairs}</a></div>`;
} else if (rel.leadsTo?.length) {
const links = rel.leadsTo.map((c) => `<a href="/docs/${c}">${c}</a>`).join(', ');
metaHtml = `<div class="command-row-rel">Leads to ${links}</div>`;
} else if (rel.combinesWith?.length) {
const links = rel.combinesWith.map((c) => `<a href="/docs/${c}">${c}</a>`).join(', ');
metaHtml = `<div class="command-row-rel">Combines with ${links}</div>`;
}
// Row is a <div> (not an <a>) so the inner relationship links are valid.
// The name on the left is the primary link target.
return `
<div class="command-row">
<div class="command-row-name">
<a href="/docs/${skill.id}"><span class="command-row-namespace">/impeccable</span> ${escapeHtml(skill.id)}</a>${isBeta ? ' <span class="command-row-beta">BETA</span>' : ''}
</div>
<div class="command-row-info">
<p class="command-row-desc">${escapeHtml(shortTagline)}</p>
${metaHtml}
</div>
</div>`;
};
// Render category sections, skipping the Create category's /impeccable root
// (shown as a hero card above) but keeping everything else in place.
let categoriesHtml = '';
for (const category of CATEGORY_ORDER) {
const list = skillsByCategory[category] || [];
const list = (skillsByCategory[category] || []).filter((s) => s.id !== 'impeccable');
if (list.length === 0) continue;
const skillChips = list
.map(
(s) =>
`<a class="skills-overview-chip" href="/skills/${s.id}">/${escapeHtml(s.id)}</a>`,
)
.join('');
const rowsHtml = list.map(renderCommandRow).join('');
categoriesHtml += `
<section class="skills-overview-category" data-category="${category}" id="category-${category}">
<div class="skills-overview-category-meta">
<h2 class="skills-overview-category-title">${escapeHtml(CATEGORY_LABELS[category])}</h2>
<p class="skills-overview-category-count">${list.length} ${list.length === 1 ? 'skill' : 'skills'}</p>
</div>
<p class="skills-overview-category-desc">${escapeHtml(CATEGORY_DESCRIPTIONS[category])}</p>
<div class="skills-overview-chips">
${skillChips}
<section class="docs-category" data-category="${category}" id="category-${category}">
<header class="docs-category-header">
<div>
<h2 class="docs-category-title">${escapeHtml(CATEGORY_LABELS[category])}</h2>
<p class="docs-category-desc">${escapeHtml(CATEGORY_DESCRIPTIONS[category])}</p>
</div>
<span class="docs-category-count">${list.length} ${list.length === 1 ? 'command' : 'commands'}</span>
</header>
<div class="docs-category-rows">
${rowsHtml}
</div>
</section>
`;
}
return `
<div class="skills-overview-content">
<header class="skills-overview-header">
<p class="sub-page-eyebrow">${totalSkills} commands</p>
<h1 class="sub-page-title">Skills</h1>
<p class="sub-page-lede">One skill, <a href="/skills/impeccable">/impeccable</a>, teaches your AI design. Eighteen commands steer the result. Each command does one job with an opinion about what good looks like.</p>
<div class="docs-overview">
<header class="docs-overview-header">
<p class="sub-page-eyebrow">1 skill · ${commandCount} commands</p>
<h1 class="sub-page-title">Commands</h1>
<p class="sub-page-lede">Impeccable gives you a shared design vocabulary with your AI. ${commandCount} commands that each encode a specific design discipline, so you can steer with precision. Pick one for the job or let the skill route you automatically.</p>
</header>
<section class="skills-overview-howto">
<h2 class="skills-overview-howto-title">How to pick one</h2>
<p>Skills are named after the intent you bring to them. Reviewing something? <a href="/skills/critique">/critique</a> or <a href="/skills/audit">/audit</a>. Fixing type? <a href="/skills/typeset">/typeset</a>. Last-mile pass before shipping? <a href="/skills/polish">/polish</a>. The categories below group skills by the job.</p>
<section class="docs-home-card">
<div class="docs-home-card-identity">
<span class="docs-home-card-eyebrow">The home command</span>
<h2 class="docs-home-card-title">/impeccable</h2>
<p class="docs-home-card-tagline">${escapeHtml(homeTagline)}</p>
<p class="docs-home-card-desc">Call <code>/impeccable</code> directly for freeform design work with the full guidebook loaded. Or reach for one of its specialized modes:</p>
</div>
<ul class="docs-home-card-modes">
<li>
<a href="/docs/teach">
<span class="docs-home-mode-label"><span class="docs-home-mode-slash">/</span>impeccable teach</span>
<span class="docs-home-mode-hint">One-time project setup. Runs automatically on first use.</span>
</a>
</li>
<li>
<a href="/docs/craft">
<span class="docs-home-mode-label"><span class="docs-home-mode-slash">/</span>impeccable craft</span>
<span class="docs-home-mode-hint">Full shape-then-build flow with visual iteration.</span>
</a>
</li>
<li>
<a href="/docs/extract">
<span class="docs-home-mode-label"><span class="docs-home-mode-slash">/</span>impeccable extract</span>
<span class="docs-home-mode-hint">Pull reusable components and tokens into the design system.</span>
</a>
</li>
</ul>
</section>
<div class="skills-overview-categories">
<div class="docs-categories">
${categoriesHtml}
</div>
</div>`;
@@ -397,7 +459,7 @@ function renderRuleCard(rule) {
const layerLabel = LAYER_LABELS[layer] || layer;
const layerTitle = LAYER_DESCRIPTIONS[layer] || '';
const skillLink = rule.skillSection
? `<a class="rule-card-skill-link" href="/skills/impeccable#${slugify(rule.skillSection)}">See in /impeccable</a>`
? `<a class="rule-card-skill-link" href="/docs/impeccable#${slugify(rule.skillSection)}">See in /impeccable</a>`
: '';
const visual = rule.visual
? `<div class="rule-card-visual" aria-hidden="true"><div class="rule-card-visual-inner">${rule.visual}</div></div>`
@@ -500,9 +562,9 @@ function renderVisualModeMain() {
<h2 class="visual-mode-methods-title">Three ways to run it</h2>
<div class="visual-mode-methods-grid">
<article class="visual-mode-method">
<p class="visual-mode-method-label">Inside /critique</p>
<h3 class="visual-mode-method-name"><a href="/skills/critique">/critique</a></h3>
<p class="visual-mode-method-desc">The design review skill opens the overlay automatically during its browser assessment pass. You get the deterministic findings highlighted in place while the LLM runs its separate heuristic review.</p>
<p class="visual-mode-method-label">Inside /impeccable critique</p>
<h3 class="visual-mode-method-name"><a href="/docs/critique">/impeccable critique</a></h3>
<p class="visual-mode-method-desc">The design review command opens the overlay automatically during its browser assessment pass. You get the deterministic findings highlighted in place while the LLM runs its separate heuristic review.</p>
</article>
<article class="visual-mode-method">
<p class="visual-mode-method-label">Standalone CLI</p>
@@ -579,7 +641,7 @@ ${rules.map(renderRuleCard).join('\n')}
<header class="anti-patterns-header">
<p class="sub-page-eyebrow">${totalRules} rules</p>
<h1 class="sub-page-title">Anti-patterns</h1>
<p class="sub-page-lede">The full catalog of patterns <a href="/skills/impeccable">/impeccable</a> teaches against. ${detectedCount} are caught by a deterministic detector (<code>npx impeccable detect</code> or the browser extension). ${llmCount} can only be flagged by <a href="/skills/critique">/critique</a>'s LLM review pass. Want to see them live on real pages? Try <a href="/visual-mode">Visual Mode</a>.</p>
<p class="sub-page-lede">The full catalog of patterns <a href="/docs/impeccable">/impeccable</a> teaches against. ${detectedCount} are caught by a deterministic detector (<code>npx impeccable detect</code> or the browser extension). ${llmCount} can only be flagged by <a href="/docs/critique">/impeccable critique</a>'s LLM review pass. Want to see them live on real pages? Try <a href="/visual-mode">Visual Mode</a>.</p>
</header>
<details class="anti-patterns-legend">
@@ -592,7 +654,7 @@ ${rules.map(renderRuleCard).join('\n')}
<dl class="anti-patterns-legend-layers">
<div><dt><span class="rule-card-layer" data-layer="cli">CLI</span></dt><dd>Deterministic. Runs from <code>npx impeccable detect</code> on files, no browser required.</dd></div>
<div><dt><span class="rule-card-layer" data-layer="browser">Browser</span></dt><dd>Deterministic, but needs real browser layout. Runs via the browser extension or Puppeteer, not the plain CLI.</dd></div>
<div><dt><span class="rule-card-layer" data-layer="llm">LLM only</span></dt><dd>No deterministic detector. Caught by <a href="/skills/critique">/critique</a> during its LLM design review.</dd></div>
<div><dt><span class="rule-card-layer" data-layer="llm">LLM only</span></dt><dd>No deterministic detector. Caught by <a href="/docs/critique">/impeccable critique</a> during its LLM design review.</dd></div>
</dl>
</div>
</details>
@@ -612,7 +674,7 @@ ${sectionsHtml}
export async function generateSubPages(rootDir) {
const data = await buildSubPageData(rootDir);
const outDirs = {
skills: path.join(rootDir, 'public/skills'),
docs: path.join(rootDir, 'public/docs'),
antiPatterns: path.join(rootDir, 'public/anti-patterns'),
tutorials: path.join(rootDir, 'public/tutorials'),
visualMode: path.join(rootDir, 'public/visual-mode'),
@@ -626,39 +688,41 @@ export async function generateSubPages(rootDir) {
const generated = [];
// Skills index: docs-browser layout with unified sidebar.
// Docs index: the full command reference with rich cards.
{
const sidebar = renderDocsSidebar(data.skillsByCategory, data.tutorials, null);
const main = renderSkillsOverviewMain(data.skillsByCategory);
const main = renderSkillsOverviewMain(data.skillsByCategory, data.skills);
const html = renderPage({
title: 'Skills | Impeccable',
title: 'Docs | Impeccable',
description:
'18 commands that teach your AI harness how to design. Browse by category: create, evaluate, refine, simplify, harden.',
'20 commands that teach your AI harness how to design. Browse by category: create, evaluate, refine, simplify, harden.',
bodyHtml: wrapInDocsLayout(sidebar, main),
activeNav: 'docs',
canonicalPath: '/skills',
canonicalPath: '/docs',
bodyClass: 'sub-page skills-layout-page',
});
const out = path.join(outDirs.skills, 'index.html');
const out = path.join(outDirs.docs, 'index.html');
fs.writeFileSync(out, html, 'utf-8');
generated.push(out);
}
// Skills detail pages: same docs-browser shell as the overview.
// Per-command detail pages: same docs-browser shell as the overview.
for (const skill of data.skills) {
const sidebar = renderDocsSidebar(data.skillsByCategory, data.tutorials, { kind: 'skill', id: skill.id });
const main = renderSkillDetail(skill, data.knownSkillIds);
const title = `/${skill.id} | Impeccable`;
const title = skill.isSubCommand
? `/impeccable ${skill.id} | Impeccable`
: `/${skill.id} | Impeccable`;
const description = skill.editorial?.frontmatter?.tagline || skill.description;
const html = renderPage({
title,
description,
bodyHtml: wrapInDocsLayout(sidebar, main),
activeNav: 'docs',
canonicalPath: `/skills/${skill.id}`,
canonicalPath: `/docs/${skill.id}`,
bodyClass: 'sub-page skills-layout-page',
});
const out = path.join(outDirs.skills, `${skill.id}.html`);
const out = path.join(outDirs.docs, `${skill.id}.html`);
fs.writeFileSync(out, html, 'utf-8');
generated.push(out);
}
@@ -703,7 +767,7 @@ export async function generateSubPages(rootDir) {
const html = renderPage({
title: 'Visual Mode | Impeccable',
description:
'See every anti-pattern flagged directly on the page. Live detection overlay from Impeccable, available via /critique, npx impeccable live, or the upcoming Chrome extension.',
'See every anti-pattern flagged directly on the page. Live detection overlay from Impeccable, available via /impeccable critique, npx impeccable live, or the upcoming Chrome extension.',
bodyHtml: renderVisualModeMain(),
activeNav: 'visual-mode',
canonicalPath: '/visual-mode',
+73 -17
View File
@@ -27,13 +27,23 @@ import { generateSubPages } from './build-sub-pages.js';
* Also validates that key HTML files reference the correct numbers.
*/
function generateCounts(rootDir, skills, buildDir) {
// Count active (non-deprecated) user-invocable commands
const activeCommands = skills.filter(s => {
if (!s.userInvocable) return false;
const content = fs.readFileSync(s.filePath, 'utf-8');
return !content.includes('DEPRECATED');
});
const commandCount = activeCommands.length;
// Count active commands. After the v3.0 consolidation, commands are sub-commands
// of /impeccable. Count them from the command router table in SKILL.md.
const impeccableSkill = skills.find(s => s.name === 'impeccable');
let commandCount;
if (impeccableSkill) {
// Count lines in the router table that have a | `command` | pattern
const routerMatches = impeccableSkill.body.match(/^\| `\w+` \|/gm);
commandCount = routerMatches ? routerMatches.length : 0;
} else {
// Fallback: count user-invocable skills
const activeCommands = skills.filter(s => {
if (!s.userInvocable) return false;
const content = fs.readFileSync(s.filePath, 'utf-8');
return !content.includes('DEPRECATED');
});
commandCount = activeCommands.length;
}
// Count detection rules from impeccable package
const detectPkgPath = path.join(rootDir, 'src/detect-antipatterns.mjs');
@@ -56,7 +66,6 @@ function generateCounts(rootDir, skills, buildDir) {
// Validate counts in key files
const filesToCheck = [
'public/index.html',
'public/cheatsheet.html',
'README.md',
'NOTICE.md',
'AGENTS.md',
@@ -73,7 +82,7 @@ function generateCounts(rootDir, skills, buildDir) {
// Check for stale command counts (look for "N commands" or "N skills" patterns)
// Strip changelog list content to avoid flagging historical counts
const strippedContent = content.replace(/<ul class="changelog-items">[\s\S]*?<\/ul>/g, '');
const countPattern = /\b(\d+)\s+(design\s+)?(commands|skills|steering commands)/gi;
const countPattern = /\b(\d+)\s+(design\s+)?(commands|sub-commands|skills|steering commands)/gi;
for (const match of strippedContent.matchAll(countPattern)) {
const num = parseInt(match[1]);
// Allow 1 (for "1 skill") and the correct count
@@ -174,7 +183,6 @@ function validateNoEmDashes(rootDir) {
const targets = [
'content/site',
'public/index.html',
'public/cheatsheet.html',
'public/privacy.html',
'scripts/build-sub-pages.js',
'scripts/lib/sub-pages-data.js',
@@ -228,7 +236,6 @@ function validateNoEmDashes(rootDir) {
function validateSiteHeader(rootDir) {
const pages = [
'public/index.html',
'public/cheatsheet.html',
'public/privacy.html',
];
const marker = '<!-- site-header v1 -->';
@@ -281,7 +288,6 @@ const DIST_DIR = path.join(ROOT_DIR, 'dist');
async function buildStaticSite(extraEntrypoints = []) {
const entrypoints = [
path.join(ROOT_DIR, 'public', 'index.html'),
path.join(ROOT_DIR, 'public', 'cheatsheet.html'),
path.join(ROOT_DIR, 'public', 'privacy.html'),
...extraEntrypoints,
];
@@ -328,7 +334,7 @@ async function buildStaticSite(extraEntrypoints = []) {
const cssFiles = result.outputs.filter(o => o.path.endsWith('.css'));
// When entrypoints span multiple depths under public/ (e.g. public/index.html
// + public/skills/polish.html), Bun's HTML loader preserves the full public/
// + public/docs/polish.html), Bun's HTML loader preserves the full public/
// prefix in the output tree. Flatten build/public/* up to build/*.
const nestedPublic = path.join(outdir, 'public');
if (fs.existsSync(nestedPublic)) {
@@ -435,8 +441,49 @@ function generateApiData(buildDir, skills, patterns) {
}));
fs.writeFileSync(path.join(apiDir, 'skills.json'), JSON.stringify(skillsData));
// commands.json (user-invocable skills only)
const commandsData = skillsData.filter(s => s.userInvocable);
// commands.json - after v3.0 consolidation, commands are sub-commands of
// /impeccable. Load them from command-metadata.json and include the root
// impeccable skill itself so UI surfaces like the cheatsheet can list them.
// Each entry also picks up a short `tagline` from its editorial file
// (content/site/skills/<id>.md) when one exists. Taglines are used by UI
// surfaces that need a human-friendly one-liner, while `description` stays
// optimized for auto-trigger keyword matching in the AI harness.
const readTagline = (id) => {
const editorialPath = path.join(ROOT_DIR, 'content/site/skills', `${id}.md`);
if (!fs.existsSync(editorialPath)) return null;
const raw = fs.readFileSync(editorialPath, 'utf-8');
const match = raw.match(/^---\n([\s\S]*?)\n---/);
if (!match) return null;
const taglineMatch = match[1].match(/tagline:\s*"([^"]+)"/);
return taglineMatch ? taglineMatch[1] : null;
};
const metadataPath = path.join(ROOT_DIR, 'source/skills/impeccable/scripts/command-metadata.json');
if (!fs.existsSync(metadataPath)) {
throw new Error(`command-metadata.json is missing at ${metadataPath}. This file is required to generate the commands API.`);
}
const impeccable = skills.find(s => s.name === 'impeccable');
if (!impeccable) {
throw new Error('impeccable skill not found in source/skills/. The build system expects a single impeccable skill.');
}
const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf-8'));
const commandsData = [
{
id: 'impeccable',
name: 'impeccable',
description: impeccable.description,
tagline: readTagline('impeccable'),
userInvocable: true,
},
...Object.entries(metadata).map(([id, meta]) => ({
id,
name: id,
description: meta.description,
tagline: readTagline(id),
userInvocable: true,
})),
];
fs.writeFileSync(path.join(apiDir, 'commands.json'), JSON.stringify(commandsData));
// patterns.json
@@ -454,7 +501,8 @@ function generateApiData(buildDir, skills, patterns) {
);
}
console.log(`✓ Generated static API data (${skillsData.length} skills, ${commandsData.length} commands)`);
const skillWord = skillsData.length === 1 ? 'skill' : 'skills';
console.log(`✓ Generated static API data (${skillsData.length} ${skillWord}, ${commandsData.length} commands)`);
}
/**
@@ -523,12 +571,16 @@ function generateCFConfig(buildDir) {
`;
fs.writeFileSync(path.join(buildDir, '_headers'), headers);
// _redirects: rewrite JSON API routes to static files (200 = rewrite, not redirect)
// _redirects: rewrite JSON API routes to static files (200 = rewrite, not redirect).
// Also permanent redirects for legacy URLs: /skills -> /docs, /cheatsheet -> /docs.
const redirects = `/api/skills /_data/api/skills.json 200
/api/commands /_data/api/commands.json 200
/api/patterns /_data/api/patterns.json 200
/api/command-source/:id /_data/api/command-source/:id.json 200
/gallery /visual-mode#try-it-live 301
/cheatsheet /docs 301
/skills /docs 301
/skills/:id /docs/:id 301
`;
fs.writeFileSync(path.join(buildDir, '_redirects'), redirects);
@@ -630,6 +682,10 @@ async function build() {
const deprecatedLocalSkills = [
'frontend-design', 'teach-impeccable',
'arrange', 'normalize', 'onboard', 'extract',
// v3.0 consolidation: standalone skills -> /impeccable sub-commands
'adapt', 'animate', 'audit', 'bolder', 'clarify', 'colorize',
'critique', 'delight', 'distill', 'harden', 'layout', 'optimize',
'overdrive', 'polish', 'quieter', 'shape', 'typeset',
];
for (const { configDir } of syncConfigs) {
for (const name of deprecatedLocalSkills) {
+4 -4
View File
@@ -82,7 +82,7 @@ export function createRenderer({ knownSkillIds = new Set(), currentSkillId = nul
*
* - `http(s)://…` → unchanged, external
* - `reference/foo.md` → `#reference-foo` on current skill page
* - `/skill-id` (known) → `/skills/skill-id`
* - `/skill-id` (known) → `/docs/skill-id`
* - `#anchor` → unchanged (in-page anchor)
* - anything else → unchanged (will be caught by build warnings later)
*
@@ -112,12 +112,12 @@ function resolveHref(href, { knownSkillIds, currentSkillId }) {
// /skill-id mentioned in prose (e.g. "run /polish")
const slashMatch = href.match(/^\/([a-z0-9-]+)$/i);
if (slashMatch && knownSkillIds.has(slashMatch[1])) {
return { href: `/skills/${slashMatch[1]}`, external: false };
return { href: `/docs/${slashMatch[1]}`, external: false };
}
// [text](other-skill) → /skills/other-skill
// [text](other-skill) → /docs/other-skill
if (/^[a-z0-9-]+$/i.test(href) && knownSkillIds.has(href)) {
return { href: `/skills/${href}`, external: false };
return { href: `/docs/${href}`, external: false };
}
// Unknown — pass through. Generator can warn separately.
+112 -24
View File
@@ -13,7 +13,7 @@
import fs from 'node:fs';
import path from 'node:path';
import { pathToFileURL } from 'node:url';
import { readSourceFiles, parseFrontmatter } from './utils.js';
import { readSourceFiles, parseFrontmatter, replacePlaceholders } from './utils.js';
import {
DETECTION_LAYERS,
VISUAL_EXAMPLES,
@@ -37,7 +37,6 @@ const EXCLUDED_SKILLS = new Set([
'arrange', // renamed to layout
'normalize', // merged into /polish
'onboard', // merged into /harden
'extract', // merged into /impeccable extract
]);
/**
@@ -48,6 +47,7 @@ const EXCLUDED_SKILLS = new Set([
const SKILL_CATEGORIES = {
// CREATE - build something new
impeccable: 'create',
craft: 'create',
shape: 'create',
// EVALUATE - review and assess
critique: 'evaluate',
@@ -69,9 +69,12 @@ const SKILL_CATEGORIES = {
polish: 'harden',
optimize: 'harden',
harden: 'harden',
// SYSTEM - setup and tooling
teach: 'system',
extract: 'system',
};
export const CATEGORY_ORDER = ['create', 'evaluate', 'refine', 'simplify', 'harden'];
export const CATEGORY_ORDER = ['create', 'evaluate', 'refine', 'simplify', 'harden', 'system'];
export const CATEGORY_LABELS = {
create: 'Create',
@@ -91,6 +94,43 @@ export const CATEGORY_DESCRIPTIONS = {
system: 'Setup and tooling. Design system work, extraction, organization.',
};
/**
* How commands relate to each other. Mirrors public/js/data.js so the server
* can render the docs overview without loading the client bundle.
*
* - leadsTo: commands that typically follow this one (used for evaluators)
* - pairs: the inverse counterpart (bolder <-> quieter)
* - combinesWith: commands that work well alongside this one
*/
export const COMMAND_RELATIONSHIPS = {
// Create
craft: { combinesWith: ['shape'] },
shape: { combinesWith: ['craft'] },
// Evaluate (these are the "diagnostics" that lead to fixes)
audit: { leadsTo: ['harden', 'optimize', 'adapt', 'clarify'] },
critique: { leadsTo: ['polish', 'distill', 'bolder', 'quieter', 'typeset', 'layout'] },
// Refine
typeset: { combinesWith: ['bolder', 'polish'] },
layout: { combinesWith: ['distill', 'adapt'] },
colorize: { combinesWith: ['bolder', 'delight'] },
animate: { combinesWith: ['delight'] },
delight: { combinesWith: ['bolder', 'animate'] },
bolder: { pairs: 'quieter' },
quieter: { pairs: 'bolder' },
overdrive: { combinesWith: ['animate', 'delight'] },
// Simplify
distill: { combinesWith: ['quieter', 'polish'] },
clarify: { combinesWith: ['polish', 'adapt'] },
adapt: { combinesWith: ['polish', 'clarify'] },
// Harden
polish: {},
optimize: {},
harden: { combinesWith: ['optimize'] },
// System
teach: {},
extract: {},
};
/**
* Parse the ANTIPATTERNS array out of src/detect-antipatterns.mjs.
* Mirrors the trick in scripts/build.js validateAntipatternRules() so we
@@ -168,28 +208,76 @@ export async function buildSubPageData(rootDir) {
const contentDir = path.join(rootDir, 'content/site');
const commandDemos = await loadCommandDemos(rootDir);
// Filter to user-invocable, non-deprecated skills.
const skills = rawSkills
.filter((s) => s.userInvocable && !EXCLUDED_SKILLS.has(s.name))
.map((s) => {
const category = SKILL_CATEGORIES[s.name];
const editorial = readEditorialWrapper(contentDir, 'skills', s.name);
const demo = commandDemos[s.name] || null;
return {
id: s.name,
name: s.name,
description: s.description,
argumentHint: s.argumentHint,
category,
body: s.body,
references: s.references,
editorial, // may be null
demo, // may be null (e.g. /shape has no demo)
};
})
.sort((a, b) => a.name.localeCompare(b.name));
// After the v3.0 consolidation there's only one source skill (impeccable).
// Its reference/ directory holds one file per command (audit.md, polish.md, ...).
// We synthesize a virtual skill entry for each sub-command so the sub-page
// generators can keep rendering per-command pages, index cards, etc.
const impeccableSkill = rawSkills.find((s) => s.name === 'impeccable');
const metadataPath = path.join(rootDir, 'source/skills/impeccable/scripts/command-metadata.json');
let commandMetadata = {};
if (fs.existsSync(metadataPath)) {
commandMetadata = JSON.parse(fs.readFileSync(metadataPath, 'utf-8'));
}
// Validate the category map covers every user-invocable skill.
// Reference files and skill bodies use {{command_prefix}} placeholders that
// are normally replaced by the provider transformer at build time. For web
// rendering, resolve them here using the claude-code provider as the canonical
// form ("/" prefix). The list of all command names includes the root skill
// plus all sub-commands from metadata so cross-references render correctly.
const allCommandNames = ['impeccable', ...Object.keys(commandMetadata)];
const resolvePlaceholders = (content) =>
replacePlaceholders(content, 'claude-code', [], allCommandNames);
const skills = [];
// 1. The root impeccable skill itself.
if (impeccableSkill && !EXCLUDED_SKILLS.has(impeccableSkill.name)) {
const editorial = readEditorialWrapper(contentDir, 'skills', 'impeccable');
const demo = commandDemos['impeccable'] || null;
skills.push({
id: 'impeccable',
name: 'impeccable',
description: impeccableSkill.description,
argumentHint: impeccableSkill.argumentHint,
category: SKILL_CATEGORIES['impeccable'],
body: resolvePlaceholders(impeccableSkill.body),
references: (impeccableSkill.references || []).map((r) => ({
...r,
content: resolvePlaceholders(r.content),
})),
editorial,
demo,
isSubCommand: false,
});
}
// 2. One virtual entry per sub-command, body sourced from its reference file.
if (impeccableSkill) {
for (const [cmdId, meta] of Object.entries(commandMetadata)) {
if (EXCLUDED_SKILLS.has(cmdId)) continue;
const refFile = impeccableSkill.references?.find((r) => r.name === cmdId);
if (!refFile) continue; // no reference file = no page
const editorial = readEditorialWrapper(contentDir, 'skills', cmdId);
const demo = commandDemos[cmdId] || null;
skills.push({
id: cmdId,
name: cmdId,
description: meta.description,
argumentHint: meta.argumentHint,
category: SKILL_CATEGORIES[cmdId],
body: resolvePlaceholders(refFile.content),
references: [], // sub-commands don't have their own references
editorial,
demo,
isSubCommand: true,
});
}
}
skills.sort((a, b) => a.name.localeCompare(b.name));
// Validate the category map covers every skill entry.
const missing = skills.filter((s) => !s.category).map((s) => s.id);
if (missing.length > 0) {
throw new Error(
+2 -2
View File
@@ -123,10 +123,10 @@ export function createTransformer(config) {
}
}
const userInvocableCount = skills.filter((s) => s.userInvocable).length;
const skillWord = skills.length === 1 ? 'skill' : 'skills';
const refInfo = refCount > 0 ? ` (${refCount} reference files)` : '';
const scriptInfo = scriptCount > 0 ? ` (${scriptCount} script files)` : '';
const prefixInfo = prefix ? ` [${prefix}prefixed]` : '';
console.log(`${displayName}${prefixInfo}: ${skills.length} skills (${userInvocableCount} user-invocable)${refInfo}${scriptInfo}`);
console.log(`${displayName}${prefixInfo}: ${skills.length} ${skillWord}${refInfo}${scriptInfo}`);
};
}
+3
View File
@@ -1,6 +1,9 @@
import { createTransformer } from './factory.js';
import { PROVIDERS } from './providers.js';
// Named exports exist primarily as stable spy targets for the test suite
// (build.test.js uses spyOn(transformers, 'transformCursor') etc.). build.js
// itself uses createTransformer + PROVIDERS directly, not these.
export const transformCursor = createTransformer(PROVIDERS.cursor);
export const transformClaudeCode = createTransformer(PROVIDERS['claude-code']);
export const transformGemini = createTransformer(PROVIDERS.gemini);
-81
View File
@@ -1,81 +0,0 @@
import path from 'path';
import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceholders, prefixSkillReferences } from '../utils.js';
/**
* Shared transformer logic for all providers.
*
* @param {Object} config - Provider-specific configuration
* @param {string} config.provider - Provider key for placeholders (e.g., 'claude-code')
* @param {string} config.displayName - Display name for logging (e.g., 'Claude Code')
* @param {string} config.configDir - Dot-directory name (e.g., '.claude')
* @param {Function} config.buildFrontmatter - (skill, skillName) => frontmatter object
* @param {Function} [config.transformBody] - Optional (body, skill) => transformed body
* @param {Array} skills - All skills
* @param {string} distDir - Distribution output directory
* @param {Object} options - Optional settings (prefix, outputSuffix)
*/
export function transformProvider(config, skills, distDir, options = {}) {
const { provider, displayName, configDir, buildFrontmatter, transformBody } = config;
const { prefix = '', outputSuffix = '' } = options;
const providerDir = path.join(distDir, `${provider}${outputSuffix}`);
const skillsDir = path.join(providerDir, `${configDir}/skills`);
cleanDir(providerDir);
ensureDir(skillsDir);
const allSkillNames = skills.map(s => s.name);
const commandNames = skills.filter(s => s.userInvokable).map(s => `${prefix}${s.name}`);
let refCount = 0;
let scriptCount = 0;
for (const skill of skills) {
const skillName = `${prefix}${skill.name}`;
const skillDir = path.join(skillsDir, skillName);
const frontmatterObj = buildFrontmatter(skill, skillName);
const frontmatter = generateYamlFrontmatter(frontmatterObj);
let skillBody = replacePlaceholders(skill.body, provider, commandNames);
// Replace {{scripts_path}} with provider-aware path to skill's scripts directory
const scriptsPath = provider === 'claude-code'
? '${CLAUDE_PLUGIN_ROOT}/scripts'
: `${configDir}/skills/${skillName}/scripts`;
skillBody = skillBody.replace(/\{\{scripts_path\}\}/g, scriptsPath);
if (prefix) skillBody = prefixSkillReferences(skillBody, prefix, allSkillNames);
if (transformBody) skillBody = transformBody(skillBody, skill);
const content = `${frontmatter}\n\n${skillBody}`;
writeFile(path.join(skillDir, 'SKILL.md'), content);
// Copy reference files if they exist
if (skill.references && skill.references.length > 0) {
const refDir = path.join(skillDir, 'reference');
ensureDir(refDir);
for (const ref of skill.references) {
writeFile(
path.join(refDir, `${ref.name}.md`),
replacePlaceholders(ref.content, provider)
);
refCount++;
}
}
// Copy script files if they exist
if (skill.scripts && skill.scripts.length > 0) {
const scriptsOutDir = path.join(skillDir, 'scripts');
ensureDir(scriptsOutDir);
for (const script of skill.scripts) {
writeFile(path.join(scriptsOutDir, script.name), script.content);
scriptCount++;
}
}
}
const userInvokableCount = skills.filter(s => s.userInvokable).length;
const refInfo = refCount > 0 ? ` (${refCount} reference files)` : '';
const scriptInfo = scriptCount > 0 ? ` (${scriptCount} script files)` : '';
const prefixInfo = prefix ? ` [${prefix}prefixed]` : '';
console.log(`${displayName}${prefixInfo}: ${skills.length} skills (${userInvokableCount} user-invokable)${refInfo}${scriptInfo}`);
}
+24 -4
View File
@@ -426,13 +426,33 @@ const EXCLUDED_FROM_SUGGESTIONS = new Set([
'frontend-design', 'i-frontend-design', // deprecated shim
]);
// Sub-commands of /impeccable that should appear in {{available_commands}}.
// These are the commands that audit/critique/etc. reference when suggesting next steps.
const IMPECCABLE_SUB_COMMANDS = [
'adapt', 'animate', 'audit', 'bolder', 'clarify', 'colorize',
'critique', 'delight', 'distill', 'harden', 'layout', 'optimize',
'overdrive', 'polish', 'quieter', 'shape', 'typeset',
];
export function replacePlaceholders(content, provider, commandNames = [], allSkillNames = []) {
const placeholders = PROVIDER_PLACEHOLDERS[provider] || PROVIDER_PLACEHOLDERS['cursor'];
const cmdPrefix = placeholders.command_prefix || '/';
const commandList = commandNames
.filter(n => !EXCLUDED_FROM_SUGGESTIONS.has(n))
.map(n => `${cmdPrefix}${n}`)
.join(', ');
// Build the available_commands list.
// After the v3.0 consolidation, commands are sub-commands of /impeccable.
// If there's only one user-invocable skill (impeccable), generate sub-command references.
// Otherwise fall back to listing skill names (backwards compat for forks).
const nonExcluded = commandNames.filter(n => !EXCLUDED_FROM_SUGGESTIONS.has(n));
let commandList;
if (nonExcluded.length === 0) {
// Single-skill architecture: list sub-commands as /impeccable <sub>
commandList = IMPECCABLE_SUB_COMMANDS
.map(n => `${cmdPrefix}impeccable ${n}`)
.join(', ');
} else {
// Multi-skill architecture (backwards compat)
commandList = nonExcluded.map(n => `${cmdPrefix}${n}`).join(', ');
}
let result = content
.replace(/\{\{model\}\}/g, placeholders.model)