@radicool/throughline 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/adapters/codex/AGENTS.md +11 -10
  3. package/adapters/codex/prompts/component-builder.md +107 -0
  4. package/adapters/codex/prompts/design-system-audit.md +20 -0
  5. package/adapters/codex/prompts/document-component.md +58 -0
  6. package/adapters/codex/prompts/repository-builder.md +14 -0
  7. package/adapters/codex/prompts/retrofit-planner.md +21 -1
  8. package/adapters/codex/prompts/storybook-chromatic-builder.md +84 -2
  9. package/adapters/cursor/.cursor/commands/document-component.md +58 -0
  10. package/adapters/cursor/.cursor/rules/component-builder.mdc +108 -1
  11. package/adapters/cursor/.cursor/rules/component-pipeline.mdc +1 -1
  12. package/adapters/cursor/.cursor/rules/design-system-audit.mdc +21 -1
  13. package/adapters/cursor/.cursor/rules/figma-environment-setup.mdc +1 -1
  14. package/adapters/cursor/.cursor/rules/icon-system-builder.mdc +1 -1
  15. package/adapters/cursor/.cursor/rules/repository-builder.mdc +15 -1
  16. package/adapters/cursor/.cursor/rules/retrofit-planner.mdc +22 -2
  17. package/adapters/cursor/.cursor/rules/storybook-chromatic-builder.mdc +85 -3
  18. package/adapters/cursor/.cursor/rules/token-builder.mdc +1 -1
  19. package/adapters/cursor/.cursor/rules/token-crosswalk-builder.mdc +1 -1
  20. package/adapters/cursor/.cursor/rules/token-sheet-builder.mdc +1 -1
  21. package/adapters/cursor/.cursor/rules/token-sync-layer.mdc +1 -1
  22. package/adapters/generic/AGENTS.md +11 -10
  23. package/adapters/generic/commands/document-component.md +58 -0
  24. package/adapters/generic/skills/component-builder/SKILL.md +107 -0
  25. package/adapters/generic/skills/design-system-audit/SKILL.md +20 -0
  26. package/adapters/generic/skills/repository-builder/SKILL.md +14 -0
  27. package/adapters/generic/skills/retrofit-planner/SKILL.md +21 -1
  28. package/adapters/generic/skills/storybook-chromatic-builder/SKILL.md +84 -2
  29. package/package.json +1 -1
  30. package/references/component-doc-archetypes.md +90 -0
  31. package/references/component-doc-schema.md +154 -0
  32. package/references/doc-card-builder.md +565 -0
  33. package/references/doc-writing-standard.md +144 -0
  34. package/references/figma-component-standards.md +63 -16
  35. package/references/guide-voice.md +96 -0
  36. package/references/manifest-schema.md +46 -6
  37. package/scripts/README.md +34 -0
  38. package/scripts/build-doc-card-builder.mjs +143 -0
  39. package/scripts/build-docs-digest.mjs +74 -0
  40. package/scripts/docs-check.mjs +117 -0
  41. package/scripts/docs-lint.mjs +163 -0
  42. package/scripts/install.mjs +13 -1
  43. package/scripts/lib/doc-card-plan.mjs +101 -0
  44. package/scripts/lib/doc-card-render.figma.js +371 -0
  45. package/scripts/lib/doc-record.mjs +54 -0
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Take a single new component from Figma to fully-built-and-storied code, end to end — build it in Figma, sync any new tokens it introduced, then build its code component and stories. This is an orchestrator that sequences the component-builder, token-sync-layer, and storybook-chromatic-builder skills with a human confirmation between each stage. Use this when the user wants to add a new component to an existing design system, ship a component end-to-end, or run the full new-component flow. Also trigger on \"/new-component\" or when someone says they want one component built all the way through to code. Make sure to use this when the design system foundations already exist and the user wants to add one more component through the whole pipeline."
2
+ description: "Take a single new component from Figma to fully-built-and-storied code, end to end — build it in Figma, sync any new tokens it introduced, then build its code component and stories. Orchestrates component-builder, token-sync-layer, and storybook-chromatic-builder with a human confirmation between each stage. Use this when the user wants to add a new component to an existing design system, ship a component end-to-end, or run the full new-component flow. Also trigger on \"/new-component\" or when someone wants one component built all the way through to code."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Component pipeline (orchestrator)
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Measure a pre-existing design system before retrofitting it onto tokens — size the code-side color surface and inventory the existing Figma file with verified per-class reads, then compute how semantic the system already is so the retrofit is right-sized. This is a PROCESS skill and the brownfield front door. Use this when retrofitting a design system onto a mature codebase and an already-populated Figma file, when the user wants to audit an existing system, size a retrofit, count existing tokens/variables/bindings, or figure out how much work a migration is. Also trigger when figma-environment-setup detects a brownfield situation (existing repo or populated Figma file), before any building. Make sure to use this whenever someone is converging two mature, drifted artifacts rather than building greenfield."
2
+ description: "Measure a pre-existing design system before retrofitting it onto tokens, so the retrofit is right-sized. This is a PROCESS skill and the brownfield front door. Use this when retrofitting a design system onto a mature codebase and an already-populated Figma file, when the user wants to audit an existing system, size a retrofit, count existing tokens/variables/bindings, or figure out how much work a migration is. Also trigger when figma-environment-setup detects a brownfield situation (existing repo or populated Figma file), before any building."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Design-system audit (brownfield front door)
@@ -60,6 +60,23 @@ counts:
60
60
  repo with no Tailwind simply scores `0` there. Detect what the repo actually uses (is
61
61
  there a `tailwind.config`? SCSS? CSS-in-JS?) and explain the counts in those terms.
62
62
 
63
+ ## Step 1.5 — Size the documentation surface
64
+
65
+ Inventory existing documentation the same way the code surface is sized — from
66
+ **verified reads, never assumptions**. Per component (or per code component when no
67
+ Figma component exists yet), record whether usage docs already exist and where:
68
+
69
+ - **Code:** JSDoc/TSDoc on the component, an `.mdx` doc page, a per-component
70
+ README.
71
+ - **Figma:** a populated component `description` field.
72
+
73
+ Write the totals to `audit.docSurface` in the manifest, e.g. `{ "documented": 12,
74
+ "undocumented": 34, "sources": { "codeJsdoc": 8, "mdx": 4, "figmaDescription": 6,
75
+ "readme": 3 } }`. This right-sizes the documentation retrofit (how much exists to
76
+ adopt vs. author from scratch) so `retrofit-planner`'s `docs` phase can be planned
77
+ against real numbers. See `.throughline/references/component-doc-schema.md`
78
+ for what a full record contains.
79
+
63
80
  ## Step 2 — Inventory the Figma file (verified per-class reads)
