@hegemonart/get-design-done 1.0.7

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 (144) hide show
  1. package/.claude-plugin/marketplace.json +63 -0
  2. package/.claude-plugin/plugin.json +54 -0
  3. package/CHANGELOG.md +221 -0
  4. package/LICENSE +21 -0
  5. package/README.md +724 -0
  6. package/SKILL.md +232 -0
  7. package/agents/README.md +226 -0
  8. package/agents/a11y-mapper.md +118 -0
  9. package/agents/component-taxonomy-mapper.md +88 -0
  10. package/agents/design-advisor.md +139 -0
  11. package/agents/design-assumptions-analyzer.md +171 -0
  12. package/agents/design-auditor.md +383 -0
  13. package/agents/design-context-builder.md +544 -0
  14. package/agents/design-context-checker-gate.md +90 -0
  15. package/agents/design-context-checker.md +260 -0
  16. package/agents/design-discussant.md +98 -0
  17. package/agents/design-doc-writer.md +229 -0
  18. package/agents/design-executor.md +452 -0
  19. package/agents/design-figma-writer.md +302 -0
  20. package/agents/design-fixer.md +180 -0
  21. package/agents/design-integration-checker-gate.md +93 -0
  22. package/agents/design-integration-checker.md +326 -0
  23. package/agents/design-pattern-mapper.md +206 -0
  24. package/agents/design-phase-researcher.md +229 -0
  25. package/agents/design-plan-checker.md +164 -0
  26. package/agents/design-planner.md +352 -0
  27. package/agents/design-reflector.md +175 -0
  28. package/agents/design-research-synthesizer.md +127 -0
  29. package/agents/design-verifier-gate.md +97 -0
  30. package/agents/design-verifier.md +605 -0
  31. package/agents/gdd-graphify-sync.md +100 -0
  32. package/agents/gdd-intel-updater.md +88 -0
  33. package/agents/gdd-learnings-extractor.md +85 -0
  34. package/agents/motion-mapper.md +103 -0
  35. package/agents/token-mapper.md +103 -0
  36. package/agents/visual-hierarchy-mapper.md +95 -0
  37. package/connections/chromatic.md +247 -0
  38. package/connections/claude-design.md +190 -0
  39. package/connections/connections.md +218 -0
  40. package/connections/figma-writer.md +139 -0
  41. package/connections/figma.md +146 -0
  42. package/connections/graphify.md +197 -0
  43. package/connections/pinterest.md +153 -0
  44. package/connections/preview.md +173 -0
  45. package/connections/refero.md +189 -0
  46. package/connections/storybook.md +280 -0
  47. package/hooks/budget-enforcer.js +318 -0
  48. package/hooks/context-exhaustion.js +127 -0
  49. package/hooks/gdd-read-injection-scanner.js +44 -0
  50. package/hooks/hooks.json +44 -0
  51. package/package.json +60 -0
  52. package/reference/BRANCH-PROTECTION.md +65 -0
  53. package/reference/DEPRECATIONS.md +41 -0
  54. package/reference/STATE-TEMPLATE.md +200 -0
  55. package/reference/accessibility.md +190 -0
  56. package/reference/anti-patterns.md +336 -0
  57. package/reference/audit-scoring.md +205 -0
  58. package/reference/checklists.md +137 -0
  59. package/reference/config-schema.md +319 -0
  60. package/reference/debugger-philosophy.md +32 -0
  61. package/reference/heuristics.md +201 -0
  62. package/reference/intel-schema.md +266 -0
  63. package/reference/model-prices.md +37 -0
  64. package/reference/model-tiers.md +118 -0
  65. package/reference/motion.md +285 -0
  66. package/reference/parallelism-rules.md +108 -0
  67. package/reference/priority-matrix.md +31 -0
  68. package/reference/project-skills-guide.md +42 -0
  69. package/reference/review-format.md +107 -0
  70. package/reference/schemas/config.schema.json +41 -0
  71. package/reference/schemas/hooks.schema.json +55 -0
  72. package/reference/schemas/intel.schema.json +191 -0
  73. package/reference/schemas/marketplace.schema.json +72 -0
  74. package/reference/schemas/plugin.schema.json +59 -0
  75. package/reference/shared-preamble.md +82 -0
  76. package/reference/typography.md +229 -0
  77. package/scripts/aggregate-agent-metrics.js +144 -0
  78. package/scripts/apply-branch-protection.sh +75 -0
  79. package/scripts/bootstrap-manifest.txt +3 -0
  80. package/scripts/bootstrap.sh +80 -0
  81. package/scripts/build-intel.cjs +458 -0
  82. package/scripts/detect-stale-refs.cjs +101 -0
  83. package/scripts/extract-changelog-section.cjs +57 -0
  84. package/scripts/release-smoke-test.cjs +169 -0
  85. package/scripts/rollback-release.sh +42 -0
  86. package/scripts/run-injection-scanner-ci.cjs +92 -0
  87. package/scripts/validate-frontmatter.cjs +68 -0
  88. package/scripts/validate-schemas.cjs +225 -0
  89. package/scripts/verify-version-sync.cjs +30 -0
  90. package/skills/add-backlog/SKILL.md +47 -0
  91. package/skills/analyze-dependencies/SKILL.md +184 -0
  92. package/skills/apply-reflections/SKILL.md +112 -0
  93. package/skills/audit/SKILL.md +54 -0
  94. package/skills/brief/SKILL.md +75 -0
  95. package/skills/cache-manager/SKILL.md +120 -0
  96. package/skills/compare/SKILL.md +322 -0
  97. package/skills/complete-cycle/SKILL.md +33 -0
  98. package/skills/darkmode/SKILL.md +331 -0
  99. package/skills/debug/SKILL.md +38 -0
  100. package/skills/design/SKILL.md +281 -0
  101. package/skills/discover/SKILL.md +172 -0
  102. package/skills/discuss/SKILL.md +67 -0
  103. package/skills/do/SKILL.md +45 -0
  104. package/skills/explore/SKILL.md +109 -0
  105. package/skills/extract-learnings/SKILL.md +98 -0
  106. package/skills/fast/SKILL.md +44 -0
  107. package/skills/figma-write/SKILL.md +40 -0
  108. package/skills/graphify/SKILL.md +48 -0
  109. package/skills/health/SKILL.md +48 -0
  110. package/skills/help/SKILL.md +76 -0
  111. package/skills/list-assumptions/SKILL.md +60 -0
  112. package/skills/map/SKILL.md +112 -0
  113. package/skills/new-cycle/SKILL.md +35 -0
  114. package/skills/new-project/SKILL.md +53 -0
  115. package/skills/next/SKILL.md +42 -0
  116. package/skills/note/SKILL.md +47 -0
  117. package/skills/optimize/SKILL.md +120 -0
  118. package/skills/pause/SKILL.md +41 -0
  119. package/skills/plan/SKILL.md +251 -0
  120. package/skills/plant-seed/SKILL.md +47 -0
  121. package/skills/pr-branch/SKILL.md +31 -0
  122. package/skills/progress/SKILL.md +60 -0
  123. package/skills/quick/SKILL.md +43 -0
  124. package/skills/reapply-patches/SKILL.md +31 -0
  125. package/skills/reflect/SKILL.md +73 -0
  126. package/skills/resume/SKILL.md +37 -0
  127. package/skills/review-backlog/SKILL.md +45 -0
  128. package/skills/router/SKILL.md +67 -0
  129. package/skills/scan/SKILL.md +721 -0
  130. package/skills/settings/SKILL.md +78 -0
  131. package/skills/ship/SKILL.md +31 -0
  132. package/skills/sketch/SKILL.md +78 -0
  133. package/skills/sketch-wrap-up/SKILL.md +88 -0
  134. package/skills/skill-manifest/SKILL.md +79 -0
  135. package/skills/spike/SKILL.md +67 -0
  136. package/skills/spike-wrap-up/SKILL.md +81 -0
  137. package/skills/stats/SKILL.md +50 -0
  138. package/skills/style/SKILL.md +193 -0
  139. package/skills/synthesize/SKILL.md +93 -0
  140. package/skills/todo/SKILL.md +54 -0
  141. package/skills/undo/SKILL.md +30 -0
  142. package/skills/update/SKILL.md +36 -0
  143. package/skills/verify/SKILL.md +452 -0
  144. package/skills/warm-cache/SKILL.md +113 -0
