@hegemonart/get-design-done 1.27.7 → 1.28.5

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 (115) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/CHANGELOG.md +142 -0
  4. package/SKILL.md +1 -1
  5. package/agents/design-verifier.md +17 -0
  6. package/hooks/gdd-decision-injector.js +149 -3
  7. package/package.json +1 -1
  8. package/reference/accessibility.md +4 -0
  9. package/reference/adr-format.md +96 -0
  10. package/reference/apply-reflections-procedure.md +68 -0
  11. package/reference/architecture-vocabulary.md +102 -0
  12. package/reference/audit-scoring.md +14 -0
  13. package/reference/cache-policy.md +126 -0
  14. package/reference/color-theory.md +279 -0
  15. package/reference/compare-rubric.md +171 -0
  16. package/reference/composition.md +349 -0
  17. package/reference/connections-onboarding.md +417 -0
  18. package/reference/context-md-format.md +106 -0
  19. package/reference/contrast-advanced.md +205 -0
  20. package/reference/darkmode-audit-procedure.md +258 -0
  21. package/reference/debug-feedback-loops.md +119 -0
  22. package/reference/design-procedure.md +304 -0
  23. package/reference/design-system-guidance.md +2 -0
  24. package/reference/discover-procedure.md +204 -0
  25. package/reference/explore-procedure.md +267 -0
  26. package/reference/form-patterns.md +2 -0
  27. package/reference/health-mcp-detection.md +44 -0
  28. package/reference/health-skill-length-report.md +69 -0
  29. package/reference/heuristics.md +84 -0
  30. package/reference/i18n.md +554 -0
  31. package/reference/iconography.md +2 -0
  32. package/reference/milestone-completeness-rubric.md +87 -0
  33. package/reference/motion-interpolate.md +1 -0
  34. package/reference/palette-catalog.md +2 -0
  35. package/reference/peer-cli-protocol.md +161 -0
  36. package/reference/plan-procedure.md +278 -0
  37. package/reference/proportion-systems.md +267 -0
  38. package/reference/registry.json +204 -1
  39. package/reference/registry.schema.json +1 -1
  40. package/reference/router-rules.md +84 -0
  41. package/reference/rtl-cjk-cultural.md +2 -0
  42. package/reference/scan-procedure.md +731 -0
  43. package/reference/shared-preamble.md +78 -6
  44. package/reference/skill-authoring-contract.md +128 -0
  45. package/reference/start-procedure.md +115 -0
  46. package/reference/style-doc-procedure.md +150 -0
  47. package/reference/style-vocabulary.md +2 -0
  48. package/reference/threat-modeling.md +101 -0
  49. package/reference/typography.md +4 -0
  50. package/reference/verify-procedure.md +512 -0
  51. package/reference/visual-hierarchy-layout.md +4 -0
  52. package/scripts/validate-skill-length.cjs +283 -0
  53. package/skills/add-backlog/SKILL.md +1 -0
  54. package/skills/analyze-dependencies/SKILL.md +33 -122
  55. package/skills/apply-reflections/SKILL.md +1 -40
  56. package/skills/audit/SKILL.md +3 -1
  57. package/skills/bandit-status/SKILL.md +31 -66
  58. package/skills/benchmark/SKILL.md +15 -55
  59. package/skills/brief/SKILL.md +12 -1
  60. package/skills/cache-manager/SKILL.md +3 -57
  61. package/skills/check-update/SKILL.md +38 -75
  62. package/skills/compare/SKILL.md +29 -269
  63. package/skills/complete-cycle/SKILL.md +1 -1
  64. package/skills/connections/SKILL.md +21 -427
  65. package/skills/continue/SKILL.md +1 -0
  66. package/skills/darkmode/SKILL.md +32 -287
  67. package/skills/debug/SKILL.md +11 -8
  68. package/skills/design/SKILL.md +27 -245
  69. package/skills/discover/SKILL.md +26 -133
  70. package/skills/discuss/SKILL.md +18 -2
  71. package/skills/explore/SKILL.md +42 -176
  72. package/skills/fast/SKILL.md +1 -0
  73. package/skills/figma-write/SKILL.md +2 -2
  74. package/skills/health/SKILL.md +11 -33
  75. package/skills/help/SKILL.md +1 -0
  76. package/skills/list-assumptions/SKILL.md +1 -0
  77. package/skills/map/SKILL.md +8 -31
  78. package/skills/new-cycle/SKILL.md +3 -1
  79. package/skills/next/SKILL.md +1 -0
  80. package/skills/note/SKILL.md +1 -0
  81. package/skills/optimize/SKILL.md +21 -44
  82. package/skills/pause/SKILL.md +1 -0
  83. package/skills/peer-cli-add/SKILL.md +26 -108
  84. package/skills/peer-cli-customize/SKILL.md +22 -42
  85. package/skills/peers/SKILL.md +33 -57
  86. package/skills/plan/SKILL.md +33 -220
  87. package/skills/plant-seed/SKILL.md +1 -0
  88. package/skills/pr-branch/SKILL.md +1 -0
  89. package/skills/progress/SKILL.md +1 -7
  90. package/skills/quality-gate/SKILL.md +34 -166
  91. package/skills/quick/SKILL.md +1 -0
  92. package/skills/reapply-patches/SKILL.md +1 -0
  93. package/skills/recall/SKILL.md +1 -0
  94. package/skills/resume/SKILL.md +1 -0
  95. package/skills/review-backlog/SKILL.md +1 -0
  96. package/skills/router/SKILL.md +3 -59
  97. package/skills/scan/SKILL.md +36 -675
  98. package/skills/settings/SKILL.md +1 -0
  99. package/skills/ship/SKILL.md +1 -0
  100. package/skills/sketch/SKILL.md +1 -1
  101. package/skills/sketch-wrap-up/SKILL.md +13 -54
  102. package/skills/spike/SKILL.md +1 -1
  103. package/skills/spike-wrap-up/SKILL.md +12 -46
  104. package/skills/start/SKILL.md +13 -112
  105. package/skills/stats/SKILL.md +1 -0
  106. package/skills/style/SKILL.md +18 -140
  107. package/skills/synthesize/SKILL.md +1 -0
  108. package/skills/timeline/SKILL.md +1 -0
  109. package/skills/todo/SKILL.md +1 -0
  110. package/skills/turn-closeout/SKILL.md +36 -56
  111. package/skills/undo/SKILL.md +1 -0
  112. package/skills/update/SKILL.md +1 -0
  113. package/skills/verify/SKILL.md +42 -457
  114. package/skills/warm-cache/SKILL.md +3 -35
  115. package/skills/zoom-out/SKILL.md +26 -0