64
81
 
65
82
  Variables, text styles, and effect/paint styles are **different surfaces** — read each
@@ -107,6 +124,9 @@ Set `tokens.intakeMode: "retrofit"` (this skill establishes the brownfield path
107
124
  owns this transition). Append `design-system-audit` to `completedSkills`.
108
125
 
109
126
  Then recommend the next step:
127
+ - Report the documentation debt from `audit.docSurface` (documented vs.
128
+ undocumented) and note that the retrofit's `docs` phase will adopt existing docs
129
+ before authoring the gaps.
110
130
  - If the user wants the guided, gated end-to-end retrofit → **`retrofit-planner`**
111
131
  (the orchestrator; recommended for multi-session retrofits).
112
132
  - If they only want the crosswalk backbone next → **`token-crosswalk-builder`** (it
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Set up the local working folder and connect Cursor to Figma so the design-system skills can read and write variables, styles, and components. This is a SETUP/PROCESS skill — it must run BEFORE brainstorming, not after it, because there is nothing to brainstorm until the environment exists. Invoke this skill immediately when the user wants to start, set up, or begin building a design system — phrases like 'let's setup my design system', 'let's get started', 'connect Figma', or 'build my design system' should all trigger this skill first, ahead of brainstorming. Also trigger when the user wants to fix a broken Figma connection, or mentions the Figma Console MCP, the desktop bridge plugin, or a Figma access token. It is the required foundation everything else depends on — always run it before any other design-system skill."
2
+ description: "Set up the local working folder and connect Cursor to Figma so the design-system skills can read and write variables, styles, and components. Run this BEFORE brainstorming and before any other design-system skill. Invoke it immediately when the user wants to start, set up, or begin building a design system — phrases like 'let's setup my design system', 'let's get started', 'connect Figma', or 'build my design system' should all trigger this skill first, ahead of brainstorming. Also trigger when the user wants to fix a broken Figma connection, or mentions the Figma Console MCP, the desktop bridge plugin, or a Figma access token."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Figma environment setup
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Build an icon system in Figma — a dedicated \"Icons\" page populated with the user's chosen icon library (Lucide, Material, or custom SVGs) as well-named, scalable components using the fastest, most-automated mechanism per library (for Lucide, batch-fetching the curated subset's official SVGs from the source repo and componentizing them hands-off; for Material, the official community file or importer plugin) rather than hand-generating icons or making the user copy components by hand. Use this when the user wants to set up icons, add an icon library, import Lucide or Material icons, create icon components, or build an icon set in Figma. Also trigger when the user mentions iconography, an icon page, or needs icons for their components. Make sure to use this whenever someone needs a managed set of icon components in their Figma design system."
2
+ description: "Build an icon system in Figma — a dedicated \"Icons\" page of well-named, scalable icon components from Lucide, Tabler, Phosphor, Material, or custom SVGs. Use this when the user wants to set up icons, add an icon library, import Lucide or Material icons, create icon components, or build an icon set in Figma. Also trigger when the user mentions iconography, an icon page, or needs icons for their components."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Icon system builder
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Graduate the local design-system folder into a real monorepo — a pnpm + Turborepo workspace with packages for tokens and UI components and room for apps — and walk the user from a plain folder to local git to a GitHub remote with PRs and CI. Use this when the user wants to set up a repo, create a GitHub repository, add version control, turn their folder into a real project, or prepare to sync tokens to code. Also trigger when the user mentions monorepo, Turborepo, pnpm workspace, GitHub, version control, or when the token-sync or Storybook skills report that a repo isn't set up yet. Make sure to use this skill when someone is moving from the Figma/design phase into the code phase, even if they just say \"I want to turn this into code\" — it's the bridge between the two halves."
2
+ description: "Graduate the local design-system folder into a real monorepo — a pnpm + Turborepo workspace with packages for tokens and UI components — and walk the user from a plain folder to local git to a GitHub remote with PRs and CI. Use this when the user wants to set up a repo, create a GitHub repository, add version control, turn their folder into a real project, or say \"I want to turn this into code\". Also trigger when the user mentions monorepo, Turborepo, pnpm workspace, GitHub, version control, or when the token-sync or Storybook skills report that a repo isn't set up yet."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Repository builder
@@ -110,6 +110,20 @@ in it" — they already have a working local repo.
110
110
  On success, set `workspace.stage` and `repo.stage` to `github` and record
111
111
  `repo.remote`. Append `repository-builder` to `completedSkills`.
112
112
 
113
+ ### Adopt the documentation store
114
+
115
+ The folder-resident documentation store at `design-system/docs/` (canonical
116
+ `*.doc.json` records plus the generated `index.json` + `llms.txt`) already exists
117
+ from the Figma phase. Bring it under version control as-is — **do not relocate it**
118
+ (the path is stable across folder→repo, and every manifest `doc.path` points at it).
119
+ Ensure it is committed (not git-ignored).
120
+
121
+ Wire the documentation drift gate into the repo's verification so it runs in CI
122
+ alongside `tokens:validate`: add a `docs:check` step (the `docs-check.mjs` script is
123
+ installed by `storybook-chromatic-builder`; if code hasn't been set up yet, note
124
+ that the gate comes online with the Storybook step). `docs:check` exits non-zero on
125
+ drift; Figma surfaces report `edit-unverified` and are checked in a Figma session.
126
+
113
127
  ## Secrets: the part most people have never done
114
128
 
115
129
  This is where users with low coding experience get stuck — many have never made
@@ -1,10 +1,11 @@
1
1
  ---
2
- description: "Orchestrate a full brownfield design-system retrofit end to end — audit, refine variables in place, rebind components, sync, capture a Chromatic baseline, retrofit the code with dual output, then remove the old tokens only after a zero-reference grep — with a human confirmation gate between every phase. Use this when the user wants to run a complete retrofit, migrate a mature codebase and populated Figma file onto tokens, resume an in-progress retrofit, or be walked through the safe retrofit sequence. Also trigger after design-system-audit has sized the system, or when figma-environment-setup detects an in-progress retrofit. Make sure to use this whenever someone wants the guided, gated, multi-session brownfield retrofit rather than running the individual skills by hand."
2
+ description: "Orchestrate a full brownfield design-system retrofit end to end — audit, refine, rebind, sync, baseline, code, docs, cleanup — with a human confirmation gate between every phase. Use this when the user wants to run a complete retrofit, migrate a mature codebase and populated Figma file onto tokens, resume an in-progress retrofit, or be walked through the safe retrofit sequence. Also trigger after design-system-audit has sized the system, or when figma-environment-setup detects an in-progress retrofit."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Retrofit planner (orchestrator)
6
6
 
7
- Sequences a brownfield retrofit through the safe 7-phase order, gating each phase on a
7
+ Sequences a brownfield retrofit through the safe seven-phase order (with `docs` inserted
8
+ as a gated Phase 6.5), gating each phase on a
8
9
  human confirmation. Like `component-pipeline`, this skill holds **zero domain logic of
9
10
  its own** — it is a sequencer that invokes the real skills and the phase work, and only
10
11
  updates the manifest fields it owns (`retrofit.*`, `completedSkills`). All the
@@ -106,6 +107,25 @@ triad as you go — `check-types`, `build-storybook` + Chromatic, **and run the
106
107
  + spot-check 5–7 routes (the build alone is blind to story-unreachable SCSS). **Gate:**
107
108
  confirm the triad passes before continuing.
108
109
 
110
+ ### Phase 6.5 — `docs` (adopt existing documentation, then fill gaps)
111
+
112
+ Set `retrofit.phase = "docs"`. Bring the documentation layer onto the system's
113
+ components **adopt-first**, so no existing human-written doc is lost:
114
+
115
+ 1. **Adopt.** For each component, run the doc-authoring ingest (Step 4.5 of
116
+ `component-builder`): read existing code JSDoc/MDX/README and Figma
117
+ `description`, seed the canonical `.doc.json` marked `provenance: imported`, and
118
+ stamp fingerprints. This first pass **claims** existing content — it is not a
119
+ re-render and must not overwrite it.
120
+ 2. **Fill gaps.** Run the remaining generation layers (infer → enrich → specialize
121
+ → interview) only for blocks the adoption did not populate; the user approves.
122
+ 3. **Project + gate.** Render the code surfaces (Step 5.5 of
123
+ `storybook-chromatic-builder`), run `docs:digest`, and run `docs:check` — it
124
+ should pass (surfaces just rendered) with Figma surfaces `edit-unverified`.
125
+
126
+ Confirm with the user before writing, consistent with every other phase. On a large
127
+ system, size the batch from `audit.docSurface` and adopt in reviewable chunks.
128
+
109
129
  ### Phase 7 — `cleanup`
110
130
 
111
131
  Remove the old token outputs **only after** the repo-wide token-removal guard returns
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Stand up Storybook in the monorepo, build code components matching the Figma design system (consuming the synced tokens and implementing the captured slot contracts), generate stories for every component, set up Chromatic for visual regression testing, and wire Code Connect when the user's Figma plan supports it. Use this when the user wants to set up Storybook, build component stories, add visual regression testing, set up Chromatic, connect Figma components to code, or build the code side of their design system. Also trigger after components and token sync exist, when moving the component library into code. Make sure to use this whenever someone wants their Figma components realized as documented, tested code."
2
+ description: "Stand up Storybook in the monorepo, build code components matching the Figma design system, generate stories for every component, set up Chromatic for visual regression testing, and wire Code Connect when the user's Figma plan supports it. Use this when the user wants to set up Storybook, build component stories, add visual regression testing, set up Chromatic, connect Figma components to code, or build the code side of their design system. Also trigger after components and token sync exist, when moving the component library into code."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Storybook + Chromatic builder
@@ -31,6 +31,17 @@ system). Wire it to consume `packages/tokens` output so stories render with the
31
31
  real design tokens (import the generated CSS/theme). Checkpoint: confirm
