@hegemonart/get-design-done 1.28.0 → 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 (98) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +78 -0
  4. package/SKILL.md +1 -1
  5. package/hooks/gdd-decision-injector.js +149 -3
  6. package/package.json +1 -1
  7. package/reference/adr-format.md +96 -0
  8. package/reference/apply-reflections-procedure.md +68 -0
  9. package/reference/architecture-vocabulary.md +102 -0
  10. package/reference/cache-policy.md +126 -0
  11. package/reference/compare-rubric.md +171 -0
  12. package/reference/connections-onboarding.md +417 -0
  13. package/reference/context-md-format.md +106 -0
  14. package/reference/darkmode-audit-procedure.md +258 -0
  15. package/reference/debug-feedback-loops.md +119 -0
  16. package/reference/design-procedure.md +304 -0
  17. package/reference/discover-procedure.md +204 -0
  18. package/reference/explore-procedure.md +267 -0
  19. package/reference/health-mcp-detection.md +44 -0
  20. package/reference/health-skill-length-report.md +69 -0
  21. package/reference/heuristics.md +84 -0
  22. package/reference/milestone-completeness-rubric.md +87 -0
  23. package/reference/peer-cli-protocol.md +161 -0
  24. package/reference/plan-procedure.md +278 -0
  25. package/reference/registry.json +169 -1
  26. package/reference/registry.schema.json +1 -1
  27. package/reference/router-rules.md +84 -0
  28. package/reference/scan-procedure.md +731 -0
  29. package/reference/shared-preamble.md +78 -6
  30. package/reference/skill-authoring-contract.md +128 -0
  31. package/reference/start-procedure.md +115 -0
  32. package/reference/style-doc-procedure.md +150 -0
  33. package/reference/threat-modeling.md +101 -0
  34. package/reference/verify-procedure.md +512 -0
  35. package/scripts/validate-skill-length.cjs +283 -0
  36. package/skills/add-backlog/SKILL.md +1 -0
  37. package/skills/analyze-dependencies/SKILL.md +33 -122
  38. package/skills/apply-reflections/SKILL.md +1 -40
  39. package/skills/audit/SKILL.md +3 -1
  40. package/skills/bandit-status/SKILL.md +31 -66
  41. package/skills/benchmark/SKILL.md +15 -55
  42. package/skills/brief/SKILL.md +12 -1
  43. package/skills/cache-manager/SKILL.md +3 -57
  44. package/skills/check-update/SKILL.md +38 -75
  45. package/skills/compare/SKILL.md +29 -269
  46. package/skills/complete-cycle/SKILL.md +1 -1
  47. package/skills/connections/SKILL.md +21 -427
  48. package/skills/continue/SKILL.md +1 -0
  49. package/skills/darkmode/SKILL.md +32 -287
  50. package/skills/debug/SKILL.md +11 -8
  51. package/skills/design/SKILL.md +27 -245
  52. package/skills/discover/SKILL.md +26 -133
  53. package/skills/discuss/SKILL.md +18 -2
  54. package/skills/explore/SKILL.md +40 -205
  55. package/skills/fast/SKILL.md +1 -0
  56. package/skills/figma-write/SKILL.md +2 -2
  57. package/skills/health/SKILL.md +11 -33
  58. package/skills/help/SKILL.md +1 -0
  59. package/skills/list-assumptions/SKILL.md +1 -0
  60. package/skills/map/SKILL.md +8 -31
  61. package/skills/new-cycle/SKILL.md +3 -1
  62. package/skills/next/SKILL.md +1 -0
  63. package/skills/note/SKILL.md +1 -0
  64. package/skills/optimize/SKILL.md +21 -44
  65. package/skills/pause/SKILL.md +1 -0
  66. package/skills/peer-cli-add/SKILL.md +26 -108
  67. package/skills/peer-cli-customize/SKILL.md +22 -42
  68. package/skills/peers/SKILL.md +33 -57
  69. package/skills/plan/SKILL.md +33 -220
  70. package/skills/plant-seed/SKILL.md +1 -0
  71. package/skills/pr-branch/SKILL.md +1 -0
  72. package/skills/progress/SKILL.md +1 -7
  73. package/skills/quality-gate/SKILL.md +34 -166
  74. package/skills/quick/SKILL.md +1 -0
  75. package/skills/reapply-patches/SKILL.md +1 -0
  76. package/skills/recall/SKILL.md +1 -0
  77. package/skills/resume/SKILL.md +1 -0
  78. package/skills/review-backlog/SKILL.md +1 -0
  79. package/skills/router/SKILL.md +3 -59
  80. package/skills/scan/SKILL.md +36 -675
  81. package/skills/settings/SKILL.md +1 -0
  82. package/skills/ship/SKILL.md +1 -0
  83. package/skills/sketch/SKILL.md +1 -1
  84. package/skills/sketch-wrap-up/SKILL.md +13 -54
  85. package/skills/spike/SKILL.md +1 -1
  86. package/skills/spike-wrap-up/SKILL.md +12 -46
  87. package/skills/start/SKILL.md +13 -112
  88. package/skills/stats/SKILL.md +1 -0
  89. package/skills/style/SKILL.md +18 -140
  90. package/skills/synthesize/SKILL.md +1 -0
  91. package/skills/timeline/SKILL.md +1 -0
  92. package/skills/todo/SKILL.md +1 -0
  93. package/skills/turn-closeout/SKILL.md +36 -56
  94. package/skills/undo/SKILL.md +1 -0
  95. package/skills/update/SKILL.md +1 -0
  96. package/skills/verify/SKILL.md +42 -457
  97. package/skills/warm-cache/SKILL.md +3 -35
  98. package/skills/zoom-out/SKILL.md +26 -0