@@ -0,0 +1,322 @@
1
+ ---
2
+ name: get-design-done:compare
3
+ description: "Compute delta between DESIGN.md baseline (from scan) and DESIGN-VERIFICATION.md result (from verify). Reports per-category score delta, anti-pattern delta (resolved vs new), must-have pass/fail change, and design drift (regressions without covering tasks in DESIGN-PLAN.md). Writes .design/COMPARE-REPORT.md."
4
+ argument-hint: ""
5
+ user-invocable: true
6
+ ---
7
+
8
+ # get-design-done:compare — Baseline vs Result Delta
9
+
10
+ Standalone delta command. Computes the difference between the scan baseline (`DESIGN.md`) and the verification result (`DESIGN-VERIFICATION.md`), and flags design drift for any regression not covered by an explicit task in `DESIGN-PLAN.md`. Writes one artifact: `.design/COMPARE-REPORT.md`.
11
+
12
+ ---
13
+
14
+ ## Scope
15
+
16
+ This command is **standalone** — not a pipeline stage:
17
+
18
+ - Scoped strictly to delta between two existing files (COMP-02): `DESIGN.md` (baseline, from scan) and `DESIGN-VERIFICATION.md` (result, from verify).
19
+ - Does NOT require or implement a snapshot mechanism — multi-run history is deferred to V2-06.
20
+ - Does NOT mutate any pipeline artifact (`DESIGN.md`, `DESIGN-VERIFICATION.md`, `DESIGN-SUMMARY.md`, `DESIGN-CONTEXT.md`, `DESIGN-PLAN.md`, `.design/STATE.md`).
21
+ - Writes exactly ONE file: `.design/COMPARE-REPORT.md`.
22
+ - Output artifact prefix is `COMPARE-REPORT` — distinct from the pipeline namespace (`DESIGN-*.md`). No naming conflict.
23
+
24
+ ---
25
+
26
+ ## Pre-Flight Checks (Pitfall 3)
27
+
28
+ Required files — abort if either is missing:
29
+
30
+ ```
31
+ .design/DESIGN.md — baseline from scan
32
+ .design/DESIGN-VERIFICATION.md — result from verify
33
+ ```
34
+
35
+ **Abort conditions:**
36
+
37
+ - If `.design/DESIGN.md` is missing:
38
+ > "No baseline found. Run /get-design-done scan first."
39
+
40
+ - If `.design/DESIGN-VERIFICATION.md` is missing:
41
+ > "No verification result found. Run /get-design-done verify first to produce DESIGN-VERIFICATION.md."
42
+
43
+ **Optional files** (graceful degradation if absent):
44
+
45
+ - `.design/DESIGN-CONTEXT.md` — used for must-have delta (COMP-03). If missing, skip the Must-Have Status section and emit note: "Must-have delta skipped: DESIGN-CONTEXT.md not found."
46
+ - `.design/DESIGN-PLAN.md` — used for drift detection (COMP-04). If missing, skip DRIFT flagging and emit note: "Drift detection skipped: no DESIGN-PLAN.md."
47
+
48
+ Confirm `.design/` directory exists. If absent, create it: `mkdir -p .design/`
49
+
50
+ ### Probe Preview connection
51
+
52
+ Run at stage entry, after pre-flight checks:
53
+
54
+ ```
55
+ Step P1 — ToolSearch check:
56
+ ToolSearch({ query: "Claude_Preview", max_results: 5 })
57
+ → Empty result → preview: not_configured (skip Screenshot Delta section)
58
+ → Non-empty result → proceed to Step P2
59
+
60
+ Step P2 — Live tool call:
61
+ call mcp__Claude_Preview__preview_list
62
+ → Success → preview: available
63
+ → Error → preview: unavailable
64
+
65
+ Write preview status to .design/STATE.md <connections>.
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Step 1: Parse Category Scores
71
+
72
+ **Extract baseline scores from `.design/DESIGN.md`:**
73
+
74
+ Locate the category score table. Expected format:
75
+
76
+ ```
77
+ | Category | Score | Notes |
78
+ |----------|-------|-------|
79
+ | Accessibility | 6/10 | ... |
80
+ ```
81
+
82
+ Parse each row: extract category name and numeric score (e.g., `6` from `6/10`).
83
+
84
+ Store as `baseline_scores` map: `{ "Accessibility": 6, "Visual Hierarchy": 5, ... }`
85
+
86
+ **Extract result scores from `.design/DESIGN-VERIFICATION.md`:**
87
+
88
+ Locate the category score table in the Phase 1 output section. Same format as above.
89
+
90
+ Store as `result_scores` map: `{ "Accessibility": 8, "Visual Hierarchy": 6, ... }`
91
+
92
+ **Normalize category names:**
93
+ - Strip leading/trailing whitespace
94
+ - Apply title-case normalization (e.g., `anti-patterns` → `Anti-Patterns`)
95
+ - Match categories case-insensitively between the two tables
96
+
97
+ **Unmatched categories:**
98
+ - If a category appears in `DESIGN.md` but not `DESIGN-VERIFICATION.md` → flag as `[UNMATCHED-BASELINE]` and exclude from score delta
99
+ - If a category appears in `DESIGN-VERIFICATION.md` but not `DESIGN.md` → flag as `[UNMATCHED-RESULT]` and exclude from score delta
100
+ - Report all unmatched categories in the Notes section of `COMPARE-REPORT.md`
101
+ - Do NOT silently paper over category name mismatches
102
+
103
+ ---
104
+
105
+ ## Step 2: Compute Score Delta (COMP-03)
106
+
107
+ For each matched category:
108
+
109
+ ```
110
+ delta = result_scores[category] - baseline_scores[category]
111
+ ```
112
+
113
+ Classify each delta:
114
+ - `improvement` — delta > 0
115
+ - `no_change` — delta == 0
116
+ - `regression` — delta < 0
117
+
118
+ Record per category:
119
+ - `category` — name
120
+ - `baseline` — numeric score from DESIGN.md
121
+ - `result` — numeric score from DESIGN-VERIFICATION.md
122
+ - `delta` — signed integer
123
+ - `classification` — improvement / no_change / regression
124
+
125
+ Collect all regressed categories for drift detection in Step 5.
126
+
127
+ ---
128
+
129
+ ## Step 3: Anti-Pattern Delta (COMP-03)
130
+
131
+ **Enumerate anti-patterns in DESIGN.md (baseline):**
132
+
133
+ Scan for entries identified by BAN-*, SLOP-*, or labeled as anti-patterns in DESIGN.md. Collect identifiers or descriptions as `baseline_anti_patterns` set.
134
+
135
+ **Enumerate anti-patterns in DESIGN-VERIFICATION.md (result):**
136
+
137
+ Same scan against DESIGN-VERIFICATION.md. Collect as `result_anti_patterns` set.
138
+
139
+ **Compute delta:**
140
+
141
+ ```
142
+ resolved = baseline_anti_patterns - result_anti_patterns
143
+ (present in baseline, absent in result — fixed)
144
+
145
+ new = result_anti_patterns - baseline_anti_patterns
146
+ (absent in baseline, present in result — introduced)
147
+
148
+ unchanged = intersection of both sets
149
+ (still present in both)
150
+ ```
151
+
152
+ Report all three groups.
153
+
154
+ ---
155
+
156
+ ## Step 4: Must-Have Pass/Fail Change (COMP-03)
157
+
158
+ **Skip condition:** If `.design/DESIGN-CONTEXT.md` is absent → emit note and skip this section.
159
+
160
+ **Extract must-haves:**
161
+ - Read `.design/DESIGN-CONTEXT.md` `<must_haves>` section
162
+ - Enumerate each declared must-have (ID + description)
163
+
164
+ **Read pass/fail status from DESIGN-VERIFICATION.md:**
165
+ - Locate the must-have status table in the verification output
166
+ - For each must-have: record status as `pass`, `fail`, or `not-evaluated`
167
+
168
+ **Report:**
169
+ - Each must-have's current status (pass | fail | not-evaluated)
170
+ - If DESIGN.md contained a must-have status section from a prior verify, compute change (pass→fail, fail→pass); otherwise report current status only
171
+
172
+ ---
173
+
174
+ ## Step 5: Design Drift Detection (COMP-04)
175
+
176
+ **Skip condition:** If `.design/DESIGN-PLAN.md` is absent → emit note: "Drift detection skipped: DESIGN-PLAN.md not found."
177
+
178
+ **Coverage map:**
179
+
180
+ Read `.design/DESIGN-PLAN.md` and extract the `Type:` field from each task entry. Build a coverage map of which design categories have at least one task of matching type:
181
+
182
+ ```
183
+ Example: Type: accessibility → covers "Accessibility" category
184
+ Type: color → covers "Color" category
185
+ Type: typography → covers "Typography" category
186
+ ```
187
+
188
+ Category-to-Type matching is case-insensitive and normalized (e.g., `visual-hierarchy` matches `Visual Hierarchy`).
189
+
190
+ **Drift check:**
191
+
192
+ For each category classified as `regression` in Step 2:
193
+
194
+ ```
195
+ If category NOT in coverage_map:
196
+ → flag: DRIFT: [category] regressed from <baseline> to <result> without a design task of Type:<category>
197
+ ```
198
+
199
+ If all regressed categories are covered by tasks → emit: "No drift detected. All regressed categories are covered by tasks in DESIGN-PLAN.md."
200
+
201
+ If no regressions in Step 2 → emit: "No drift detected. No score regressions found."
202
+
203
+ ---
204
+
205
+ ## Step 5B: Screenshot Delta (when preview: available)
206
+
207
+ Check `preview` status from STATE.md `<connections>` (written by the probe at stage entry).
208
+
209
+ **If `preview: available`:**
210
+
211
+ 1. Call `preview_start` if no session is already running.
212
+ 2. For each route inferred from DESIGN-PLAN.md tasks or `src/app/` / `src/pages/` file structure:
213
+ a. `preview_navigate` to route URL (e.g., `http://localhost:3000/<route>`)
214
+ b. `preview_screenshot` → save to `.design/screenshots/before/<route>.png` (pre-design baseline — only if a prior run's screenshot exists at this path) and `.design/screenshots/after/<route>.png` (current render)
215
+ c. Record the reference path (NOT base64) for embedding in `## Screenshot Delta` section of COMPARE-REPORT.md
216
+ 3. Call `preview_stop` when all routes are captured.
217
+
218
+ **If `preview: unavailable` or `preview: not_configured`:**
219
+
220
+ Emit exactly: `Screenshot delta skipped — preview not configured.` in the `## Screenshot Delta` section of COMPARE-REPORT.md.
221
+
222
+ ---
223
+
224
+ ## Step 6: Write COMPARE-REPORT.md (COMP-05)
225
+
226
+ Output path: `.design/COMPARE-REPORT.md`
227
+
228
+ This file MUST NOT be written to any of the pipeline-reserved paths (`DESIGN.md`, `DESIGN-VERIFICATION.md`, `DESIGN-SUMMARY.md`, `DESIGN-CONTEXT.md`, `DESIGN-PLAN.md`).
229
+
230
+ **Report structure:**
231
+
232
+ ```markdown
233
+ # Compare Report: Baseline vs Result
234
+
235
+ **Generated:** <ISO 8601 date>
236
+ **Baseline:** .design/DESIGN.md
237
+ **Result:** .design/DESIGN-VERIFICATION.md
238
+
239
+ ## Score Delta by Category
240
+
241
+ | Category | Baseline | Result | Delta | Status |
242
+ |----------|----------|--------|-------|--------|
243
+ | Accessibility | 6 | 8 | +2 | improvement |
244
+ | Visual Hierarchy | 5 | 5 | 0 | no_change |
245
+ | Anti-Patterns | 4 | 3 | -1 | regression |
246
+ | ... | ... | ... | ... | ... |
247
+
248
+ ## Anti-Pattern Delta
249
+
250
+ **Resolved** (present in baseline, absent in result):
251
+ - <anti-pattern id or description>
252
+
253
+ **New** (absent in baseline, present in result):
254
+ - <anti-pattern id or description>
255
+
256
+ **Unchanged:**
257
+ - <anti-pattern id or description>
258
+
259
+ ## Must-Have Status
260
+
261
+ | Must-Have | Status |
262
+ |-----------|--------|
263
+ | <id / description> | pass |
264
+ | <id / description> | fail |
265
+ | <id / description> | not-evaluated |
266
+
267
+ ## Design Drift
268
+
269
+ <One of the following:>
270
+ - "No drift detected. No score regressions found."
271
+ - "No drift detected. All regressed categories are covered by tasks in DESIGN-PLAN.md."
272
+ - "DRIFT: [Category] regressed from <baseline> to <result> without a design task of Type:<category>"
273
+ - "Drift detection skipped: DESIGN-PLAN.md not found."
274
+
275
+ ## Screenshot Delta
276
+
277
+ <One of the following:>
278
+ - Per-route screenshot pairs (when preview: available): reference paths to .design/screenshots/before/<route>.png and .design/screenshots/after/<route>.png
279
+ - "Screenshot delta skipped — preview not configured."
280
+
281
+ ## Notes
282
+
283
+ Scope: delta between two existing artifacts (.design/DESIGN.md → .design/DESIGN-VERIFICATION.md).
284
+ No snapshot mechanism — multi-snapshot compare deferred to V2-06.
285
+ This report does not modify DESIGN.md, DESIGN-VERIFICATION.md, or any other pipeline artifact.
286
+ <List any UNMATCHED-BASELINE or UNMATCHED-RESULT categories here, if any.>
287
+ <If must-have section was skipped: "Must-have delta skipped: DESIGN-CONTEXT.md not found.">
288
+ <If drift detection was skipped: "Drift detection skipped: DESIGN-PLAN.md not found.">
289
+ ```
290
+
291
+ If a section has no items (e.g., no anti-patterns in baseline), write "None."
292
+
293
+ ---
294
+
295
+ ## Constraints
296
+
297
+ This command MUST NOT:
298
+
299
+ - MUST NOT write to `DESIGN.md`, `DESIGN-VERIFICATION.md`, `DESIGN-SUMMARY.md`, `DESIGN-CONTEXT.md`, `DESIGN-PLAN.md`, or `.design/STATE.md`
300
+ - MUST NOT require or implement a snapshot system (V2-06 deferred)
301
+ - MUST abort with a clear actionable error message if `DESIGN-VERIFICATION.md` is missing (Pitfall 3)
302
+ - MUST abort with a clear actionable error message if `DESIGN.md` (baseline) is missing
303
+ - MUST produce exactly one output file: `.design/COMPARE-REPORT.md`
304
+ - MUST NOT reinterpret or silently normalize category names that do not match between files — report mismatches explicitly in the Notes section
305
+ - MUST NOT invoke design-auditor or any other pipeline agent
306
+
307
+ ---
308
+
309
+ ## Completion
310
+
311
+ After writing `.design/COMPARE-REPORT.md`, print a summary:
312
+
313
+ ```
314
+ Compare complete. Improvements: N. Regressions: M. Drift flags: K. See .design/COMPARE-REPORT.md.
315
+ ```
316
+
317
+ Where:
318
+ - `N` = count of categories classified as `improvement`
319
+ - `M` = count of categories classified as `regression`
320
+ - `K` = count of DRIFT flags emitted (0 if drift detection was skipped or no regressions)
321
+
322
+ Do not summarize individual issues in the completion message — the file contains the full detail.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: gdd-complete-cycle
3
+ description: "Archive current cycle artifacts and prepare for the next cycle. Updates CYCLES.md, moves artifacts to .design/archive/cycle-N/."
4
+ argument-hint: "[<retrospective note>]"
5
+ tools: Read, Write, Bash, AskUserQuestion
6
+ ---
7
+
8
+ # /gdd:complete-cycle
9
+
10
+ Closes the current cycle: marks CYCLES.md entry complete, archives pipeline artifacts, and clears STATE.md for the next cycle.
11
+
12
+ ## Steps
13
+
14
+ 1. **Load state**: Read `.design/STATE.md` for the active `cycle:` ID. If empty/missing, error: "No active cycle — nothing to complete."
15
+ 2. **Retrospective**: If no argument was passed, ask (AskUserQuestion): "Is cycle <N> complete? Briefly describe what was achieved." Capture for CYCLES.md.
16
+ 3. **Update CYCLES.md**: Find the current cycle entry, change `**Status**: active` to `**Status**: complete`, append a `**Retrospective**: <note>` line and `**Ended**: <date>`.
17
+ 4. **Archive artifacts**: Create `.design/archive/cycle-N/` via Bash `mkdir -p`. Copy these files into it (if present):
18
+ - `DESIGN.md`
19
+ - `DESIGN-PLAN.md`
20
+ - `DESIGN-CONTEXT.md`
21
+ - `DESIGN-VERIFICATION.md`
22
+ - `DESIGN-AUDIT.md`
23
+ - `DESIGN-SUMMARY.md`
24
+ Mark originals with a `<!-- archived to .design/archive/cycle-N/ -->` note at top (do not delete — next cycle will overwrite).
25
+ 5. **Clear STATE.md**: Set `cycle:` to empty string, reset `<decisions>` to a fresh empty section, reset `stage:` to `brief`.
26
+ 6. Print: "Cycle <N> archived. Run `/gdd:new-cycle` to start the next cycle."
27
+
28
+ ## Do Not
29
+
30
+ - Do not delete source files in `src/` — only archive `.design/` artifacts.
31
+ - Do not auto-start a new cycle — user invokes `/gdd:new-cycle` explicitly.
32
+
33
+ ## COMPLETE-CYCLE COMPLETE
@@ -0,0 +1,331 @@
1
+ ---
2
+ name: get-design-done:darkmode
3
+ description: "Audit dark mode implementation. Detects architecture (CSS custom props, Tailwind dark:, JS class toggle), checks contrast, semantic token overrides, dark-specific anti-patterns, and color-scheme meta property. Writes .design/DARKMODE-AUDIT.md (read-only — no score writeback to DESIGN.md)."
4
+ argument-hint: ""
5
+ user-invocable: true
6
+ ---
7
+
8
+ # get-design-done:darkmode — Dark Mode Audit
9
+
10
+ Standalone dark mode audit command. It detects the project's dark mode architecture, runs architecture-specific checks across contrast, token completeness, anti-patterns, and meta properties, then writes a prioritized fix list to `.design/DARKMODE-AUDIT.md`.
11
+
12
+ ---
13
+
14
+ ## Scope
15
+
16
+ This command is a **standalone audit** — not a pipeline stage:
17
+
18
+ - It does NOT update DESIGN.md scores (V2-05 deferred — two-sources-of-truth risk).
19
+ - It does NOT invoke design-auditor (Pitfall 4 — darkmode runs its own inline audit, separate from the DESIGN-AUDIT.md pipeline).
20
+ - It does NOT write to `.design/STATE.md`, `DESIGN-CONTEXT.md`, `DESIGN-PLAN.md`, `DESIGN-SUMMARY.md`, or `DESIGN-VERIFICATION.md`.
21
+ - It writes exactly ONE artifact: `.design/DARKMODE-AUDIT.md`.
22
+ - It does NOT execute fixes — audit-only per V2-07 deferral (fixes belong in the design skill's color task).
23
+
24
+ Output artifact prefix is `DARKMODE-AUDIT` — distinct from the pipeline namespace (`DESIGN-*.md`). No naming conflict.
25
+
26
+ ---
27
+
28
+ ## Pre-Flight
29
+
30
+ Confirm source root exists before scanning. Try each candidate in order:
31
+
32
+ 1. `src/` — preferred (most React/Vue/Svelte projects)
33
+ 2. `app/` — Next.js App Router
34
+ 3. `lib/` — library projects
35
+ 4. `pages/` — Next.js Pages Router
36
+
37
+ Set `SRC_ROOT` to the first directory that exists. If none exist, abort:
38
+
39
+ > "No source directory detected. Run /get-design-done scan first."
40
+
41
+ Confirm `.design/` exists (create it if absent — `mkdir -p .design/`).
42
+
43
+ ### Probe Preview connection
44
+
45
+ Run at stage entry, after pre-flight checks:
46
+
47
+ ```
48
+ Step P1 — ToolSearch check:
49
+ ToolSearch({ query: "Claude_Preview", max_results: 5 })
50
+ → Empty result → preview: not_configured (skip Dark Mode Rendering section)
51
+ → Non-empty result → proceed to Step P2
52
+
53
+ Step P2 — Live tool call:
54
+ call mcp__Claude_Preview__preview_list
55
+ → Success → preview: available
56
+ → Error → preview: unavailable
57
+
58
+ Write preview status to .design/STATE.md <connections>.
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Step 1: Architecture Detection (DARK-02)
64
+
65
+ Run all three architecture greps against `$SRC_ROOT`. Use `2>/dev/null` on each to suppress missing-directory errors.
66
+
67
+ ```bash
68
+ # Architecture 1: CSS custom properties with dark media query
69
+ arch1_count=$(grep -rEn "prefers-color-scheme.*dark|\.dark[[:space:]]*\{" "$SRC_ROOT" \
70
+ --include="*.css" --include="*.scss" 2>/dev/null | wc -l)
71
+
72
+ # Architecture 2: Tailwind dark: prefix
73
+ arch2_count=$(grep -rEn "dark:[a-z]" "$SRC_ROOT" \
74
+ --include="*.tsx" --include="*.jsx" --include="*.html" 2>/dev/null | wc -l)
75
+
76
+ # Architecture 3: JS class toggle on <html> / <body>
77
+ arch3_count=$(grep -rEn "classList.*dark|setAttribute.*dark|document\.documentElement" "$SRC_ROOT" \
78
+ --include="*.ts" --include="*.tsx" --include="*.js" 2>/dev/null | wc -l)
79
+ ```
80
+
81
+ **Classification rules:**
82
+
83
+ | Condition | Classification |
84
+ |-----------|---------------|
85
+ | All three counts < 3 | No dark mode — abort: "No dark mode implementation detected — nothing to audit." |
86
+ | Exactly one count ≥ 3 | Primary architecture = that one |
87
+ | Two or more counts ≥ 5 | Hybrid (list all detected architectures) |
88
+ | One count ≥ 3, others < 5 | Primary = highest count |
89
+
90
+ Record `ARCH_DETECTED` as one of: `Architecture 1 (CSS custom props)`, `Architecture 2 (Tailwind dark:)`, `Architecture 3 (JS class toggle)`, or `Hybrid`.
91
+
92
+ ---
93
+
94
+ ## Step 2: Contrast Audit (DARK-03)
95
+
96
+ For the detected architecture, enumerate color token + background token pairs used in dark context, then compute WCAG contrast ratios.
97
+
98
+ **Token extraction by architecture:**
99
+
100
+ **Architecture 1 (CSS custom props):**
101
+ ```bash
102
+ # Extract dark-context token definitions from .dark { } blocks and @media (prefers-color-scheme: dark) blocks
103
+ grep -rEn "\.dark[[:space:]]*\{|prefers-color-scheme.*dark" "$SRC_ROOT" \
104
+ --include="*.css" --include="*.scss" -A 30 2>/dev/null \
105
+ | grep -E "^\s*--[a-z].*:\s*#[0-9a-fA-F]{3,8}|^\s*--[a-z].*:\s*rgb"
106
+ ```
107
+
108
+ **Architecture 2 (Tailwind dark:):**
109
+ ```bash
110
+ # Extract dark:bg-* and dark:text-* class combinations
111
+ grep -rEhon "dark:(bg|text)-[a-z0-9-]+" "$SRC_ROOT" \
112
+ --include="*.tsx" --include="*.jsx" --include="*.html" 2>/dev/null | sort -u
113
+ ```
114
+
115
+ **Architecture 3 (JS class toggle):**
116
+ ```bash
117
+ # Read dark CSS rules (same as Architecture 1 — the JS toggle sets .dark on <html>)
118
+ grep -rEn "\.dark[[:space:]]*\{" "$SRC_ROOT" \
119
+ --include="*.css" --include="*.scss" -A 30 2>/dev/null \
120
+ | grep -E "color|background"
121
+ ```
122
+
123
+ **WCAG contrast computation:**
124
+
125
+ Use the linearized-sRGB formula from `agents/design-executor.md` Type: accessibility (pre-calibrated — do not re-derive). For each text/background pair:
126
+
127
+ 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`
128
+ 2. Relative luminance: `L = 0.2126 * R_lin + 0.7152 * G_lin + 0.0722 * B_lin`
129
+ 3. Contrast ratio: `(L_lighter + 0.05) / (L_darker + 0.05)`
130
+
131
+ **Thresholds:**
132
+
133
+ | Text type | Min ratio | Fail severity |
134
+ |-----------|-----------|---------------|
135
+ | Body text (< 18pt or < 14pt bold) | 4.5:1 | P0 (critical) |
136
+ | Large text (≥ 18pt or ≥ 14pt bold) | 3:1 | P1 (major) |
137
+ | UI component boundaries | 3:1 | P1 (major) |
138
+
139
+ Flag every pair that fails its threshold. Include token names, hex values, computed ratio, and required ratio in the fix description.
140
+
141
+ ---
142
+
143
+ ## Step 3: Token Override Completeness (DARK-04)
144
+
145
+ Check that every light-mode color token has a corresponding dark-mode override.
146
+
147
+ **Enumerate light-mode tokens:**
148
+ ```bash
149
+ # CSS custom props approach
150
+ grep -rEhon "var\(--color-[a-z0-9-]+\)" "$SRC_ROOT" \
151
+ --include="*.css" --include="*.scss" --include="*.tsx" --include="*.jsx" 2>/dev/null \
152
+ | grep -oE "\-\-color-[a-z0-9-]+" | sort -u
153
+
154
+ # Tailwind semantic classes (if Arch 2)
155
+ grep -rEhon "(bg|text|border|ring)-[a-z]+-[0-9]+" "$SRC_ROOT" \
156
+ --include="*.tsx" --include="*.jsx" 2>/dev/null | sort -u
157
+ ```
158
+
159
+ **Check dark overrides (architecture-specific):**
160
+ - Arch 1: Token appears in `.dark { --color-* }` block or `@media (prefers-color-scheme: dark) { --color-* }`
161
+ - Arch 2: A `dark:` prefixed variant of the Tailwind class exists in the same file or a shared layout
162
+ - Arch 3: Token appears in the dark CSS block activated by JS class toggle
163
+
164
+ **Flag:** Any light-mode color token with no dark override → P1 (major). Include token name and file location.
165
+
166
+ ---
167
+
168
+ ## Step 4: Dark-Specific Anti-Patterns (DARK-05)
169
+
170
+ **Anti-pattern A: Images and SVGs without dark variant**
171
+
172
+ ```bash
173
+ # Find all <img> and <svg> references
174
+ grep -rEn "<img[^>]+src=|<svg" "$SRC_ROOT" \
175
+ --include="*.tsx" --include="*.jsx" --include="*.html" --include="*.vue" 2>/dev/null \
176
+ | grep -v "dark\."
177
+ ```
178
+
179
+ For each image/SVG found, check whether any of the following exist:
180
+ - A sibling file with pattern `[name]-dark.{png,svg,webp}`
181
+ - A `dark:hidden` / `dark:block` swap class pairing in the same component
182
+ - A `<picture>` element with a `prefers-color-scheme: dark` source
183
+
184
+ Flag images/SVGs with none of the above → P2 (minor).
185
+
186
+ **Anti-pattern B: Pure-black backgrounds (BAN-05)**
187
+
188
+ ```bash
189
+ # Grep for pure-black in dark-context CSS
190
+ grep -rEn "#000000|#000\b|rgb\([[:space:]]*0[[:space:]]*,[[:space:]]*0[[:space:]]*,[[:space:]]*0[[:space:]]*\)|background[^:]*:[[:space:]]*black" \
191
+ "$SRC_ROOT" --include="*.css" --include="*.scss" 2>/dev/null
192
+ ```
193
+
194
+ 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.
195
+
196
+ **Anti-pattern C: Missing forced-colors media query**
197
+
198
+ ```bash
199
+ forced_count=$(grep -rEn "@media.*forced-colors" "$SRC_ROOT" \
200
+ --include="*.css" --include="*.scss" 2>/dev/null | wc -l)
201
+ ```
202
+
203
+ 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.
204
+
205
+ ---
206
+
207
+ ## Step 5: Meta Property Check (DARK-06)
208
+
209
+ **color-scheme property:**
210
+ ```bash
211
+ cs_count=$(grep -rEn "color-scheme" "$SRC_ROOT" public/ \
212
+ --include="*.html" --include="*.tsx" --include="*.css" 2>/dev/null | wc -l)
213
+ ```
214
+ If `cs_count` equals 0 → P2 (minor). The `color-scheme` CSS property / meta tag tells the browser to render scrollbars, form inputs, and system UI in the correct dark/light variant.
215
+
216
+ **prefers-color-scheme media query:**
217
+ ```bash
218
+ pcs_count=$(grep -rEn "prefers-color-scheme" "$SRC_ROOT" public/ \
219
+ --include="*.html" --include="*.tsx" --include="*.css" 2>/dev/null | wc -l)
220
+ ```
221
+ If `pcs_count` equals 0 → P2 (minor). Absence means the site ignores the OS-level dark mode preference — the user's system setting has no effect.
222
+
223
+ ---
224
+
225
+ ## Step 5B: Dark Mode Rendering Screenshots (when preview: available)
226
+
227
+ Check `preview` status from STATE.md `<connections>` (written by the probe at stage entry).
228
+
229
+ **If `preview: available`:**
230
+
231
+ 1. `preview_navigate` to the primary route (e.g., `http://localhost:3000/`).
232
+ 2. Capture light-mode screenshot: `preview_screenshot` → save to `.design/screenshots/darkmode/light.png`.
233
+ 3. Inject dark mode using the project's toggle mechanism (check `DESIGN-CONTEXT.md` D-XX decisions):
234
+ - Tailwind dark: `preview_eval("document.documentElement.classList.add('dark')")`
235
+ - data-theme: `preview_eval("document.documentElement.setAttribute('data-theme','dark')")`
236
+ - Custom class: `preview_eval("document.documentElement.classList.add('theme-dark')")`
237
+ - If mechanism is unknown: attempt Tailwind default first; note in DARKMODE-AUDIT.md which method was used
238
+ 4. `preview_screenshot` → save to `.design/screenshots/darkmode/dark.png`.
239
+ 5. Record both paths (NOT base64) for embedding in `## Dark Mode Rendering` section of DARKMODE-AUDIT.md.
240
+
241
+ **If `preview: unavailable` or `preview: not_configured`:**
242
+
243
+ Omit `## Dark Mode Rendering` section entirely. Emit: `Visual dark mode check skipped — preview not configured.` in the Notes section.
244
+
245
+ ---
246
+
247
+ ## Step 6: Write DARKMODE-AUDIT.md (DARK-07)
248
+
249
+ Output path: `.design/DARKMODE-AUDIT.md`
250
+
251
+ Collect all flagged issues from Steps 2–5, group by priority (P0 → P1 → P2 → P3), and write:
252
+
253
+ ```markdown
254
+ # Dark Mode Audit
255
+
256
+ **Generated:** <ISO date>
257
+ **Architecture detected:** <Architecture 1 (CSS custom props) | Architecture 2 (Tailwind dark:) | Architecture 3 (JS class toggle) | Hybrid | None>
258
+ **Source scanned:** <SRC_ROOT>
259
+
260
+ ## Summary
261
+
262
+ | Category | Status | Issues |
263
+ |----------|--------|--------|
264
+ | Contrast (DARK-03) | <pass / fail> | <count> |
265
+ | Token Overrides (DARK-04) | <pass / fail> | <count> |
266
+ | Anti-Patterns (DARK-05) | <pass / fail> | <count> |
267
+ | Meta Properties (DARK-06) | <pass / fail> | <count> |
268
+
269
+ ## P0 Fixes (Critical — contrast failure on body text)
270
+
271
+ - [CONTRAST] <token-pair>: ratio <X:1> — required 4.5:1. File: <path>
272
+
273
+ ## P1 Fixes (Major — contrast failure on large text / missing dark overrides / pure-black)
274
+
275
+ - [CONTRAST-LARGE] <token-pair>: ratio <X:1> — required 3:1. File: <path>
276
+ - [TOKEN-OVERRIDE] Missing dark override for <--token-name>. Light value: <hex>. File: <path>
277
+ - [BAN-05] Pure-black background detected in dark context. File: <path>:line
278
+
279
+ ## P2 Fixes (Minor — missing SVG variants / forced-colors / meta props)
280
+
281
+ - [SVG-DARK] <image.svg> has no dark variant (no -dark.svg sibling, no dark: swap class). File: <path>
282
+ - [FORCED-COLORS] No @media (forced-colors) block detected in any CSS file.
283
+ - [COLOR-SCHEME] No color-scheme property or meta tag detected.
284
+ - [PREFERS-COLOR-SCHEME] No prefers-color-scheme query detected (OS preference ignored).
285
+
286
+ ## P3 Fixes (Cosmetic)
287
+
288
+ - <cosmetic issues, if any>
289
+
290
+ ## Dark Mode Rendering
291
+
292
+ <One of the following:>
293
+ - When preview: available: side-by-side screenshot evidence
294
+ - Light: .design/screenshots/darkmode/light.png
295
+ - Dark: .design/screenshots/darkmode/dark.png
296
+ - Injection method used: <classList.add('dark') | setAttribute('data-theme','dark') | other>
297
+ - "Visual dark mode check skipped — preview not configured."
298
+
299
+ ## Notes
300
+
301
+ This audit is read-only. It does NOT write scores back to DESIGN.md.
302
+ To apply fixes, run the design pipeline and include dark mode decisions in DESIGN-CONTEXT.md.
303
+ Score writeback (V2-05) is deferred to a future version.
304
+ ```
305
+
306
+ If a priority bucket has no issues, omit that section or write "None."
307
+
308
+ ---
309
+
310
+ ## Constraints
311
+
312
+ This command MUST NOT:
313
+
314
+ - MUST NOT write to `DESIGN.md`, `DESIGN-SUMMARY.md`, `DESIGN-VERIFICATION.md`, `DESIGN-CONTEXT.md`, or `.design/STATE.md`
315
+ - MUST NOT invoke `design-auditor` (Pitfall 4 — this is a separate audit with its own inline checks, not an extension of the DESIGN-AUDIT.md pipeline)
316
+ - MUST NOT execute any fixes — audit-only per V2-07 deferral (fixes belong in the design skill's color task)
317
+ - MUST NOT write scores back to DESIGN.md (V2-05 deferred — two-sources-of-truth risk)
318
+ - MUST write exactly one output file: `.design/DARKMODE-AUDIT.md`
319
+ - MUST NOT add rows to DESIGN.md or append to pipeline-owned artifacts
320
+
321
+ ---
322
+
323
+ ## Completion
324
+
325
+ After writing `.design/DARKMODE-AUDIT.md`, print:
326
+
327
+ ```
328
+ Dark mode audit complete. Architecture: <X>. Fixes: P0=<N>, P1=<M>, P2=<K>, P3=<J>. See .design/DARKMODE-AUDIT.md.
329
+ ```
330
+
331
+ Do not summarize individual issues in the completion message — the file contains the full detail.