32
32
  Storybook runs and shows the token-themed canvas.
33
33
 
34
+ Install the documentation scripts alongside the token scripts: copy the five
35
+ files and register the three npm scripts listed under **Documentation scripts —
36
+ install as a set** in `.throughline/scripts/README.md`. That table is
37
+ the single source of truth for what a consuming repo gets; do not restate the
38
+ list here.
39
+
40
+ These are the documentation analog of `tokens:validate`; see
41
+ `.throughline/scripts/README.md`. This copy is setup, not a forever-fork:
42
+ `/document-component` re-checks these files' freshness on every run and refreshes
43
+ them from the plugin when it has moved on.
44
+
34
45
  **pnpm build-script allowlist (first-run gotcha).** On pnpm workspaces, the
35
46
  `@storybook/react-vite` install pulls `esbuild`, whose postinstall is blocked by
36
47
  pnpm's default `onlyBuiltDependencies` policy — Storybook then fails to start with a
@@ -153,6 +164,43 @@ Configure Chromatic to snapshot everything (do **not** set `onlyChanged`), and
153
164
  verify a token-only PR re-snapshots all stories — they should flip orange against
154
165
  the green baseline.
155
166
 
167
+ ### Usage & cost guardrails
168
+
169
+ The full-snapshot default above is the right call for catching regressions, and it
170
+ is also the **maximum-usage** choice: every story, every run. Chromatic bills per
171
+ snapshot, so name this cost shape to the user when you set Chromatic up, and put the
172
+ guardrails in *before* the first big token PR, not after the bill.
173
+
174
+ What Chromatic actually offers (re-verify the live numbers at
175
+ `chromatic.com/pricing` — they drift):
176
+
177
+ - **Free plan (~5,000 snapshots/month):** testing **auto-pauses** when the ceiling
178
+ is hit. No surprise bill, but visual-regression coverage silently *stops* until
179
+ the monthly reset or an upgrade. For a full-suite design system that ceiling
180
+ arrives fast — treat a *paused* build as a red flag, not a passing one.
181
+ - **Paid plans: no hard spending cap.** Overage snapshots auto-bill at month-end.
182
+ The only native guardrail is **usage alerts** — an email when consumption crosses
183
+ a threshold you set (e.g. 90%).
184
+
185
+ The math, so the user sizes the plan honestly: **snapshots ≈ stories × modes ×
186
+ builds.** One `/sync-figma-tokens` PR re-snapshots the *entire* suite × every mode
187
+ in a single build — e.g. 40 components × 2 modes = 80 snapshots per build, and a
188
+ handful of token PRs plus daily `main` builds clears a free tier in a week.
189
+
190
+ So the guardrails, all of them user-controlled (Chromatic will not cap you):
191
+
192
+ 1. **Set usage alerts** at ~80% on a paid plan so the bill cannot sneak up. On the
193
+ free plan, make sure the user knows testing *pauses* at the ceiling.
194
+ 2. **Scope the CI trigger.** Run Chromatic on **pull requests and `main` only** —
195
+ never on every branch push — path-filter out docs-only changes, and keep it to
196
+ one Chromatic build per commit (no duplicate runs).
197
+ 3. **Size the plan to the math** before the first token PR. A large story count is
198
+ also the *only* reason to revisit TurboSnap (see above), and even then treat
199
+ every token change as a full run.
200
+
201
+ Do not silently pick a plan or leave the trigger wide open. Name the tradeoff and
202
+ let the user choose with the numbers in front of them.
203
+
156
204
  ## Step 5 — Code Connect (plan-gated, skip gracefully)