@@ -0,0 +1,258 @@
1
+ ---
2
+ name: darkmode-audit-procedure
3
+ type: meta-rules
4
+ version: 1.0.0
5
+ phase: 28.5
6
+ tags: [darkmode, dark-mode, contrast, audit, procedure, extracted]
7
+ last_updated: 2026-05-18
8
+ ---
9
+
10
+ Source: extracted from `skills/darkmode/SKILL.md` (Phase 28.5 rework — D-10 extract-then-link).
11
+ The skill's load-bearing routing + decision tree stays in `../skills/darkmode/SKILL.md`; this
12
+ file holds the architecture-detection greps, contrast computation, anti-pattern grep
13
+ snippets, and the `DARKMODE-AUDIT.md` report template.
14
+
15
+ # Dark Mode Audit Procedure
16
+
17
+ Detailed procedure for the `get-design-done:darkmode` standalone audit — companion to
18
+ `../skills/darkmode/SKILL.md`. Read this file when executing a specific audit step
19
+ (architecture detection, contrast computation, anti-pattern grep, report layout). The
20
+ SKILL.md keeps the load-bearing pre-flight + step routing; this file holds the deep
21
+ methodology.
22
+
23
+ For the perceptual layer (APCA / WCAG 3 draft) sitting on top of the WCAG 2.1 ratios used
24
+ in Step 2, see `./contrast-advanced.md`. For modern OKLCH-based dark token-pair generation,
25
+ see `./color-theory.md` §OKLCH. For the cross-skill output discipline + connection-probe
26
+ pattern, see `./shared-preamble.md#output-contract-reminders` and
27
+ `./shared-preamble.md#connection-handshake-summary`.
28
+
29
+ ---
30
+
31
+ ## Step 1: Architecture Detection (DARK-02)
32
+
33
+ Run all three architecture greps against `$SRC_ROOT`. Use `2>/dev/null` on each to suppress missing-directory errors.
34
+
35
+ ```bash
36
+ # Architecture 1: CSS custom properties with dark media query
37
+ arch1_count=$(grep -rEn "prefers-color-scheme.*dark|\.dark[[:space:]]*\{" "$SRC_ROOT" \
38
+ --include="*.css" --include="*.scss" 2>/dev/null | wc -l)
39
+
40
+ # Architecture 2: Tailwind dark: prefix
41
+ arch2_count=$(grep -rEn "dark:[a-z]" "$SRC_ROOT" \
42
+ --include="*.tsx" --include="*.jsx" --include="*.html" 2>/dev/null | wc -l)
43
+
44
+ # Architecture 3: JS class toggle on <html> / <body>
45
+ arch3_count=$(grep -rEn "classList.*dark|setAttribute.*dark|document\.documentElement" "$SRC_ROOT" \
46
+ --include="*.ts" --include="*.tsx" --include="*.js" 2>/dev/null | wc -l)
47
+ ```
48
+
49
+ **Classification rules:**
50
+
51
+ | Condition | Classification |
52
+ |-----------|---------------|
53
+ | All three counts < 3 | No dark mode — abort: "No dark mode implementation detected — nothing to audit." |
54
+ | Exactly one count ≥ 3 | Primary architecture = that one |
55
+ | Two or more counts ≥ 5 | Hybrid (list all detected architectures) |
56
+ | One count ≥ 3, others < 5 | Primary = highest count |
57
+
58
+ Record `ARCH_DETECTED` as one of: `Architecture 1 (CSS custom props)`, `Architecture 2 (Tailwind dark:)`, `Architecture 3 (JS class toggle)`, or `Hybrid`.
59
+
60
+ ---
61
+
62
+ ## Step 2: Contrast Audit (DARK-03)
63
+
64
+ For the detected architecture, enumerate color token + background token pairs used in dark context, then compute WCAG contrast ratios.
65
+
66
+ **Token extraction by architecture:**
67
+
68
+ **Architecture 1 (CSS custom props):**
69
+ ```bash
70
+ grep -rEn "\.dark[[:space:]]*\{|prefers-color-scheme.*dark" "$SRC_ROOT" \
71
+ --include="*.css" --include="*.scss" -A 30 2>/dev/null \
72
+ | grep -E "^\s*--[a-z].*:\s*#[0-9a-fA-F]{3,8}|^\s*--[a-z].*:\s*rgb"
73
+ ```
74
+
75
+ **Architecture 2 (Tailwind dark:):**
76
+ ```bash
77
+ grep -rEhon "dark:(bg|text)-[a-z0-9-]+" "$SRC_ROOT" \
78
+ --include="*.tsx" --include="*.jsx" --include="*.html" 2>/dev/null | sort -u
79
+ ```
80
+
81
+ **Architecture 3 (JS class toggle):**
82
+ ```bash
83
+ grep -rEn "\.dark[[:space:]]*\{" "$SRC_ROOT" \
84
+ --include="*.css" --include="*.scss" -A 30 2>/dev/null \
85
+ | grep -E "color|background"
86
+ ```
87
+
88
+ **WCAG contrast computation:**
89
+
90
+ Use the linearized-sRGB formula from `agents/design-executor.md` Type: accessibility (pre-calibrated — do not re-derive):
91
+
92
+ 1. Convert each hex channel to linear light: `c_lin = (c/255 ≤ 0.04045) ? c/255/12.92 : ((c/255 + 0.055)/1.055)^2.4`
93
+ 2. Relative luminance: `L = 0.2126 * R_lin + 0.7152 * G_lin + 0.0722 * B_lin`
94
+ 3. Contrast ratio: `(L_lighter + 0.05) / (L_darker + 0.05)`
95
+
96
+ **Thresholds:**
97
+
98
+ | Text type | Min ratio | Fail severity |
99
+ |-----------|-----------|---------------|
100
+ | Body text (< 18pt or < 14pt bold) | 4.5:1 | P0 (critical) |
101
+ | Large text (≥ 18pt or ≥ 14pt bold) | 3:1 | P1 (major) |
102
+ | UI component boundaries | 3:1 | P1 (major) |
103
+
104
+ Flag every pair that fails its threshold. Include token names, hex values, computed ratio, and required ratio in the fix description.
105
+
106
+ For pairs that pass WCAG 2.1 but feel wrong perceptually (thin mid-gray text, large saturated text, saturated-on-saturated), cross-check with the APCA Lc thresholds in `./contrast-advanced.md` and annotate `[APCA-mismatch]` in the fix description.
107
+
108
+ ---
109
+
110
+ ## Step 3: Token Override Completeness (DARK-04)
111
+
112
+ Check that every light-mode color token has a corresponding dark-mode override.
113
+
114
+ **Enumerate light-mode tokens:**
115
+ ```bash
116
+ grep -rEhon "var\(--color-[a-z0-9-]+\)" "$SRC_ROOT" \
117
+ --include="*.css" --include="*.scss" --include="*.tsx" --include="*.jsx" 2>/dev/null \
118
+ | grep -oE "\-\-color-[a-z0-9-]+" | sort -u
119
+
120
+ grep -rEhon "(bg|text|border|ring)-[a-z]+-[0-9]+" "$SRC_ROOT" \
121
+ --include="*.tsx" --include="*.jsx" 2>/dev/null | sort -u
122
+ ```
123
+
124
+ **Check dark overrides (architecture-specific):**
125
+ - Arch 1: Token appears in `.dark { --color-* }` block or `@media (prefers-color-scheme: dark) { --color-* }`
126
+ - Arch 2: A `dark:` prefixed variant of the Tailwind class exists in the same file or a shared layout
127
+ - Arch 3: Token appears in the dark CSS block activated by JS class toggle
128
+
129
+ **Flag:** Any light-mode color token with no dark override → P1 (major). For OKLCH-based pair generation guidance, see `./color-theory.md` §OKLCH.
130
+
131
+ ---
132
+
133
+ ## Step 4: Dark-Specific Anti-Patterns (DARK-05)
134
+
135
+ **Anti-pattern A: Images and SVGs without dark variant**
136
+
137
+ ```bash
138
+ grep -rEn "<img[^>]+src=|<svg" "$SRC_ROOT" \
139
+ --include="*.tsx" --include="*.jsx" --include="*.html" --include="*.vue" 2>/dev/null \
140
+ | grep -v "dark\."
141
+ ```
142
+
143
+ For each image/SVG found, check whether any of the following exist:
144
+ - A sibling file with pattern `[name]-dark.{png,svg,webp}`
145
+ - A `dark:hidden` / `dark:block` swap class pairing in the same component
146
+ - A `<picture>` element with a `prefers-color-scheme: dark` source
147
+
148
+ Flag images/SVGs with none of the above → P2 (minor).
149
+
150
+ **Anti-pattern B: Pure-black backgrounds (BAN-05)**
151
+
152
+ ```bash
153
+ grep -rEn "#000000|#000\b|rgb\([[:space:]]*0[[:space:]]*,[[:space:]]*0[[:space:]]*,[[:space:]]*0[[:space:]]*\)|background[^:]*:[[:space:]]*black" \
154
+ "$SRC_ROOT" --include="*.css" --include="*.scss" 2>/dev/null
155
+ ```
156
+
157
+ Any match within a `.dark {}` block or `@media (prefers-color-scheme: dark)` context → P1 (major). Pure black (`#000000`) in dark mode causes visual harshness and fails accessibility in high-contrast conditions. Use near-black (`#0a0a0a` – `#1a1a1a`) instead.
158
+
159
+ **Anti-pattern C: Missing forced-colors media query**
160
+
161
+ ```bash
162
+ forced_count=$(grep -rEn "@media.*forced-colors" "$SRC_ROOT" \
163
+ --include="*.css" --include="*.scss" 2>/dev/null | wc -l)
164
+ ```
165
+
166
+ If `forced_count` equals 0 → P2 (minor). The `forced-colors` media query ensures the design respects Windows High Contrast mode and similar OS accessibility overrides.
167
+
168
+ ---
169
+
170
+ ## Step 5: Meta Property Check (DARK-06)
171
+
172
+ **color-scheme property:**
173
+ ```bash
174
+ cs_count=$(grep -rEn "color-scheme" "$SRC_ROOT" public/ \
175
+ --include="*.html" --include="*.tsx" --include="*.css" 2>/dev/null | wc -l)
176
+ ```
177
+ If `cs_count` equals 0 → P2 (minor).
178
+
179
+ **prefers-color-scheme media query:**
180
+ ```bash
181
+ pcs_count=$(grep -rEn "prefers-color-scheme" "$SRC_ROOT" public/ \
182
+ --include="*.html" --include="*.tsx" --include="*.css" 2>/dev/null | wc -l)
183
+ ```
184
+ If `pcs_count` equals 0 → P2 (minor). Absence means the site ignores the OS-level dark mode preference.
185
+
186
+ ---
187
+
188
+ ## Step 5B: Dark Mode Rendering Screenshots (when preview: available)
189
+
190
+ Check `preview` status from `.design/STATE.md <connections>` (per `./shared-preamble.md#connection-handshake-summary`).
191
+
192
+ **If `preview: available`:**
193
+
194
+ 1. `preview_navigate` to the primary route (e.g., `http://localhost:3000/`).
195
+ 2. Capture light-mode: `preview_screenshot` → `.design/screenshots/darkmode/light.png`.
196
+ 3. Inject dark mode using the project's toggle mechanism (check `DESIGN-CONTEXT.md` D-XX decisions):
197
+ - Tailwind dark: `preview_eval("document.documentElement.classList.add('dark')")`
198
+ - data-theme: `preview_eval("document.documentElement.setAttribute('data-theme','dark')")`
199
+ - Custom class: `preview_eval("document.documentElement.classList.add('theme-dark')")`
200
+ - If mechanism is unknown: attempt Tailwind default first; note in `DARKMODE-AUDIT.md` which method was used.
201
+ 4. `preview_screenshot` → `.design/screenshots/darkmode/dark.png`.
202
+ 5. Record both paths (NOT base64) for embedding in `## Dark Mode Rendering` section.
203
+
204
+ **If `preview: unavailable` or `preview: not_configured`:** omit `## Dark Mode Rendering` section entirely. Emit `Visual dark mode check skipped — preview not configured.` in Notes.
205
+
206
+ ---
207
+
208
+ ## Step 6: DARKMODE-AUDIT.md Template
209
+
210
+ Output path: `.design/DARKMODE-AUDIT.md`.
211
+
212
+ ```markdown
213
+ # Dark Mode Audit
214
+
215
+ **Generated:** <ISO date>
216
+ **Architecture detected:** <Architecture 1 (CSS custom props) | Architecture 2 (Tailwind dark:) | Architecture 3 (JS class toggle) | Hybrid | None>
217
+ **Source scanned:** <SRC_ROOT>
218
+
219
+ ## Summary
220
+
221
+ | Category | Status | Issues |
222
+ |----------|--------|--------|
223
+ | Contrast (DARK-03) | <pass / fail> | <count> |
224
+ | Token Overrides (DARK-04) | <pass / fail> | <count> |
225
+ | Anti-Patterns (DARK-05) | <pass / fail> | <count> |
226
+ | Meta Properties (DARK-06) | <pass / fail> | <count> |
227
+
228
+ ## P0 Fixes (Critical — contrast failure on body text)
229
+ - [CONTRAST] <token-pair>: ratio <X:1> — required 4.5:1. File: <path>
230
+
231
+ ## P1 Fixes (Major — large-text contrast / missing dark overrides / pure-black)
232
+ - [CONTRAST-LARGE] <token-pair>: ratio <X:1> — required 3:1. File: <path>
233
+ - [TOKEN-OVERRIDE] Missing dark override for <--token-name>. Light value: <hex>. File: <path>
234
+ - [BAN-05] Pure-black background detected in dark context. File: <path>:line
235
+
236
+ ## P2 Fixes (Minor — missing SVG variants / forced-colors / meta props)
237
+ - [SVG-DARK] <image.svg> has no dark variant. File: <path>
238
+ - [FORCED-COLORS] No @media (forced-colors) block detected in any CSS file.
239
+ - [COLOR-SCHEME] No color-scheme property or meta tag detected.
240
+ - [PREFERS-COLOR-SCHEME] No prefers-color-scheme query detected.
241
+
242
+ ## P3 Fixes (Cosmetic)
243
+ - <cosmetic issues, if any>
244
+
245
+ ## Dark Mode Rendering
246
+ <Either side-by-side screenshot references, or "Visual dark mode check skipped — preview not configured.">
247
+
248
+ ## Notes
249
+ This audit is read-only. It does NOT write scores back to DESIGN.md.
250
+ To apply fixes, run the design pipeline and include dark mode decisions in DESIGN-CONTEXT.md.
251
+ Score writeback (V2-05) is deferred.
252
+ ```
253
+
254
+ If a priority bucket has no issues, omit that section or write "None."
255
+
256
+ ---
257
+
258
+ *Imported by: `../skills/darkmode/SKILL.md`. Maintained as part of Phase 28.5 (Bucket 2 rework — D-10).*
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: debug-feedback-loops
3
+ type: heuristic
4
+ version: 1.0.0
5
+ phase: 28.5
6
+ tags: [debug, feedback-loop, deterministic-signal, iterate-on-loop, mit-port, mattpocock]
7
+ last_updated: 2026-05-18
8
+ ---
9
+
10
+ Source: mattpocock/skills (MIT) — engineering/diagnose Phase 1 — adapted with permission. See `../NOTICE` for the full attribution block.
11
+
12
+ # Debug Feedback Loops
13
+
14
+ Build a feedback loop before any hypothesizing. A feedback loop is a deterministic, fast, agent-runnable pass/fail signal that tells you whether the bug is reproduced right now, every time, in well under a minute. Without it, debugging degenerates to speculation.
15
+
16
+ **Do not proceed to Phase 2 (hypothesis generation) until you have a loop you believe in.**
17
+
18
+ ## The 10 construction paths
19
+
20
+ Listed in priority order — try the cheaper, faster paths first. Each entry: when to reach for it, the shape of the loop, and the verification snippet.
21
+
22
+ ### 1. Failing test
23
+
24
+ The strongest signal. Write the failing test in the project's native test framework (pytest, jest, vitest, go test, cargo test, junit, rspec). Assert the buggy behavior; run with watch mode if available. When the test goes green, the bug is fixed. Best case: reproduces in under 2 seconds, runnable by a fresh agent with one command.
25
+
26
+ When to reach: the project already has a test runner the agent can invoke; the bug is in a unit/integration-testable code path; the symptom is expressible as a deterministic assertion.
27
+
28
+ ### 2. `curl` against a running endpoint
29
+
30
+ For HTTP endpoints, a `curl` against the staging or local server with assertion on body/status. Pipe to `jq` for structured assertions. Cheap, reliable, framework-free. Wrap in a 3-line bash script so the loop is one command.
31
+
32
+ When to reach: the bug is in an HTTP endpoint; the server is already runnable locally; the symptom shows up in response body/status/headers.
33
+
34
+ ### 3. CLI fixture
35
+
36
+ For CLI tools, a small shell script that invokes the binary with fixture inputs and `grep`s for the symptom in stdout/stderr. Bash one-liner is enough; no test framework. Capture exit code, stdout, and stderr separately.
37
+
38
+ When to reach: the bug is in a CLI tool; the symptom shows up in stdout/stderr/exit-code; the failure mode is reproducible from a fixed input.
39
+
40
+ ### 4. Headless browser
41
+
42
+ For UI bugs, a Playwright or Puppeteer script that opens the page, performs the trigger action, and screenshots the symptom region. Compare against a known-good fixture or assert on a DOM selector's text/attribute. Use a deterministic seed for any randomness (animations, IDs, dates).
43
+
44
+ When to reach: the bug is visible only in a rendered browser context; DOM-level inspection isn't enough; the symptom involves layout, paint, or interaction timing.
45
+
46
+ ### 5. Trace replay
47
+
48
+ For bugs reproducible from a captured execution trace, replay the trace deterministically. `rr` on Linux for native binaries, record-and-replay plugins for some browsers, Chrome DevTools recording for web, or a captured production trace for distributed systems. Replays are bit-for-bit reproducible — the gold standard for non-deterministic bugs that have been captured once.
49
+
50
+ When to reach: the bug is hard to reproduce live but you have a captured trace; the trace runtime is available; bit-identical replay is achievable.
51
+
52
+ ### 6. Throwaway harness
53
+
54
+ Write a minimal `main()` that calls the buggy function with known inputs and prints the output. ~10 lines. Side-step framework startup costs entirely. Throw away when fixed. Useful when the test framework's setup is too heavy to iterate quickly.
55
+
56
+ When to reach: the bug is in a single function with a clear input/output contract; framework setup dominates iteration time; you'd rather iterate on a 10-line script than wait for the framework to boot.
57
+
58
+ ### 7. Fuzz
59
+
60
+ When the bug surfaces unpredictably, use property-based testing (Hypothesis, fast-check, jqwik) or AFL/libfuzzer for native code. The fuzzer narrows on the failing input across runs. Combine with a "minimize" pass to shrink the failing input to its smallest form.
61
+
62
+ When to reach: the input space is exotic (parsers, serializers, network protocols); the bug isn't tied to a specific input you can name; you suspect a class of inputs but can't enumerate it.
63
+
64
+ ### 8. Bisect
65
+
66
+ When you know "it worked on commit X, fails on commit Y," `git bisect` is the loop. Each iteration runs the test/curl/CLI from a higher path. Reproduces in O(log N) commits. Combine with `git bisect run <script>` to fully automate.
67
+
68
+ When to reach: the bug regressed between two known commits; you have a binary pass/fail script from one of the earlier paths; you don't yet know which commit introduced the regression.
69
+
70
+ ### 9. Differential
71
+
72
+ When you have two systems and one's correct, write a differential harness: feed the same input to both, assert outputs match. Cheap for migration bugs (old → new implementation) and protocol bugs (your client vs reference client). The harness becomes the regression test once the bug is fixed.
73
+
74
+ When to reach: a known-good reference implementation exists; the buggy code is supposed to match the reference; input space is enumerable enough to drive both implementations side by side.
75
+
76
+ ### 10. HITL bash (Human In The Loop)
77
+
78
+ Last resort. A documented sequence of bash commands a human runs that produces a pass/fail signal. Slower (human in the path), but better than no loop. The agent reads stdout/stderr; the human reads the screen and reports. Use only when no automatable signal is available — physical hardware, vendor portals, manual eyeball checks.
79
+
80
+ When to reach: every other path is blocked by an unautomatable surface; the human cost is acceptable for the duration of the investigation; the loop will be retired or upgraded the moment any earlier path becomes possible.
81
+
82
+ ## Iterate on the loop itself
83
+
84
+ The loop is a first-class artifact. Iterate on it before iterating on hypotheses. A 5-minute loop run 20 times costs 100 minutes; a 5-second loop run 20 times costs 100 seconds. Spending 30 minutes tightening the loop pays back inside the same session.
85
+
86
+ - **Cache setup**: hoist expensive setup (DB seed, fixture load, container start) out of the loop body. Run the loop only on the fast inner part. Use `--no-rebuild`, persistent containers, or test-runner watch modes.
87
+ - **Narrow scope**: if the loop runs the full test suite to verify one bug, narrow to just the failing test/group. Fewer side-effects, faster iterations. `pytest -k`, `jest -t`, `vitest --testNamePattern`, `go test -run` are your friends.
88
+ - **Pin time**: when the bug is time-dependent, freeze the clock (`sinon.useFakeTimers`, `jest.useFakeTimers`, `freezegun`, `time-machine`). Removes wallclock as a variable.
89
+ - **Seed RNG**: every random source gets a fixed seed in the loop. `Math.random`, `crypto.randomBytes`, `random.seed(...)`, `rand::SeedableRng`. Determinism over coverage — the loop must be bit-identical given the same code state.
90
+ - **Isolate filesystem**: run in a `tmpdir`; reset between iterations. Avoids "fixed on my machine" via stale state. Bind-mount or copy fixtures into the tmpdir per iteration.
91
+ - **Freeze network**: mock or record/replay all outbound calls (`nock`, `vcr`, `polly.js`, `mitmproxy --replay`). Real-network loops are non-deterministic by definition.
92
+
93
+ The discipline: every iteration of the loop should be bit-identical given the same code state. If two iterations differ without a code change, the loop has a hidden input — find it and pin it before continuing.
94
+
95
+ ## Non-deterministic bugs
96
+
97
+ Some bugs surface only sometimes. The goal is NOT a clean repro — the goal is to raise the reproduction rate to debuggable.
98
+
99
+ - **Measure baseline rate**: run the loop N=20 times. Note pass/fail count. Record the rate so you can tell whether later changes helped.
100
+ - **Raise stressors**: add concurrency, contention, memory pressure, network jitter (use `tc qdisc add dev lo root netem delay 100ms 50ms` on Linux, `Network Link Conditioner` on macOS). Re-measure.
101
+ - **Target the suspect axis**: if you suspect a race, add a deterministic sleep at the suspect point and measure. If reproduction jumps to 100% with sleep, the race is in that region. If it stays at baseline, the race is elsewhere.
102
+ - **A 30% reproduction rate is debuggable.** A 5% rate isn't — keep raising stressors until you cross 30%. At 30% you can iterate; at 5% you're guessing whether your fix helped or you got lucky.
103
+
104
+ ## When the loop is good enough
105
+
106
+ The loop is good enough when:
107
+
108
+ - It runs in under a minute (preferably under 10 seconds).
109
+ - It's deterministic (or, for non-determinism, reproduces at least 30% of the time).
110
+ - It's automatable — no human in the inner loop except by explicit choice (Path 10).
111
+ - A fresh agent could pick up the loop and run it without context.
112
+
113
+ Only after the loop is good enough should you proceed to hypothesizing the fix. The hypothesis cycle is governed by `./debugger-philosophy.md` (one variable at a time, do not stop at first plausible cause, the bug is where you didn't look).
114
+
115
+ ## Cross-references
116
+
117
+ - `./debugger-philosophy.md` — companion framing; the hypothesis-cycle discipline that runs in Phase 2 once the loop is in place.
118
+ - `../skills/debug/SKILL.md` — Phase 1 of the debug skill mandates this catalog before any hypothesis generation.
119
+ - `../NOTICE` — full mattpocock/skills MIT attribution.
@@ -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.