@@ -0,0 +1,304 @@
1
+ ---
2
+ name: design-procedure
3
+ type: meta-rules
4
+ version: 1.0.0
5
+ phase: 28.5
6
+ tags: [design, procedure, extracted, pipeline-stage, execute, wave-coordination]
7
+ last_updated: 2026-05-18
8
+ ---
9
+
10
+ Source: extracted from `skills/design/SKILL.md` (Phase 28.5 rework — D-10 extract-then-link).
11
+ The skill's load-bearing workflow stays in `../skills/design/SKILL.md`; this file holds the
12
+ detail the agent reaches for when executing a specific step (agent spawn prompts, wave
13
+ coordination, executor STATE.md protocol, figma-write dispatch).
14
+
15
+ # Design Procedure
16
+
17
+ Detailed procedure for the get-design-done `design` Stage 4 orchestrator. Companion to
18
+ `../skills/design/SKILL.md`. Read this file when executing a specific design step; the
19
+ SKILL.md keeps the load-bearing wave-iteration workflow + decision tree, this file holds
20
+ the full executor prompts and parallelism semantics.
21
+
22
+ ---
23
+
24
+ ## Stage entry
25
+
26
+ 1. Call `mcp__gdd_state__transition_stage` with `to: "design"`.
27
+ - Gate failure surfaces `error.context.blockers` to the user; do not advance.
28
+ - If the transition succeeds and the prior stage was already `design` with `status: in_progress`, this is a RESUME — use `task_progress` numerator as source of truth and skip tasks that already have a corresponding `.design/tasks/task-NN.md` file.
29
+ 2. Call `mcp__gdd_state__get` -> snapshot `state`; read `state.position.wave` to decide execution plan.
30
+
31
+ Abort only if `.design/DESIGN-PLAN.md` is missing:
32
+ > "No plan found. Run `/get-design-done:plan` first."
33
+
34
+ ---
35
+
36
+ ## Flag Parsing
37
+
38
+ - `--auto` -> `auto_mode=true` (no mid-stage prompts; architectural deviations still stop the individual task but continue with remaining tasks)
39
+ - `--parallel` -> `parallel_mode=true` (use worktree isolation for `Parallel: true` tasks)
40
+
41
+ ---
42
+
43
+ ## Pre-execution — Directionally-open check
44
+
45
+ Scan DESIGN-PLAN.md for tasks marked as "directionally open" (exploration-appropriate — e.g., tasks whose acceptance criteria read "explore N directions" or "pick a visual approach"). If any are found, print:
46
+
47
+ > "Tasks [IDs] appear directionally open — consider running `/gdd:sketch` first to explore variants before implementation."
48
+
49
+ Skip if `auto_mode=true`.
50
+
51
+ ## Pre-execution — Project-local conventions
52
+
53
+ When spawning the executor, include any `./.claude/skills/design-*-conventions.md` files in `<required_reading>` so the executor sees project-local design conventions (typography, color, layout, motion, component, interaction decisions codified from prior sketch wrap-ups). Also include any `~/.claude/gdd/global-skills/*.md` files if the directory exists — global skills are cross-project conventions that inform but do not override project-local D-XX decisions.
54
+
55
+ ---
56
+
57
+ ## .stories.tsx Stub (when storybook project detected)
58
+
59
+ After every new component file is created by the design-executor:
60
+
61
+ Step 1 — Check project detection (does not require server running):
62
+ Bash: ls .storybook/ 2>/dev/null || grep '"storybook"' package.json 2>/dev/null
63
+ -> Found -> storybook_project: true
64
+ -> Not found -> skip .stories.tsx emission
65
+
66
+ Step 2 — When storybook_project: true, emit a CSF stub alongside the component:
67
+ File: `<same directory as component>/<ComponentName>.stories.tsx`
68
+ Content follows CSF format (see `connections/storybook.md` for full template):
69
+ - Import `Meta` and `StoryObj` from `@storybook/react`
70
+ - Import the new component
71
+ - `meta: Meta<typeof ComponentName>` with `title` and `parameters.a11y.test = 'error'`
72
+ - Export `Default`, `Primary`, `Disabled` story variants
73
+ Adjust `title` to match directory structure (e.g., `'Components/Button'` or `'Features/Auth/LoginForm'`)
74
+
75
+ Note: the `.stories.tsx` stub is emitted whenever `storybook_project: true` regardless of whether
76
+ the dev server is running. New components need stories even in offline/CI contexts.
77
+
78
+ ---
79
+
80
+ ## Step 1 — Parse DESIGN-PLAN.md
81
+
82
+ Read `.design/DESIGN-PLAN.md`. Partition tasks by `## Wave N` heading. Within each wave, partition by `Parallel: true` vs `Parallel: false`. Compute `total_tasks` for `task_progress` denominator.
83
+
84
+ If resuming: skip tasks where `.design/tasks/task-NN.md` already exists.
85
+
86
+ ---
87
+
88
+ ## Parallelism Decision (per wave, before spawning)
89
+
90
+ For each wave:
91
+ 1. Read `.design/config.json` `parallelism` (or defaults from `reference/config-schema.md`).
92
+ 2. Collect candidates in the wave; check `Touches:`, `writes:`, `parallel-safe`, and `typical-duration-seconds` fields.
93
+ 3. Apply rules in order from `reference/parallelism-rules.md` (hard -> soft). Overlapping Touches split into sequential sub-waves.
94
+ 4. Record the parallelism decision for this wave via `mcp__gdd_state__update_progress` with `task_progress: "<completed>/<total>"` and `status: "design_wave_<N>_parallelism: <parallel|serial>, reason=<short-reason>"` — the status string is the canonical carrier (mirrors the plan-stage convention from Plan 20-09; a dedicated tool may be added in a follow-on plan).
95
+ 5. If `parallel`: spawn all candidates via concurrent `Task()` calls in one response. If `serial`: spawn sequentially.
96
+
97
+ ### Executor prompt template (applies to every spawned design-executor)
98
+
99
+ Every spawned executor receives the following STATE.md contract in its prompt:
100
+
101
+ > **STATE.md mutation protocol** — When you complete a task in your assigned batch, update STATE.md ONLY via the `gdd-state` MCP tools. Specifically:
102
+ > - Report task progress: `mcp__gdd_state__update_progress` with your new `task_progress` fraction.
103
+ > - Add blockers: `mcp__gdd_state__add_blocker` with `{ stage: "design", date: <today>, text: "..." }`.
104
+ > - Resolve your own blockers on fix: `mcp__gdd_state__resolve_blocker` with the blocker id.
105
+ >
106
+ > Do NOT `Read` + `Write` `.design/STATE.md` directly — the MCP tools enforce the lockfile and emit mutation events. Direct writes corrupt parallel state.
107
+
108
+ Inline this protocol block verbatim inside every design-executor prompt in both the parallel-batch and sequential-tail spawns below. Concurrent executors (Phase 10.1 parallel mode) each emit `update_progress` calls; the lockfile (Plan 20-01) and event stream (Plan 20-06) serialize them safely.
109
+
110
+ ## Step 2 — Wave-by-Wave Execution
111
+
112
+ For each Wave in order (Wave 1, Wave 2, ...):
113
+
114
+ ### Parallel batch (if `parallel_mode=true` AND any `Parallel: true` tasks in wave)
115
+
116
+ Report the partition before spawning:
117
+
118
+ ```
119
+ === Wave [N] — parallel mode ===
120
+ Parallel batch ([N] tasks — spawning concurrently):
121
+ [01] [type]: [scope] — touches: [files]
122
+ [02] [type]: [scope] — touches: [files]
123
+
124
+ Sequential tail ([N] tasks):
125
+ [03] [type]: [scope] — touches: [files]
126
+
127
+ Spawning agents now...
128
+ ================================
129
+ ```
130
+
131
+ Spawn ALL `Parallel: true` tasks in this wave as concurrent `Task()` calls in ONE response. Each call uses `isolation: "worktree"`:
132
+
133
+ ```
134
+ Task("design-executor", """
135
+ <required_reading>
136
+ @.design/STATE.md
137
+ @.design/DESIGN-PLAN.md
138
+ @.design/DESIGN-CONTEXT.md
139
+ @reference/[type-relevant].md
140
+ </required_reading>
141
+
142
+ You are the design-executor agent. Execute Task NN from DESIGN-PLAN.md.
143
+
144
+ Prompt context:
145
+ task_id: NN
146
+ task_type: [type]
147
+ task_scope: [scope]
148
+ task_acceptance_criteria:
149
+ - [criterion 1]
150
+ - [criterion 2]
151
+ wave: N
152
+ is_parallel: true
153
+ auto_mode: [true|false]
154
+
155
+ Write .design/tasks/task-NN.md and make an atomic commit `feat(design-NN): [type] — [scope]`.
156
+
157
+ Emit `## EXECUTION COMPLETE` when done.
158
+ """, subagent_type="design-executor", isolation="worktree")
159
+ ```
160
+
161
+ Wait for all parallel tasks to emit `## EXECUTION COMPLETE`.
162
+
163
+ **Merge worktrees** (preserved from v2.1.0 — do not redesign):
164
+
165
+ ```
166
+ === Parallel batch complete ===
167
+ [check/warn/cross] Task 01 — [type]
168
+ [check/warn/cross] Task 02 — [type]
169
+
170
+ Merging worktrees...
171
+ ================================
172
+ ```
173
+
174
+ Merge each worktree branch back into the working directory. Each agent touched non-overlapping files (guaranteed by the conflict check on `Touches:` fields). If an unexpected merge conflict appears, flag it and ask the user to resolve before continuing.
175
+
176
+ After merge, roll up the batch's progress:
177
+
178
+ - Call `mcp__gdd_state__update_progress` with `task_progress: "<completed>/<total>"` and `status: "design_wave_<N>_parallel_batch_complete"`.
179
+ - Call `mcp__gdd_state__checkpoint` — records the wave boundary in `<timestamps>` and bumps `last_checkpoint`.
180
+
181
+ ### Sequential tail (Parallel: false tasks, or all tasks if `parallel_mode=false`)
182
+
183
+ Announce each wave before starting:
184
+
185
+ ```
186
+ === Wave [N] — [N tasks] — sequential ===
187
+ Tasks:
188
+ [01] [type]: [scope]
189
+ [02] [type]: [scope]
190
+ ==========================================
191
+ ```
192
+
193
+ Run one at a time. Same `Task("design-executor", ...)` pattern with `is_parallel: false` (no worktree isolation):
194
+
195
+ ```
196
+ Task("design-executor", """
197
+ <required_reading>
198
+ @.design/STATE.md
199
+ @.design/DESIGN-PLAN.md
200
+ @.design/DESIGN-CONTEXT.md
201
+ @reference/[type-relevant].md
202
+ </required_reading>
203
+
204
+ You are the design-executor agent. Execute Task NN from DESIGN-PLAN.md.
205
+
206
+ Prompt context:
207
+ task_id: NN
208
+ task_type: [type]
209
+ task_scope: [scope]
210
+ task_acceptance_criteria:
211
+ - [criterion 1]
212
+ - [criterion 2]
213
+ wave: N
214
+ is_parallel: false
215
+ auto_mode: [true|false]
216
+
217
+ Write .design/tasks/task-NN.md and make an atomic commit `feat(design-NN): [type] — [scope]`.
218
+
219
+ Emit `## EXECUTION COMPLETE` when done.
220
+ """, subagent_type="design-executor")
221
+ ```
222
+
223
+ After each task completes, call `mcp__gdd_state__update_progress` with the new `task_progress: "<completed>/<total>"` and `status: "design_wave_<N>_task_<NN>_complete"`.
224
+
225
+ After the final sequential task of the wave, call `mcp__gdd_state__checkpoint` — records the wave boundary in `<timestamps>` and bumps `last_checkpoint`.
226
+
227
+ ---
228
+
229
+ ## Step 3 — Wave Checkpoint
230
+
231
+ After each wave (unless `--auto` flag was passed):
232
+
233
+ ```
234
+ === Wave [N] complete ===
235
+ check [N] tasks complete
236
+ warn [N] deviations (see .design/tasks/ files)
237
+
238
+ Ready for Wave [N+1]? (yes / review first)
239
+ =========================
240
+ ```
241
+
242
+ Skip checkpoint if `auto_mode=true`.
243
+
244
+ ---
245
+
246
+ ## Step 4 — Handle Deviations
247
+
248
+ After each wave, check task-NN.md files for `status: deviation`. If any found:
249
+
250
+ - Call `mcp__gdd_state__get` -> read `state.blockers`; present affected task IDs and their blocker descriptions from the returned snapshot.
251
+ - Offer: (a) stop stage, (b) continue remaining tasks
252
+ - In `auto_mode`: continue automatically, log all deviations
253
+ - When a blocker is addressed (fix committed by a follow-up task), call `mcp__gdd_state__resolve_blocker` with the blocker id to clear it from the live state.
254
+
255
+ ---
256
+
257
+ ## State Update (exit)
258
+
259
+ 1. Call `mcp__gdd_state__set_status` with `status: "design_complete"` — marks the stage completed without transitioning; verify calls `transition_stage` on its entry, keeping the transition atomic with the owning stage.
260
+ 2. Call `mcp__gdd_state__checkpoint` — stamps `last_checkpoint` and appends a `design_completed_at` entry to `<timestamps>`.
261
+
262
+ ---
263
+
264
+ ## After Completion
265
+
266
+ Print summary:
267
+
268
+ ```
269
+ === Design stage complete ===
270
+ Tasks: [N] complete / [M] total
271
+ Deviations: [N]
272
+ Commits: [git log --oneline since stage start]
273
+
274
+ Next: /get-design-done:verify
275
+ -> Scores the result against baseline, checks must-haves,
276
+ runs NNG heuristic evaluation, and identifies gaps.
277
+ ==============================
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Figma Write Dispatch (after design-executor completes)
283
+
284
+ After design-executor has finished and DESIGN-PLAN.md tasks are complete:
285
+
286
+ 1. Read `figma:` status from `.design/STATE.md` `<connections>` (the unified remote MCP covers both reads and writes as of v1.0.7.1):
287
+ - If `figma: not_configured` or `figma: unavailable` or absent -> skip this block entirely (no prompt, no output)
288
+ - If `figma: available` -> proceed to step 2
289
+
290
+ 2. Offer the user a prompt:
291
+ ```
292
+ figma write-back is available — propagate design decisions back to Figma?
293
+ Modes: annotate (layer comments) | tokenize (variable bindings) | mappings (Code Connect)
294
+ Run figma-write? (y/N):
295
+ ```
296
+
297
+ 3. If user answers "y" or "yes":
298
+ - Ask which mode: annotate / tokenize / mappings (or all)
299
+ - Spawn `design-figma-writer` agent with the selected mode
300
+ - Pass `--dry-run` flag if user requests preview first
301
+
302
+ 4. If user answers "n", "N", or no response: skip silently.
303
+
304
+ Note: This dispatch is always opt-in. The design stage never auto-runs figma-writer without user confirmation.
@@ -33,6 +33,8 @@ Examples:
33
33
  - `--space-8: 8px`
34
34
  - `--font-size-16: 16px`
35
35
 
36
+ **See:** [`./proportion-systems.md`](./proportion-systems.md) for the whole-UI proportion system covering 4pt/8pt/√2 baseline grids, baseline-grid lock, vertical rhythm, and modular relationships across type / spacing / sizing / radius scales — the primitive tokens above are the codified output of that system.
37
+
36
38
  Primitive tokens should never be used directly in component code. They exist only to feed the semantic layer. This constraint is essential: if components reference primitive tokens directly, you lose the ability to theme them without modifying component code.
37
39
 
38
40
  ### Semantic Layer (Roles)
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: discover-procedure
3
+ type: meta-rules
4
+ version: 1.0.0
5
+ phase: 28.5
6
+ tags: [discover, procedure, extracted, pipeline-stage, connection-probe, design-context-builder]
7
+ last_updated: 2026-05-18
8
+ ---
9
+
10
+ Source: extracted from `skills/discover/SKILL.md` (Phase 28.5 rework — D-10 extract-then-link).
11
+ The skill's load-bearing workflow stays in `../skills/discover/SKILL.md`; this file holds the
12
+ detail the agent reaches for when executing a specific step (state integration, three
13
+ connection probes, design-context-builder + design-context-checker agent prompts, lazy gate
14
+ prompt, auto-mode CSS detection).
15
+
16
+ # Discover Procedure
17
+
18
+ Detailed procedure for the get-design-done `discover` Stage 1.5 orchestrator. Companion to
19
+ `../skills/discover/SKILL.md`. Read this file when executing a specific discover step.
20
+
21
+ ---
22
+
23
+ ## State Integration
24
+
25
+ 1. Read `.design/STATE.md`.
26
+ - If missing: create minimal skeleton from `reference/STATE-TEMPLATE.md` with stage=discover, status=in_progress, task_progress=0/1, and log warning: "STATE.md not found — created fresh. If this is a resumed session, run /get-design-done:scan first."
27
+ - If present and stage==discover and status==in_progress: RESUME — continue existing interview; do not reset.
28
+ - Otherwise: normal transition — set frontmatter stage=discover, <position> stage=discover, status=in_progress, task_progress=0/1.
29
+ 2. **Probe connection availability** — ToolSearch runs FIRST because MCP tools may be in the deferred tool set. This is the canonical probe pattern (spec lives in `connections/connections.md`; copied inline because SKILL.md has no include mechanism — if the probe pattern changes, update all stages that copied it). See §Connection Probes below.
30
+ 3. Update last_checkpoint. Write STATE.md.
31
+
32
+ ---
33
+
34
+ ## Connection Probes
35
+
36
+ ### A — Figma probe (variant-agnostic)
37
+
38
+ ```
39
+ A1. ToolSearch({ query: "figma get_metadata use_figma", max_results: 10 })
40
+ A2. Parse tool names matching /^mcp__([^_]*figma[^_]*)__(get_metadata|use_figma)$/i
41
+ into read-capable and write-capable prefix sets.
42
+ A3. Empty read set -> figma: not_configured (skip all Figma paths)
43
+ One or more matches -> pick prefix via tiebreaker:
44
+ (1) both-sets > reads-only,
45
+ (2) `figma` > others,
46
+ (3) non-`figma-desktop` > desktop,
47
+ (4) alphabetical.
48
+ A4. Call {prefix}get_metadata:
49
+ Success -> figma: available (prefix=mcp__<prefix>__, writes=<true|false>)
50
+ Error -> figma: unavailable
51
+ ```
52
+
53
+ ### B — Refero probe (ToolSearch presence is sufficient — no tool call needed)
54
+
55
+ ```
56
+ B1. ToolSearch({ query: "refero", max_results: 5 })
57
+ B2. Empty result -> refero: not_configured
58
+ Non-empty -> refero: available
59
+ ```
60
+
61
+ ### C — Pinterest probe (ToolSearch-only, same pattern as Refero)
62
+
63
+ ```
64
+ C1. ToolSearch({ query: "mcp-pinterest", max_results: 5 })
65
+ C2. Empty result -> pinterest: not_configured
66
+ Non-empty -> pinterest: available
67
+ ```
68
+
69
+ No live `pinterest_search` call at probe time — ToolSearch presence is sufficient. The synthesizer makes the actual search calls.
70
+
71
+ After all probes (A, B, C), update `.design/STATE.md` `<connections>` with the results and continue. Downstream stages (design-context-builder) read `<connections>` from STATE.md rather than re-probing.
72
+
73
+ ---
74
+
75
+ ## Auto Mode
76
+
77
+ Auto Mode CSS detection (when `auto_mode: true` is passed to the builder):
78
+
79
+ 1. If tailwind.config.{js,cjs,mjs,ts} exists -> Tailwind-only project
80
+ - Skip CSS file grep
81
+ - Parse tailwind.config for color palette, spacing scale, font families
82
+ - Use tailwind.config values as the baseline style signal
83
+ 2. Else -> fall through to existing CSS file grep logic
84
+
85
+ ---
86
+
87
+ ## Step 1 — Spawn design-context-builder
88
+
89
+ ```
90
+ Task("design-context-builder", """
91
+ <required_reading>
92
+ @.design/STATE.md
93
+ @reference/audit-scoring.md
94
+ @reference/anti-patterns.md
95
+ </required_reading>
96
+
97
+ You are the design-context-builder agent. Auto-detect existing design system
98
+ state via grep/glob before asking questions. Interview the user ONLY for areas
99
+ where auto-detect returned no confident answer. Write .design/DESIGN-CONTEXT.md.
100
+
101
+ Baseline audit directory detection (ordered fallback chain):
102
+ 1. If src/ exists -> use src/
103
+ 2. Elif app/ exists -> use app/ (Next.js App Router)
104
+ 3. Elif pages/ exists -> use pages/ (Next.js Pages Router)
105
+ 4. Elif lib/ exists -> use lib/ (library-only projects)
106
+ 5. Else -> flag "layout unknown", skip baseline, note in DESIGN-CONTEXT.md
107
+
108
+ Common gray areas to probe during discovery (Area 7):
109
+ 1. font-change risk — switching type families when existing UI has body copy in a specific family. Ask: "Is the current body font intentional or inherited? OK to change?"
110
+ 2. token-layer introduction risk — adding CSS custom properties to a codebase that uses direct values. Ask: "Do you want design tokens (--primary, --surface) or inline values (hex, rgb)?"
111
+ 3. Component rebuild vs restyle — when to keep existing component, when to rebuild from scratch. Ask: "For <component>, restyle in place or rebuild?"
112
+
113
+ Context:
114
+ auto_mode: <true|false>
115
+
116
+ Output file: .design/DESIGN-CONTEXT.md
117
+ Emit `## CONTEXT COMPLETE` when done.
118
+ """)
119
+ ```
120
+
121
+ Wait for `## CONTEXT COMPLETE`. Update STATE.md task_progress = 0.5.
122
+
123
+ ---
124
+
125
+ ## Step 1.75 — Lazy gate: should design-context-checker run? (Plan 10.1-04, D-21)
126
+
127
+ Spawn the cheap Haiku gate before the full context-checker:
128
+
129
+ Task("design-context-checker-gate", """
130
+ <required_reading>
131
+ @.design/STATE.md
132
+ </required_reading>
133
+
134
+ You are the design-context-checker-gate.
135
+
136
+ Context:
137
+ diff_files: <git diff --name-only HEAD~1..HEAD>
138
+ diff_body: (not needed — single-file heuristic)
139
+ baseline_sha: <HEAD~1>
140
+
141
+ Apply the heuristic (DESIGN-CONTEXT.md in diff_files?). Emit JSON + `## GATE COMPLETE`.
142
+ """)
143
+
144
+ Wait for `## GATE COMPLETE`. Parse JSON:
145
+
146
+ - `spawn: false` -> append `lazy_skipped: true` telemetry row for `design-context-checker`, skip Step 2, set STATE.md `<position>` as if checker passed (rationale: DESIGN-CONTEXT.md didn't change, last validation still holds), emit `design-context-checker skipped — <rationale>`.
147
+ - `spawn: true` -> proceed to Step 2 as currently written.
148
+
149
+ **Note:** On first-run discover, the builder just wrote DESIGN-CONTEXT.md so the gate returns `spawn: true`. The gate meaningfully short-circuits only on re-runs where the builder made no changes.
150
+
151
+ **Parallel synthesizer note:** discover does not spawn parallel researchers in v1, so `skills/synthesize/` is not wired here. If future variants spawn N parallel interviewers/auto-detectors, wire synthesize between dispatch and collate as in `skills/map/` Step 3.5.
152
+
153
+ ---
154
+
155
+ ## Step 2 — Spawn design-context-checker
156
+
157
+ ```
158
+ Task("design-context-checker", """
159
+ <required_reading>
160
+ @.design/STATE.md
161
+ @.design/DESIGN-CONTEXT.md
162
+ </required_reading>
163
+
164
+ You are the design-context-checker agent. Validate DESIGN-CONTEXT.md across
165
+ 6 dimensions. Return APPROVED or BLOCKED with per-dimension verdicts.
166
+
167
+ Emit `## CONTEXT CHECK COMPLETE` when done.
168
+ """)
169
+ ```
170
+
171
+ Wait for `## CONTEXT CHECK COMPLETE`.
172
+
173
+ ---
174
+
175
+ ## Step 3 — Handle checker verdict
176
+
177
+ If APPROVED: proceed to state update.
178
+ If BLOCKED: present dimensions that BLOCKED to user, offer fix-and-retry loop (re-spawn builder with specific fix instructions). Do not proceed to planning.
179
+
180
+ ---
181
+
182
+ ## State Update (exit)
183
+
184
+ 1. Set <position> status=completed, task_progress=1/1.
185
+ 2. Set <timestamps> discover_completed_at=<ISO 8601 now>.
186
+ 3. Update last_checkpoint. Write STATE.md.
187
+
188
+ ---
189
+
190
+ ## After Writing
191
+
192
+ ```
193
+ === Discovery complete ===
194
+ Saved: .design/DESIGN-CONTEXT.md
195
+
196
+ Baseline score: [N]/100 ([grade])
197
+ Key issues: [top issue 1], [top issue 2], [top issue 3]
198
+
199
+ Next: /get-design-done:plan
200
+ -> Decomposes your context into executable design tasks.
201
+ ==========================
202
+ ```
203
+
204
+ Do not proceed to planning automatically unless `--auto` was passed.