157
205
 
158
206
  Code Connect ties Figma components to their code counterparts so Figma's dev
@@ -174,6 +222,32 @@ mode shows the real code. It's plan-gated (Figma Organization/Enterprise).
174
222
  run after the user publishes. This does **not** block the code side: implement
175
223
  each slot prop from the recorded slot contract regardless of the Figma dropdown.
176
224
 
225
+ ## Step 5.5 — Render documentation to code
226
+
227
+ For each component that has a canonical record
228
+ (`design-system/docs/components/<Name>.doc.json`), render the code-side surfaces
229
+ from it (read `.throughline/references/component-doc-schema.md` for the
230
+ projection contract):
231
+
232
+ - **Storybook autodocs (MDX).** Generate `<Name>.mdx` next to the component (e.g.
233
+ `packages/ui/src/<Name>/<Name>.mdx`) rendering summary, description,
234
+ when-to-use/not, do's/don'ts, accessibility, and a variant/state table. Put the
235
+ record's fingerprint in MDX frontmatter as `docFingerprint: <fp>`.
236
+ - **JSDoc.** Add a doc comment to the code component from `summary` + `description`
237
+ and per-prop descriptions from `variants`/`states` meanings, so `argTypes`
238
+ descriptions surface in the Storybook controls table.
239
+ - **AI digest.** Run `docs:digest` to (re)generate `design-system/docs/index.json`
240
+ + `design-system/docs/llms.txt` from all records.
241
+
242
+ **Update the manifest:** add the `storybookMdx` surface to
243
+ `components.meta[<Name>].doc.surfaces` as `{ src: <fp>, render: <hash of the MDX
244
+ file>, file: "<repo-relative MDX path>" }`.
245
+
246
+ **Wire the gate.** Ensure `docs:check` is part of the repo's verification (a CI
247
+ step and/or a Turbo task). It compares every surface against its record and exits
248
+ non-zero on drift; Figma surfaces report `edit-unverified` (checked live in a Figma
249
+ session). Run `docs:check` once here and confirm it passes before handing off.
250
+
177
251
  ## Step 6 — Finalize component status (Figma write-back)
178
252
 
179
253
  A component built and storied here is now **done** — but its Figma doc card was
@@ -197,10 +271,15 @@ the `figma_execute` scripting gotchas — `getNodeByIdAsync` and an explicit
197
271
 
198
272
  - Set `components.meta[name].status` = `"stable"` and refresh
199
273
  `components.meta[name].updatedAt` to today.
274
+ - When promoting status (e.g. draft → stable), also set `status` + `updatedAt` in
275
+ the component's `.doc.json`, recompute its fingerprint, re-run `docs:digest`, and
276
+ re-render the affected surfaces so `docs:check` stays green.
200
277
  - If Figma is connected (per `figma.mechanism`), open the component's doc card and
201
278
  update the `Status Label` text to `stable`, re-bind the `Status` chip fill to
202
- the **success** semantic color variable (mode-aware, not a hardcoded hex), and
203
- set `Last Updated` to today's date then screenshot to confirm the chip
279
+ the **success** semantic color variable (mode-aware, not a hardcoded hex), then
280
+ re-run the canonical doc-card builder against the same card to refresh the
281
+ header date from the `record.updatedAt` already set above (it locates the date
282
+ node under either header shape) — then screenshot to confirm the chip
204
283
  recolored and the date changed.
205
284
  - If Figma isn't connected, still update the manifest and tell the user the card
206
285
  will reconcile next Figma session (or offer to reconnect and fix it now).
@@ -261,6 +340,9 @@ that may not exist.
261
340
  - Never rely on TurboSnap (`onlyChanged: true`) for a token-driven design system
262
341
  — its incremental model keeps missing global token changes. Default to full
263
342
  snapshots (every story, every run); revisit only at large story counts.
343
+ - Never leave Chromatic's cost shape unspoken or the CI trigger wide open — there
344
+ is no hard spend cap on paid plans, so set usage alerts, run it on PRs + `main`
345
+ only, and size the plan to stories × modes × builds before the first token PR.
264
346
  - Never use the sequential model for story-gen — parallelize via subagents.
265
347
  - Never capture the Chromatic baseline *after* a code retrofit — baseline before, so
266
348
  intended drift-fixes are distinguishable from regressions.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Build a two-tier (primitive + semantic) design token system as Figma variables — color ramps, spacing, type scale, radius, shadows — with light/dark or brand modes. IMPORTANT: this uses ONE COLLECTION PER CATEGORY PER TIER, never one giant Primitives collection + one giant Semantic collection. Each category (color, spacing, type, radius, border) gets its own primitive collection and its own semantic collection so that mode axes (Light/Dark, Desktop/Mobile) belong only to the categories that need them. Use this when the user wants to create design tokens, design variables, a color system, a type scale, a spacing system, or 'build my tokens' in Figma. Also trigger when the user mentions primitives and semantic tokens, variable collections, design system foundations, or modes/themes in Figma."
2
+ description: "Build a two-tier (primitive + semantic) design token system as Figma variables — color ramps, spacing, type scale, radius, shadows — with light/dark or brand modes, using one collection per category per tier. Use this when the user wants to create design tokens, design variables, a color system, a type scale, a spacing system, or 'build my tokens' in Figma. Also trigger when the user mentions primitives and semantic tokens, variable collections, design system foundations, or modes/themes in Figma."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Token builder
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Build the brownfield token crosswalk — a persistent three-way map between each new token, the old Figma variable, and the old code identifier(s) — as crosswalk.json, then install the vetted validator/reverse-index scripts into the monorepo and wire the tokens:validate CI gate. Use this when retrofitting a design system onto a mature codebase, when the user wants to map old tokens to new ones, build a crosswalk, set up tokens:validate, or generate a reverse index for SCSS/Tailwind swaps. Also trigger when retrofit-planner reaches the crosswalk stage, or after design-system-audit has sized the retrofit. Make sure to use this whenever someone needs the machine-readable backbone that drives a brownfield code retrofit and its validation gate."
2
+ description: "Build the brownfield token crosswalk — a persistent three-way map between each new token, the old Figma variable, and the old code identifier(s) — then wire the tokens:validate CI gate. Use this when retrofitting a design system onto a mature codebase, when the user wants to map old tokens to new ones, build a crosswalk, set up tokens:validate, or generate a reverse index for SCSS/Tailwind swaps. Also trigger when retrofit-planner reaches the crosswalk stage, or after design-system-audit has sized the retrofit."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Token crosswalk builder
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Build a beautiful, on-brand \"Foundations\" page in Figma that visually documents every variable collection and style — color ramps with swatches, the type scale, spacing, radius, shadows/elevations — with swatches live-bound to the actual variables where Figma allows. Use this when the user wants a visual stylesheet, a token reference page, a Foundations page, to document or showcase their design system, or to \"see all my tokens\" laid out. Also trigger after token-builder completes, when the user wants a visual artifact of their tokens. Make sure to use this when someone wants their tokens presented visually rather than just existing as variables."
2
+ description: "Build an on-brand \"Foundations\" page in Figma that visually documents every variable collection and style — color ramps with swatches, the type scale, spacing, radius, shadows/elevations. Use this when the user wants a visual stylesheet, a token reference page, a Foundations page, to document or showcase their design system, or to \"see all my tokens\" laid out. Also trigger after token-builder completes, when the user wants a visual artifact of their tokens."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Token sheet builder
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Sync Figma design variables into code-ready token files by extracting them to DTCG-format JSON, running them through Style Dictionary, and emitting framework-specific outputs via per-platform adapters (shadcn/Tailwind, MUI, vanilla CSS, iOS Swift, Android Kotlin, or custom). Sets up the reusable \"sync figma tokens\" command that re-runs the pipeline to catch updates and opens a PR for review. Use this when the user wants to turn Figma tokens into code, sync design tokens, generate tokens.css or a Tailwind config or tokens.swift, set up a token pipeline, or run \"sync figma tokens\". Also trigger when the user mentions Style Dictionary, design token export, or keeping code in sync with Figma. Make sure to use this whenever someone wants their Figma variables reflected in actual code files."
2
+ description: "Sync Figma design variables into code-ready token files via DTCG JSON and Style Dictionary, emitting framework-specific outputs (shadcn/Tailwind, MUI, vanilla CSS, iOS Swift, Android Kotlin, or custom), and set up the reusable \"sync figma tokens\" command. Use this when the user wants to turn Figma tokens into code, sync design tokens, generate tokens.css or a Tailwind config or tokens.swift, set up a token pipeline, or run \"sync figma tokens\". Also trigger when the user mentions Style Dictionary, design token export, or keeping code in sync with Figma."
3
3
  alwaysApply: false
4
4
  ---
5
5
  # Token sync layer
@@ -4,22 +4,23 @@ ThroughLine builds a design system end to end. Read the matching skill file for
4
4
 
5
5
  ## ThroughLine skills
6
6
 
7
- - `component-builder` — Build a foundational set of Figma components — buttons, inputs, cards, badges, chips, modals, and more — as properly structured components with variant matrices (types, sizes, states) and icon/component/content slots, bound to the design system's tokens and styles. → read `skills/component-builder/SKILL.md`.
7
+ - `component-builder` — Build Figma components — buttons, inputs, cards, badges, chips, modals, and more — with variant matrices (types, sizes, states) and icon/component/content slots bound to the design system's tokens and styles. → read `skills/component-builder/SKILL.md`.
8
8
  - `component-pipeline` — Take a single new component from Figma to fully-built-and-storied code, end to end — build it in Figma, sync any new tokens it introduced, then build its code component and stories. → read `skills/component-pipeline/SKILL.md`.
9
- - `design-system-audit` — Measure a pre-existing design system before retrofitting it onto tokens — size the code-side color surface and inventory the existing Figma file with verified per-class reads, then compute how semantic the system already is so the retrofit is right-sized. → read `skills/design-system-audit/SKILL.md`.
9
+ - `design-system-audit` — Measure a pre-existing design system before retrofitting it onto tokens, so the retrofit is right-sized. → read `skills/design-system-audit/SKILL.md`.
10
10
  - `figma-environment-setup` — Set up the local working folder and connect the agent to Figma so the design-system skills can read and write variables, styles, and components. → read `skills/figma-environment-setup/SKILL.md`.
11
- - `icon-system-builder` — Build an icon system in Figma — a dedicated "Icons" page populated with the user's chosen icon library (Lucide, Material, or custom SVGs) as well-named, scalable components using the fastest, most-automated mechanism per library (for Lucide, batch-fetching the curated subset's official SVGs from the source repo and componentizing them hands-off; for Material, the official community file or importer plugin) rather than hand-generating icons or making the user copy components by hand. → read `skills/icon-system-builder/SKILL.md`.
12
- - `repository-builder` — Graduate the local design-system folder into a real monorepo — a pnpm + Turborepo workspace with packages for tokens and UI components and room for apps — and walk the user from a plain folder to local git to a GitHub remote with PRs and CI. → read `skills/repository-builder/SKILL.md`.
13
- - `retrofit-planner` — Orchestrate a full brownfield design-system retrofit end to end — audit, refine variables in place, rebind components, sync, capture a Chromatic baseline, retrofit the code with dual output, then remove the old tokens only after a zero-reference grep — with a human confirmation gate between every phase. → read `skills/retrofit-planner/SKILL.md`.
14
- - `storybook-chromatic-builder` — Stand up Storybook in the monorepo, build code components matching the Figma design system (consuming the synced tokens and implementing the captured slot contracts), generate stories for every component, set up Chromatic for visual regression testing, and wire Code Connect when the user's Figma plan supports it. → read `skills/storybook-chromatic-builder/SKILL.md`.
15
- - `token-builder` — Build a two-tier (primitive + semantic) design token system as Figma variables — color ramps, spacing, type scale, radius, shadows — with light/dark or brand modes. → read `skills/token-builder/SKILL.md`.
16
- - `token-crosswalk-builder` — Build the brownfield token crosswalk — a persistent three-way map between each new token, the old Figma variable, and the old code identifier(s) — as crosswalk.json, then install the vetted validator/reverse-index scripts into the monorepo and wire the tokens:validate CI gate. → read `skills/token-crosswalk-builder/SKILL.md`.
17
- - `token-sheet-builder` — Build a beautiful, on-brand "Foundations" page in Figma that visually documents every variable collection and style — color ramps with swatches, the type scale, spacing, radius, shadows/elevations — with swatches live-bound to the actual variables where Figma allows. → read `skills/token-sheet-builder/SKILL.md`.
18
- - `token-sync-layer` — Sync Figma design variables into code-ready token files by extracting them to DTCG-format JSON, running them through Style Dictionary, and emitting framework-specific outputs via per-platform adapters (shadcn/Tailwind, MUI, vanilla CSS, iOS Swift, Android Kotlin, or custom). → read `skills/token-sync-layer/SKILL.md`.
11
+ - `icon-system-builder` — Build an icon system in Figma — a dedicated "Icons" page of well-named, scalable icon components from Lucide, Tabler, Phosphor, Material, or custom SVGs. → read `skills/icon-system-builder/SKILL.md`.
12
+ - `repository-builder` — Graduate the local design-system folder into a real monorepo — a pnpm + Turborepo workspace with packages for tokens and UI components — and walk the user from a plain folder to local git to a GitHub remote with PRs and CI. → read `skills/repository-builder/SKILL.md`.
13
+ - `retrofit-planner` — Orchestrate a full brownfield design-system retrofit end to end — audit, refine, rebind, sync, baseline, code, docs, cleanup — with a human confirmation gate between every phase. → read `skills/retrofit-planner/SKILL.md`.
14
+ - `storybook-chromatic-builder` — Stand up Storybook in the monorepo, build code components matching the Figma design system, generate stories for every component, set up Chromatic for visual regression testing, and wire Code Connect when the user's Figma plan supports it. → read `skills/storybook-chromatic-builder/SKILL.md`.
15
+ - `token-builder` — Build a two-tier (primitive + semantic) design token system as Figma variables — color ramps, spacing, type scale, radius, shadows — with light/dark or brand modes, using one collection per category per tier. → read `skills/token-builder/SKILL.md`.
16
+ - `token-crosswalk-builder` — Build the brownfield token crosswalk — a persistent three-way map between each new token, the old Figma variable, and the old code identifier(s) — then wire the tokens:validate CI gate. → read `skills/token-crosswalk-builder/SKILL.md`.
17
+ - `token-sheet-builder` — Build an on-brand "Foundations" page in Figma that visually documents every variable collection and style — color ramps with swatches, the type scale, spacing, radius, shadows/elevations. → read `skills/token-sheet-builder/SKILL.md`.
18
+ - `token-sync-layer` — Sync Figma design variables into code-ready token files via DTCG JSON and Style Dictionary, emitting framework-specific outputs (shadcn/Tailwind, MUI, vanilla CSS, iOS Swift, Android Kotlin, or custom), and set up the reusable "sync figma tokens" command. → read `skills/token-sync-layer/SKILL.md`.
19
19
 
20
20
  ## ThroughLine commands
21
21
 
22
22
  - `design-system-status` — Show a plain-language summary of the current design system state — what's set up, what's not, and sensible next steps — read from design-system.json. → read `commands/design-system-status.md`.
23
+ - `document-component` — Author, refresh, or reconcile the usage documentation for one existing component — draft its canonical doc record from four sources, project it to Figma, the doc card, and code, and resolve any drift via a reviewable per-item choice. → read `commands/document-component.md`.
23
24
  - `new-component` — Build a single new component end to end — in Figma, then sync any new tokens, then build its code component and stories — with a confirmation between each stage. → read `commands/new-component.md`.
24
25
  - `start` — Start building your design system — the deterministic entry point. → read `commands/start.md`.
25
26
  - `sync-figma-tokens` — Re-run the Figma-to-code token sync — extract current Figma variables, rebuild code outputs via Style Dictionary, and open a PR with the changes for review. → read `commands/sync-figma-tokens.md`.
@@ -0,0 +1,58 @@
1
+ Document a single existing component end to end, using the settings already in
2
+ `design-system.json` (`project.uiFramework`, `figma.mechanism`, `sync.platforms`)
3
+ rather than re-asking configuration. Scale explanation to `user.codingLevel`.
4
+
5
+ Ask which component to document (e.g. "Button"), then:
6
+
7
+ 1. **Author/refresh the record.** Run the doc-authoring pipeline from
8
+ the `component-builder` skill's *Author the documentation record* step —
9
+ ingest any existing docs first (brownfield), then infer → enrich (from
10
+ `.throughline/references/component-doc-archetypes.md`) → specialize →
11
+ interview. Authored prose follows
12
+ `.throughline/references/doc-writing-standard.md`. Set `updatedAt` to
13
+ today's date (ISO, `YYYY-MM-DD`) whenever the record is written or rewritten —
14
+ it is a projected field and the doc card's header renders it. Once the record is
15
+ written, run `node .throughline/scripts/docs-lint.mjs
16
+ design-system/docs/components/<Name>.doc.json` and fix its warnings. Do not
17
+ raise a separate confirmation for a warning on an `imported`/`user` block:
18
+ draft the rewrite and carry it into the approval gate below, shown as
19
+ before/after and labelled with the block's provenance, so one approval covers
20
+ the whole record. The user approves the drafted record before anything is
21
+ projected (Figma description, doc card, manifest). Blocks the user did not
22
+ clear keep their existing text; blocks the user did clear are stamped
23
+ `imported+user` so a later run neither re-asks nor rewrites them.
24
+ 2. **Project it.** Write `design-system/docs/components/<Name>.doc.json`, set the
25
+ Figma component `description`, rebuild the doc card's `Usage` band with the
26
+ canonical builder (`.throughline/references/doc-card-builder.md` —
27
+ verify its returned summary and stamp `surfaces.docCard.{src,render,renderer}`
28
+ from it), and (if the repo/code side exists) render MDX/JSDoc and run
29
+ `docs:digest` per the `storybook-chromatic-builder` render step.
30
+ 3. **Reconcile drift.** Before trusting `docs:check`, confirm the repo's copy of
31
+ the doc scripts is current: compare `DOC_CARD_RENDERER_VERSION` in the repo's
32
+ `scripts/lib/doc-card-plan.mjs` against the same constant in
33
+ `.throughline/scripts/lib/doc-card-plan.mjs`. If the repo file is
34
+ missing, or its version is lower, `docs:check` is reading stale rules and its
35
+ "no drift" is meaningless — say so plainly, and offer to refresh the repo's
36
+ doc scripts from the plugin copy. Refresh the whole set and re-check the npm
37
+ registrations, both per **Documentation scripts — install as a set** in
38
+ `.throughline/scripts/README.md` — a refreshed file whose script was
39
+ never registered is the same failure in a new place. Run `docs:check` (with the
40
+ refreshed scripts, if any). For each drifted surface, offer a per-item
41
+ choice — **re-render** (canonical wins) or **pull-back**
42
+ (fold the surface edit into the record) — and land the result as a reviewable
43
+ change. On a brownfield component's first pass, adopt existing content
44
+ (`provenance: imported`) rather than overwriting it.
45
+ `docs:check` may also report `layout-upgrade-available` (informational, never
46
+ failing): the card's layout predates the current builder. Offer to re-render
47
+ the `Usage` band now — rebuild happens on this touch, never unprompted.
48
+ 4. **Close the flow.** Hand back in the four-beat guide voice from
49
+ `.throughline/references/guide-voice.md`: the outcome, what you set
50
+ aside and why, one recommended next step, and at most one light alternative.
51
+ Read existing state to name what is actually outstanding rather than guessing —
52
+ a component at `status: "draft"` with no code surface in `meta[name].doc.surfaces`
53
+ means the code side is deferred. Do not close with a grid of co-equal options.
54
+
55
+ See `.throughline/references/component-doc-schema.md` for the record schema,
56
+ fingerprint contract, and projection mapping. If a component was never built in
57
+ Figma, point the user at `component-builder` first.
58
+
@@ -227,6 +227,110 @@ Two rules for every slot:
227
227
  Record each component's slots, variant matrix, and token bindings in the
228
228
  component spec (for Code Connect when available, else the repo component spec).
229
229
 
230
+ ## Step 4.5 — Author the documentation record (and project it)
231
+
232
+ Every component gets a canonical documentation record — the source of truth for
233
+ its usage docs — written to the working folder next to `design-system.json`
234
+ (**folder-resident from day one**, exactly like the manifest; no repo required).
235
+ Read `.throughline/references/component-doc-schema.md` for the exact JSON
236
+ schema, the fingerprint algorithm, and the projection contract.
237
+
238
+ **Run the generation pipeline (each layer only fills what it legitimately knows;
239
+ stamp `provenance` per block):** all authored prose follows
240
+ `.throughline/references/doc-writing-standard.md` — its plain
241
+ reference register, not this skill's guide voice.
242
+
243
+ 0. **Ingest existing docs — brownfield only, runs first.** If docs already exist
244
+ for this component (code JSDoc/MDX/README, or a populated Figma component
245
+ `description`), read them and seed the record marked `provenance: imported`.
246
+ **Never silently overwrite existing human-written docs** — this is the
247
+ read-before-you-assert rule. Skip on greenfield.
248
+ 1. **Infer from the built artifact.** From the component you just built — its
249
+ variants, states, slots, and bound tokens — author `description`, `variants`,
250
+ `states`, and `tokensUsed` (`tokensUsed` comes from the real variable bindings,
251
+ not a guess). Provenance `ai-inferred`.
252
+ 2. **Enrich from the archetype knowledge base.** Match the component to the nearest
253
+ archetype in `.throughline/references/component-doc-archetypes.md` and
254
+ seed `dos`, `donts`, `accessibility`, `whenToUse`, `whenNotToUse`. Provenance
255
+ `best-practice` (or `w3c-apg` for the accessibility block).
256
+ 3. **Specialize to `project.uiFramework`.** Align variant-meaning wording and the
257
+ accessibility idiom to the target framework (the same field you read for variant
258
+ vocabulary). Provenance `framework`.
259
+ 4. **Interview for the non-inferable.** Ask the user for brand/product-specific
260
+ do's & don'ts and intent. Provenance `user`. Write the draft to
261
+ `design-system/docs/components/<Name>.doc.json`, run
262
+ `node .throughline/scripts/docs-lint.mjs design-system/docs/components/<Name>.doc.json`,
263
+ and fix the warnings it raises. Do not raise a separate confirmation for
264
+ a warning on an `imported`/`user` block: draft the rewrite and carry it
265
+ into the approval gate below, shown as before/after and labelled with the
266
+ block's provenance. **Show the whole drafted record and get explicit
267
+ approval before projecting it anywhere** (Figma description, doc card,
268
+ manifest) — one approval covers the whole record. Blocks the user did not
269
+ clear keep their existing text; blocks the user did clear are stamped
270
+ `imported+user` so a later run neither re-asks nor rewrites them.
271
+
272
+ **Write the record and project it:**
273
+
274
+ - Write `design-system/docs/components/<Name>.doc.json` (JSON; required fields
275
+ `name`, `summary`, `description`).
276
+ - **Figma component description.** Set the component's native `description` field
277
+ (via `figma_set_description`) from this exact template — this is the surface
278
+ Dev Mode and Code Connect read, and it must be reproducible byte-for-byte by
279
+ any agent from the same record:
280
+
281
+ ```
282
+ <summary>
283
+
284
+ **When to use**
285
+ - <whenToUse[n]>
286
+
287
+ **When not to use**
288
+ - <whenNotToUse[n]>
289
+
290
+ **Do**
291
+ - <dos[n]>
292
+
293
+ **Don't**
294
+ - <donts[n]>
295
+
296
+ **Accessibility**
297
+ - <accessibility.keyboard[n]>
298
+ - <accessibility.notes[n]>
299
+
300
+ <!-- tl:doc <fp> -->
301
+ ```
302
+
303
+ Rules: every line is a record string **verbatim** — no re-wording, no added
304
+ connectives, no sentences that appear nowhere in the record. A block whose
305
+ source array is empty is omitted along with its bold label. The **Accessibility**
306
+ label is omitted only when both `accessibility.keyboard` and `accessibility.notes`
307
+ are empty; when one is empty its bullets are simply absent and the label stays.
308
+ Sections are separated by exactly one blank line, and the fingerprint marker is
309
+ always last.
310
+ - **Doc card body.** Render the card's `Usage` band with the canonical builder
311
+ snippet in `.throughline/references/doc-card-builder.md` (via
312
+ `figma_execute` with an explicit `timeout`, one card per call): fill the
313
+ RECORD/CANONICAL_FP slots, resolve the nine required semantic variables and
314
+ the `Body/Default` text style per that file's call contract, run it, and
315
+ verify the returned summary (`rowsRendered`, `blocksCreated`, `cardWidth`) —
316
+ not a screenshot. The builder creates the `Doc Fingerprint` node itself and
317
+ is the only thing that may build the usage body — never hand-assemble it.
318
+ - Compute `<fp>` as the canonical fingerprint defined in the schema reference
319
+ (sha256 of the projected record without `provenance`, first 16 hex chars).
320
+
321
+ **Update the manifest (fields this skill owns):** set
322
+ `components.meta[<Name>].doc` to `{ path, fingerprint: <fp>, surfaces: {
323
+ figmaDescription: { src: <fp>, render: <hash of the description text> }, docCard: {
324
+ src: <fp>, render: <summary.renderHash>, renderer: <summary.rendererVersion> } } }`
325
+ — the docCard entry is stamped from the builder's returned summary, never by
326
+ re-reading the card. The code surfaces (`storybookMdx`) are added later by
327
+ `storybook-chromatic-builder`.
328
+
329
+ Run the standard doc-card visual-validation + post-build audit
330
+ (`.throughline/references/figma-component-standards.md`) after enriching
331
+ the card. `docs:check` runs at the code stage; at folder stage the record + Figma
332
+ surfaces are the fallback.
333
+
230
334
  ## Step 5 — Naming as contract
231
335
 
232
336
  Name components deterministically so Figma↔code mapping is automatic: `Button` ↔
@@ -284,4 +388,7 @@ Offer next steps: build the code counterparts and stories
284
388
  internal architecture) **detaches every instance** that referenced its variants (the
285
389
  Card's footer buttons, etc.). Record which components consume which, warn before an
286
390
  architectural rebuild, and re-instance the affected consumers afterward.
391
+ - Never overwrite an existing component `description` or imported doc content
392
+ without reading it first and marking it `provenance: imported` — brownfield docs
393
+ are seeds, not blank slates.
287
394
 
@@ -56,6 +56,23 @@ counts:
56
56
  repo with no Tailwind simply scores `0` there. Detect what the repo actually uses (is
57
57
  there a `tailwind.config`? SCSS? CSS-in-JS?) and explain the counts in those terms.
58
58
 
59
+ ## Step 1.5 — Size the documentation surface
60
+
61
+ Inventory existing documentation the same way the code surface is sized — from
62
+ **verified reads, never assumptions**. Per component (or per code component when no
63
+ Figma component exists yet), record whether usage docs already exist and where:
64
+
65
+ - **Code:** JSDoc/TSDoc on the component, an `.mdx` doc page, a per-component
66
+ README.
67
+ - **Figma:** a populated component `description` field.
68
+
69
+ Write the totals to `audit.docSurface` in the manifest, e.g. `{ "documented": 12,
70
+ "undocumented": 34, "sources": { "codeJsdoc": 8, "mdx": 4, "figmaDescription": 6,
71
+ "readme": 3 } }`. This right-sizes the documentation retrofit (how much exists to
72
+ adopt vs. author from scratch) so `retrofit-planner`'s `docs` phase can be planned
73
+ against real numbers. See `.throughline/references/component-doc-schema.md`
74
+ for what a full record contains.
75
+
59
76
  ## Step 2 — Inventory the Figma file (verified per-class reads)
60
77
 
61
78
  Variables, text styles, and effect/paint styles are **different surfaces** — read each
@@ -103,6 +120,9 @@ Set `tokens.intakeMode: "retrofit"` (this skill establishes the brownfield path
103
120
  owns this transition). Append `design-system-audit` to `completedSkills`.
104
121
 
105
122
  Then recommend the next step:
123
+ - Report the documentation debt from `audit.docSurface` (documented vs.
124
+ undocumented) and note that the retrofit's `docs` phase will adopt existing docs
125
+ before authoring the gaps.
106
126
  - If the user wants the guided, gated end-to-end retrofit → **`retrofit-planner`**
107
127
  (the orchestrator; recommended for multi-session retrofits).
108
128
  - If they only want the crosswalk backbone next → **`token-crosswalk-builder`** (it
@@ -106,6 +106,20 @@ in it" — they already have a working local repo.
106
106
  On success, set `workspace.stage` and `repo.stage` to `github` and record
107
107
  `repo.remote`. Append `repository-builder` to `completedSkills`.
108
108
 
109
+ ### Adopt the documentation store
110
+
111
+ The folder-resident documentation store at `design-system/docs/` (canonical
112
+ `*.doc.json` records plus the generated `index.json` + `llms.txt`) already exists
113
+ from the Figma phase. Bring it under version control as-is — **do not relocate it**
114
+ (the path is stable across folder→repo, and every manifest `doc.path` points at it).
115
+ Ensure it is committed (not git-ignored).
116
+
117
+ Wire the documentation drift gate into the repo's verification so it runs in CI
118
+ alongside `tokens:validate`: add a `docs:check` step (the `docs-check.mjs` script is
119
+ installed by `storybook-chromatic-builder`; if code hasn't been set up yet, note
120
+ that the gate comes online with the Storybook step). `docs:check` exits non-zero on
121
+ drift; Figma surfaces report `edit-unverified` and are checked in a Figma session.
122
+
109
123
  ## Secrets: the part most people have never done
110
124
 
111
125
  This is where users with low coding experience get stuck — many have never made