@hegemonart/get-design-done 1.28.0 → 1.28.6

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 +134 -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/architecture-vocabulary.md +102 -0
  9. package/reference/context-md-format.md +106 -0
  10. package/reference/heuristics.md +84 -0
  11. package/reference/registry.json +29 -1
  12. package/reference/registry.schema.json +1 -1
  13. package/reference/shared-preamble.md +78 -6
  14. package/reference/skill-authoring-contract.md +159 -0
  15. package/scripts/validate-skill-length.cjs +283 -0
  16. package/skills/add-backlog/SKILL.md +1 -0
  17. package/skills/analyze-dependencies/SKILL.md +33 -122
  18. package/skills/apply-reflections/SKILL.md +1 -40
  19. package/skills/apply-reflections/apply-reflections-procedure.md +68 -0
  20. package/skills/audit/SKILL.md +3 -1
  21. package/skills/bandit-status/SKILL.md +31 -66
  22. package/skills/benchmark/SKILL.md +15 -55
  23. package/skills/brief/SKILL.md +12 -1
  24. package/skills/cache-manager/SKILL.md +3 -57
  25. package/skills/cache-manager/cache-policy.md +126 -0
  26. package/skills/check-update/SKILL.md +38 -75
  27. package/skills/compare/SKILL.md +29 -269
  28. package/skills/compare/compare-rubric.md +171 -0
  29. package/skills/complete-cycle/SKILL.md +1 -1
  30. package/skills/connections/SKILL.md +21 -427
  31. package/skills/connections/connections-onboarding.md +417 -0
  32. package/skills/continue/SKILL.md +1 -0
  33. package/skills/darkmode/SKILL.md +32 -287
  34. package/skills/darkmode/darkmode-audit-procedure.md +258 -0
  35. package/skills/debug/SKILL.md +11 -8
  36. package/skills/debug/debug-feedback-loops.md +119 -0
  37. package/skills/design/SKILL.md +27 -245
  38. package/skills/design/design-procedure.md +304 -0
  39. package/skills/discover/SKILL.md +26 -133
  40. package/skills/discover/discover-procedure.md +204 -0
  41. package/skills/discuss/SKILL.md +18 -2
  42. package/skills/explore/SKILL.md +40 -205
  43. package/skills/explore/explore-procedure.md +267 -0
  44. package/skills/fast/SKILL.md +1 -0
  45. package/skills/figma-write/SKILL.md +2 -2
  46. package/skills/health/SKILL.md +11 -33
  47. package/skills/health/health-mcp-detection.md +44 -0
  48. package/skills/health/health-skill-length-report.md +69 -0
  49. package/skills/help/SKILL.md +1 -0
  50. package/skills/list-assumptions/SKILL.md +1 -0
  51. package/skills/map/SKILL.md +8 -31
  52. package/skills/new-cycle/SKILL.md +3 -1
  53. package/skills/new-cycle/milestone-completeness-rubric.md +87 -0
  54. package/skills/next/SKILL.md +1 -0
  55. package/skills/note/SKILL.md +1 -0
  56. package/skills/optimize/SKILL.md +21 -44
  57. package/skills/pause/SKILL.md +1 -0
  58. package/skills/peer-cli-add/SKILL.md +26 -108
  59. package/skills/peer-cli-add/peer-cli-protocol.md +161 -0
  60. package/skills/peer-cli-customize/SKILL.md +22 -42
  61. package/skills/peers/SKILL.md +33 -57
  62. package/skills/plan/SKILL.md +33 -220
  63. package/skills/plan/plan-procedure.md +278 -0
  64. package/skills/plant-seed/SKILL.md +1 -0
  65. package/skills/pr-branch/SKILL.md +1 -0
  66. package/skills/progress/SKILL.md +1 -7
  67. package/skills/quality-gate/SKILL.md +34 -166
  68. package/skills/quality-gate/threat-modeling.md +101 -0
  69. package/skills/quick/SKILL.md +1 -0
  70. package/skills/reapply-patches/SKILL.md +1 -0
  71. package/skills/recall/SKILL.md +1 -0
  72. package/skills/resume/SKILL.md +1 -0
  73. package/skills/review-backlog/SKILL.md +1 -0
  74. package/skills/router/SKILL.md +3 -59
  75. package/skills/router/router-rules.md +84 -0
  76. package/skills/scan/SKILL.md +36 -675
  77. package/skills/scan/scan-procedure.md +731 -0
  78. package/skills/settings/SKILL.md +1 -0
  79. package/skills/ship/SKILL.md +1 -0
  80. package/skills/sketch/SKILL.md +1 -1
  81. package/skills/sketch-wrap-up/SKILL.md +13 -54
  82. package/skills/spike/SKILL.md +1 -1
  83. package/skills/spike-wrap-up/SKILL.md +12 -46
  84. package/skills/start/SKILL.md +13 -112
  85. package/skills/start/start-procedure.md +115 -0
  86. package/skills/stats/SKILL.md +1 -0
  87. package/skills/style/SKILL.md +18 -140
  88. package/skills/style/style-doc-procedure.md +150 -0
  89. package/skills/synthesize/SKILL.md +1 -0
  90. package/skills/timeline/SKILL.md +1 -0
  91. package/skills/todo/SKILL.md +1 -0
  92. package/skills/turn-closeout/SKILL.md +36 -56
  93. package/skills/undo/SKILL.md +1 -0
  94. package/skills/update/SKILL.md +1 -0
  95. package/skills/verify/SKILL.md +42 -457
  96. package/skills/verify/verify-procedure.md +512 -0
  97. package/skills/warm-cache/SKILL.md +3 -35
  98. package/skills/zoom-out/SKILL.md +26 -0
@@ -0,0 +1,731 @@
1
+ ---
2
+ name: scan-procedure
3
+ type: meta-rules
4
+ version: 1.0.0
5
+ phase: 28.5
6
+ tags: [scan, procedure, extracted, pipeline-stage, design-system, audit]
7
+ last_updated: 2026-05-18
8
+ ---
9
+
10
+ Source: extracted from `skills/scan/SKILL.md` (Phase 28.5 rework — D-10 extract-then-link).
11
+ The skill's load-bearing workflow stays in `../skills/scan/SKILL.md`; this file holds the
12
+ detail the agent reaches for when executing a specific step (STATE integration, connection
13
+ probes, extraction grep commands, scoring, output contracts).
14
+
15
+ # Scan Procedure
16
+
17
+ Detailed procedure for the get-design-done `scan` pre-pipeline initializer. Companion to
18
+ `../skills/scan/SKILL.md`. Read this file when executing a specific scan step; the SKILL.md
19
+ keeps the load-bearing workflow + decision tree, this file holds the deep methodology.
20
+
21
+ ---
22
+
23
+ ## State Integration
24
+
25
+ ### Read or create STATE.md
26
+
27
+ At scan entry, before running any step:
28
+
29
+ 1. Check for `.design/STATE.md`.
30
+ - **If missing:** create it from `../reference/STATE-TEMPLATE.md`. Set the following fields:
31
+ - `started_at` = now (ISO 8601) — **set once; never overwrite on subsequent runs**
32
+ - `last_checkpoint` = now
33
+ - frontmatter `stage` = `scan`
34
+ - `<position>` `stage` = `scan`, `status` = `in_progress`, `task_progress` = `0/8`
35
+ - **If present and `stage == scan` and `status == in_progress`:** RESUME — skip already-complete steps using `task_progress` as offset. Do not reset `started_at`.
36
+ - **Otherwise (normal transition):** set frontmatter `stage = scan`, `<position>` `stage = scan`, `status = in_progress`, `task_progress = 0/8`. Do not overwrite `started_at`.
37
+
38
+ ### Probe connection availability
39
+
40
+ Run both probes below. MCP tools may be in the deferred tool set — **always call ToolSearch first**; without it, a deferred tool invocation fails silently.
41
+
42
+ **Figma probe (variant-agnostic — resolves any server prefix matching `/figma/i`):**
43
+
44
+ ```
45
+ Step A1 — Keyword ToolSearch:
46
+ ToolSearch({ query: "figma get_metadata use_figma", max_results: 10 })
47
+
48
+ Parse results for tool names matching:
49
+ - /^mcp__([^_]*figma[^_]*)__get_metadata$/i -> read-capable prefix set
50
+ - /^mcp__([^_]*figma[^_]*)__use_figma$/i -> write-capable prefix set
51
+
52
+ Empty read set -> figma: not_configured (skip all Figma steps)
53
+ One or more matches -> proceed to Step A2
54
+
55
+ Step A2 — Tiebreaker selection:
56
+ Preference order when multiple read prefixes match:
57
+ 1. Prefer prefixes that appear in BOTH read set and write set
58
+ 2. Prefer `figma` (canonical remote server name)
59
+ 3. Prefer non-`figma-desktop`
60
+ 4. Alphabetical
61
+
62
+ Step A3 — Live tool call on resolved prefix:
63
+ call mcp__<prefix>__get_metadata
64
+ -> Success -> figma: available (prefix=mcp__<prefix>__, writes=<true|false>)
65
+ -> Error -> figma: unavailable (skip all Figma steps)
66
+ ```
67
+
68
+ **Refero probe:**
69
+
70
+ ```
71
+ Step B1 — ToolSearch check:
72
+ ToolSearch({ query: "refero", max_results: 5 })
73
+ -> Empty result -> refero: not_configured (use fallback chain)
74
+ -> Non-empty result -> refero: available
75
+ ```
76
+
77
+ Note: scan probes **both** connections because the State Integration block is the authoritative connection-detection point for the entire pipeline. Scan itself does not use Refero, but it writes the Refero status so downstream stages (discover) do not need to re-probe from scratch.
78
+
79
+ ### Phase 8 Connection Probes
80
+
81
+ Run all 4 Phase 8 probes at scan entry. Results are written to STATE.md `<connections>` so downstream stages (verify, compare, darkmode, plan, design) do not re-probe unless needed.
82
+
83
+ Note: as of v1.0.7.1, Figma is a single connection (`figma:` key) covering reads + writes — no separate `figma_writer:` probe. The Wave A Figma probe above is the sole Figma availability check.
84
+
85
+ **preview:**
86
+
87
+ ```
88
+ Step P1 — ToolSearch check:
89
+ ToolSearch({ query: "Claude_Preview", max_results: 5 })
90
+ -> Empty result -> preview: not_configured
91
+ -> Non-empty result -> proceed to Step P2
92
+
93
+ Step P2 — Live tool call:
94
+ call mcp__Claude_Preview__preview_list
95
+ -> Success -> preview: available
96
+ -> Error -> preview: unavailable
97
+
98
+ Write: preview: <status> to STATE.md <connections>
99
+ ```
100
+
101
+ **storybook:**
102
+
103
+ ```
104
+ Step B1 — Project detection:
105
+ Bash: ls .storybook/ 2>/dev/null || grep '"storybook"' package.json 2>/dev/null
106
+ -> Found -> storybook_project: true -> proceed to Step B2
107
+ -> Not found -> storybook: not_configured
108
+
109
+ Step B2 — Dev server detection:
110
+ Bash: curl -sf http://localhost:6006/index.json 2>/dev/null | head -1
111
+ -> Returns JSON -> storybook: available
112
+ -> Fails -> Bash: curl -sf http://localhost:6006/stories.json 2>/dev/null | head -1
113
+ -> Returns JSON -> storybook: available (compat endpoint)
114
+ -> Fails -> storybook: unavailable
115
+
116
+ Write: storybook: <status> to STATE.md <connections>
117
+ ```
118
+
119
+ **chromatic:**
120
+
121
+ ```
122
+ Step C1 — CLI presence:
123
+ Bash: command -v chromatic 2>/dev/null || npx chromatic --version 2>/dev/null
124
+ -> found -> proceed to Step C2
125
+ -> not found -> chromatic: not_configured
126
+
127
+ Step C2 — Token check:
128
+ Bash: test -n "${CHROMATIC_PROJECT_TOKEN}"
129
+ -> true -> chromatic: available
130
+ -> false -> chromatic: unavailable
131
+
132
+ Write: chromatic: <status> to STATE.md <connections>
133
+ ```
134
+
135
+ **graphify:**
136
+
137
+ ```
138
+ Step G1 — Config check:
139
+ Bash: node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" graphify status
140
+ -> Error or { enabled: false } -> graphify: not_configured
141
+ -> { enabled: true } -> proceed to Step G2
142
+
143
+ Step G2 — Graph file check:
144
+ Bash: test -f graphify-out/graph.json
145
+ -> Present -> graphify: available
146
+ -> Absent -> graphify: unavailable
147
+
148
+ Write: graphify: <status> to STATE.md <connections>
149
+ ```
150
+
151
+ After all 4 probes, STATE.md `<connections>` contains all 4 status entries (plus the Wave A `figma:` and `refero:` probes = 6 total entries). Downstream plans (08-02 through 08-05) read these values without re-probing.
152
+
153
+ **First-run connection nudge:** after writing STATE.md, check whether every probed connection came back `not_configured` AND `.design/config.json > connections_onboarding` is absent. If so, print once at the end of scan output:
154
+
155
+ ```
156
+ Tip: run /gdd:connections to walk through setup for Figma, Storybook, Chromatic, and 9 other integrations.
157
+ ```
158
+
159
+ Suppress the nudge if any probe returned `available` or `unavailable`, or if the user has already run `/gdd:connections` (marker: `connections_onboarding` block present or previously drained).
160
+
161
+ ### Write STATE.md
162
+
163
+ Update `.design/STATE.md` with probe results:
164
+
165
+ ```xml
166
+ <connections>
167
+ figma: <available | unavailable | not_configured>
168
+ refero: <available | not_configured>
169
+ preview: <available | unavailable | not_configured>
170
+ storybook: <available | unavailable | not_configured>
171
+ chromatic: <available | unavailable | not_configured>
172
+ graphify: <available | unavailable | not_configured>
173
+ </connections>
174
+ ```
175
+
176
+ Update `last_checkpoint` to now. Write `.design/STATE.md` to disk before proceeding to Step 1.
177
+
178
+ ---
179
+
180
+ ## Step 1 — Orient
181
+
182
+ Identify the project structure before scanning:
183
+
184
+ ```bash
185
+ # Framework detection
186
+ cat package.json 2>/dev/null | grep -E '"(next|nuxt|vite|react|vue|svelte|remix|astro|tailwind)"' | head -20
187
+
188
+ # CSS approach
189
+ ls src/styles/ styles/ app/styles/ 2>/dev/null
190
+ find . -name "tailwind.config.*" -not -path "*/node_modules/*" 2>/dev/null | head -3
191
+ find . -name "*.tokens.json" -o -name "design-tokens.*" -o -name "tokens.css" 2>/dev/null | grep -v node_modules | head -5
192
+
193
+ # Component count
194
+ find . -name "*.tsx" -o -name "*.jsx" -o -name "*.vue" -o -name "*.svelte" 2>/dev/null | grep -v node_modules | wc -l
195
+
196
+ # Style file count
197
+ find . -name "*.css" -o -name "*.scss" -o -name "*.less" 2>/dev/null | grep -v node_modules | wc -l
198
+ ```
199
+
200
+ Record: framework, CSS approach, component count, style file count, token system (yes/no).
201
+
202
+ **Detect source root.** Check these directories in order and use the first one that exists:
203
+ `src/` -> `app/` -> `pages/` -> `lib/`. Substitute the detected source root (the matched
204
+ directory name) into every subsequent grep command in this SKILL.md that currently references
205
+ `src/` as the primary component root. If none of these directories exist, log
206
+ "No standard source directory found — manual audit required" and proceed with the unchanged
207
+ command (the `2>/dev/null` guards will suppress the no-match output).
208
+
209
+ Log the detected source root in DESIGN.md frontmatter as:
210
+ source_roots: [<detected_dir>]
211
+
212
+ ---
213
+
214
+ ## Step 2 — Extract Color System
215
+
216
+ ```bash
217
+ # All hex colors used
218
+ grep -roh "#[0-9a-fA-F]\{3,8\}" src/ styles/ app/ --include="*.css" --include="*.scss" --include="*.tsx" --include="*.jsx" --include="*.ts" --include="*.vue" 2>/dev/null | sort | uniq -c | sort -rn | head -40
219
+
220
+ # oklch / hsl / rgb colors
221
+ grep -rEoh "oklch\([^)]*\)|hsl\([^)]*\)|rgb\([^)]*\)" src/ styles/ --include="*.css" --include="*.scss" 2>/dev/null | sort | uniq -c | sort -rn | head -20
222
+
223
+ # CSS custom properties (color tokens)
224
+ grep -rEoh "\-\-[a-z][a-z0-9\-]*color[a-z0-9\-]*:\s*[^;]*|\-\-color[a-z0-9\-]*:\s*[^;]*" src/ styles/ --include="*.css" --include="*.scss" 2>/dev/null | sort | uniq | head -30
225
+
226
+ # Tailwind color config
227
+ grep -A 100 '"colors"' tailwind.config.* 2>/dev/null | head -50
228
+ ```
229
+
230
+ **Analyze the color data:**
231
+
232
+ 1. How many unique colors? (< 10 = disciplined, 10–25 = moderate, > 25 = ad-hoc)
233
+ 2. Is there a token layer (CSS custom properties)? Or raw hex in components?
234
+ 3. Does the palette contain AI-slop colors? (#6366f1, #8b5cf6, #06b6d4)
235
+ 4. Are there semantic roles evident from naming? (`--color-primary`, `--color-danger`)
236
+ 5. Is pure black (#000000) used in dark mode?
237
+
238
+ Produce a color inventory table:
239
+ ```
240
+ | Color | Occurrences | Role (inferred) | Issues |
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Step 2A — Figma Token Augmentation
246
+
247
+ **Skip this step if `figma` is `not_configured` or `unavailable` in `.design/STATE.md` `<connections>`.** Fall back to the grep-based token extraction from Step 2 alone — no error, no warning. Scan continues normally.
248
+
249
+ ### If `figma: available`
250
+
251
+ Read the resolved prefix from STATE.md `<connections>` (e.g., `prefix=mcp__figma__` or `prefix=mcp__figma-desktop__`) and call `{prefix}get_variable_defs` (no arguments — returns all variables in the active Figma file).
252
+
253
+ > If no Figma file is open, the call errors. Treat any error as a graceful skip: update STATE.md `<connections>` to `figma: unavailable` and continue with Step 2 results only.
254
+
255
+ **For each variable returned, apply the following translation:**
256
+
257
+ | Variable type | Name pattern | Output |
258
+ |---------------|--------------|--------|
259
+ | `COLOR` | any | Add row to color inventory table |
260
+ | `FLOAT` | `spacing/*` | Add row to spacing system |
261
+ | `FLOAT` | `font-size/*` or `typography/*` | Add row to typography system |
262
+
263
+ Record both the variable **NAME** and resolved value — not just the value. `get_variable_defs` returns resolved values only (no alias chains); the name often carries semantic meaning the value cannot.
264
+
265
+ **Multi-mode (Light/Dark):** when `valuesByMode` has multiple entries, extract all values and note dark-mode existence in the DESIGN.md color section.
266
+
267
+ ### Merge, don't replace
268
+
269
+ Keep grep-derived tokens from Step 2 AND Figma tokens. Both sets appear in DESIGN.md:
270
+
271
+ - **Figma-only tokens** (in Figma, not in CSS): annotate as "design intention not yet implemented"
272
+ - **Code-only tokens** (in CSS, not in Figma): annotate as "implementation drift or local override"
273
+ - **Matching tokens**: show Figma value alongside CSS value; flag any discrepancy
274
+
275
+ ### DESIGN.md annotations required
276
+
277
+ When this step runs successfully:
278
+
279
+ 1. Change the token layer section header from "CSS custom properties" to "CSS custom properties + Figma variables"
280
+ 2. Add to DESIGN.md frontmatter:
281
+ - `figma_variables_used: true`
282
+ - `figma_source: [list of collection names returned by get_variable_defs]`
283
+
284
+ ### Caveats
285
+
286
+ - `get_variable_defs` returns **resolved values only** — no alias chains. Always record the variable NAME alongside the value; the name carries semantic meaning not present in the hex/float alone.
287
+ - **Multi-mode:** when Light and Dark mode values differ, record both. Note dark-mode variable presence in the DESIGN.md color section.
288
+ - **No file open:** if `get_variable_defs` errors (most commonly because no Figma file is open), skip this step entirely and update STATE.md `<connections>` to `figma: unavailable`. Do not error the scan stage.
289
+
290
+ ---
291
+
292
+ ## Step 3 — Extract Typography System
293
+
294
+ ```bash
295
+ # Font families
296
+ grep -rEoh "font-family:\s*[^;]*|fontFamily:\s*[^,}]*" src/ styles/ --include="*.css" --include="*.scss" --include="*.ts" --include="*.tsx" 2>/dev/null | sort | uniq -c | sort -rn | head -20
297
+
298
+ # Font sizes
299
+ grep -rEoh "font-size:\s*[0-9.]*\(rem|px|em\)|text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl)" src/ styles/ --include="*.css" --include="*.scss" --include="*.tsx" --include="*.jsx" 2>/dev/null | sort | uniq -c | sort -rn | head -30
300
+
301
+ # Font weights
302
+ grep -rEoh "font-weight:\s*[0-9]*|fw-[0-9]*|font-(thin|light|normal|medium|semibold|bold|extrabold|black)" src/ styles/ --include="*.css" --include="*.scss" --include="*.tsx" 2>/dev/null | sort | uniq -c | sort -rn | head -20
303
+
304
+ # Line heights
305
+ grep -rEoh "line-height:\s*[0-9.]*|leading-[a-z0-9]*" src/ styles/ --include="*.css" --include="*.scss" --include="*.tsx" 2>/dev/null | sort | uniq -c | sort -rn | head -15
306
+ ```
307
+
308
+ **Analyze:**
309
+
310
+ 1. How many font families? (> 2 = violation unless one is monospace)
311
+ 2. Are font sizes from a defined scale or arbitrary px?
312
+ 3. Map found sizes to nearest modular scale — identify outliers
313
+ 4. Are weights following hierarchy? (body 400, headings 600-700, never 300 on small text)
314
+ 5. Line-height on body text — is it 1.5–1.75?
315
+ 6. Any of the reflex fonts without apparent brand reason? (Inter, DM Sans, Space Grotesk, Plus Jakarta Sans)
316
+
317
+ Read `${CLAUDE_PLUGIN_ROOT}/reference/typography.md` for comparison criteria.
318
+
319
+ Produce a typography inventory table.
320
+
321
+ ---
322
+
323
+ ## Step 4 — Extract Spacing System
324
+
325
+ ```bash
326
+ # All CSS spacing values
327
+ grep -rEoh "padding:\s*[0-9]*px|margin:\s*[0-9]*px|gap:\s*[0-9]*px" src/ styles/ --include="*.css" --include="*.scss" 2>/dev/null | grep -oh "[0-9]*px" | sort -n | uniq -c | sort -rn | head -20
328
+
329
+ # Tailwind spacing overrides
330
+ grep -A 30 '"spacing"' tailwind.config.* 2>/dev/null | head -35
331
+
332
+ # Space tokens
333
+ grep -rEoh "\-\-space[a-z0-9\-]*:\s*[^;]*|\-\-spacing[a-z0-9\-]*:\s*[^;]*" src/ styles/ --include="*.css" 2>/dev/null | head -20
334
+ ```
335
+
336
+ **Analyze:**
337
+
338
+ Grid compliance: are spacing values in the 4/8/12/16/24/32/48/64 series? Flag any values not in this set (e.g., 13px, 22px, 37px are off-grid).
339
+
340
+ ---
341
+
342
+ ## Step 5 — Anti-Pattern Audit
343
+
344
+ Read `${CLAUDE_PLUGIN_ROOT}/reference/anti-patterns.md`. Run all grep commands.
345
+
346
+ ```bash
347
+ # BAN violations (-3 each from Anti-Pattern score)
348
+ echo "=== BAN-01: Side-stripe borders ===" && grep -rEn "border-left:\s*[2-9][0-9]*px|border-right:\s*[2-9][0-9]*px" src/ --include="*.css" --include="*.scss" --include="*.tsx" 2>/dev/null
349
+ echo "=== BAN-02: Gradient text ===" && grep -rEn "background-clip:\s*text|text-fill-color:\s*transparent" src/ 2>/dev/null
350
+ echo "=== BAN-03: Bounce easing ===" && grep -rEn "cubic-bezier\(.*-[0-9]|bounce|elastic" src/ --include="*.css" --include="*.scss" 2>/dev/null
351
+ echo "=== BAN-08: transition: all ===" && grep -rnE "transition:[[:space:]]*all([^a-zA-Z]|$)" src/ --include="*.css" --include="*.scss" --include="*.tsx" 2>/dev/null | head -10
352
+ echo "=== BAN-05: Pure black dark mode ===" && grep -rEn "#000000\b|rgb\(0,\s*0,\s*0\)" src/ --include="*.css" --include="*.scss" 2>/dev/null | head -5
353
+ echo "=== BAN-06: Disable zoom ===" && grep -rEn "user-scalable=no|maximum-scale=1" public/ src/ 2>/dev/null
354
+ echo "=== BAN-07: outline:none without replacement ===" && grep -rnE ":focus[[:space:]]*\{" src/ --include="*.css" --include="*.scss" 2>/dev/null | head -5
355
+
356
+ # SLOP signals (-1 each)
357
+ echo "=== SLOP-01: AI palette ===" && grep -rEn "#6366f1|#8b5cf6|#06b6d4" src/ 2>/dev/null | head -5
358
+ echo "=== SLOP-04: backdrop-filter ===" && grep -rnE "backdrop-filter:[[:space:]]*blur" src/ --include="*.css" --include="*.scss" 2>/dev/null | head -5
359
+
360
+ # Accessibility
361
+ echo "=== A11Y: focus rings ===" && grep -rEn "outline:\s*none|outline:\s*0" src/ --include="*.css" --include="*.scss" 2>/dev/null | head -5
362
+ echo "=== A11Y: reduced motion ===" && grep -rn "prefers-reduced-motion" src/ --include="*.css" --include="*.scss" 2>/dev/null | head -3
363
+ echo "=== A11Y: div onClick ===" && grep -rEn "onClick.*div|<div.*onClick" src/ --include="*.tsx" --include="*.jsx" 2>/dev/null | head -5
364
+ echo "=== A11Y: small font ===" && grep -rEn "font-size:\s*1[0-5]px|font-size:\s*[0-9]px" src/ --include="*.css" --include="*.scss" 2>/dev/null | head -5
365
+ ```
366
+
367
+ For each finding: record the count, a sample file:line, and severity (BAN = P0, SLOP = P1, A11Y = P0–P1 depending on type).
368
+
369
+ ---
370
+
371
+ ## Step 6 — Component Inventory
372
+
373
+ If `--quick`, skip this step.
374
+
375
+ ### Component pattern indicators
376
+
377
+ A bare `grep -rln "className" src/` produces false positives on type-only files, test files, utility helpers, and server-only modules — none of which are components. Instead, use a three-pass multi-signal filter. A file qualifies as a component only when **all three indicators** match:
378
+
379
+ 1. Has a JSX-like return: `grep -lE "return\s*\(" <file>`
380
+ 2. Has className or class attribute usage: `grep -lE "className=|class=" <file>`
381
+ 3. Has a component framework import: `grep -lE "from ['\"](react|preact|vue)" <file>`
382
+
383
+ ```bash
384
+ # Component inventory — three-pass filter (requires all three signals)
385
+
386
+ # Pass 1: files with JSX-like return statements
387
+ grep -rlE "return\s*\(" src/ --include="*.tsx" --include="*.jsx" 2>/dev/null \
388
+ | grep -vE "\.test\.|\.spec\.|\.stories\." > /tmp/scan-pass1.txt
389
+
390
+ # Pass 2: intersect with className/class presence
391
+ grep -lE "className=|class=" $(cat /tmp/scan-pass1.txt) 2>/dev/null > /tmp/scan-pass2.txt
392
+
393
+ # Pass 3: intersect with framework import (react, preact, or vue)
394
+ grep -lE "from ['\"](react|preact|vue)" $(cat /tmp/scan-pass2.txt) 2>/dev/null > /tmp/components.txt
395
+
396
+ # Count and list
397
+ wc -l < /tmp/components.txt
398
+ cat /tmp/components.txt
399
+ ```
400
+
401
+ This produces a component inventory that excludes false positives. The resulting file list is the authoritative component set for the rest of this step.
402
+
403
+ ```bash
404
+ # Count components by directory (from the filtered list)
405
+ xargs dirname < /tmp/components.txt | sort | uniq -c | sort -rn | head -20
406
+
407
+ # Look for design system component patterns
408
+ grep -rEln "Button|Modal|Dialog|Toast|Tooltip|Badge|Card|Input|Select|Dropdown|Table|Tab|Accordion" \
409
+ $(cat /tmp/components.txt) 2>/dev/null | grep -v node_modules | head -20
410
+ ```
411
+
412
+ Identify:
413
+ - Core UI primitives that exist (Button, Input, Modal, etc.)
414
+ - Which have design system-level implementation vs. one-off styles
415
+ - Which are candidates for design system extraction
416
+
417
+ ### --full mode per-file output
418
+
419
+ If `--full` flag is set, emit one row per file in the component inventory:
420
+
421
+ | File | Component Count | Styling Approach | Token Usage | Issues |
422
+ |------|-----------------|------------------|-------------|--------|
423
+ | src/components/Button.tsx | 1 | Tailwind | var(--primary), p-4, gap-2 | heading weight dup |
424
+ | src/components/Card.tsx | 1 | CSS Module | styles.card, rgb(...) | hardcoded color |
425
+
426
+ Columns:
427
+ - **File**: relative path from repo root
428
+ - **Component Count**: number of exported components in file (grep `export.*function\|export.*const.*=.*\(.*=>`)
429
+ - **Styling Approach**: `Tailwind` | `CSS Module` | `styled-components` | `inline` | `mixed`
430
+ - **Token Usage**: comma-separated tokens/values found (max 5, "+N more" if there are more)
431
+ - **Issues**: short flags for known problems (e.g., `hardcoded color`, `off-grid spacing`, `heading weight dup`)
432
+
433
+ Without `--full`, the component inventory is a summary count only (not per-file).
434
+
435
+ ---
436
+
437
+ ## Step 7 — Score All 7 Categories
438
+
439
+ Read `${CLAUDE_PLUGIN_ROOT}/reference/audit-scoring.md`. Score each category 0–10 based on what you found in Steps 1–6.
440
+
441
+ Apply the weighted formula:
442
+ ```
443
+ Score = (Accessibility * 0.25) + (Visual Hierarchy * 0.20) + (Typography * 0.15)
444
+ + (Color * 0.15) + (Layout * 0.10) + (Anti-Patterns * 0.10) + (Motion * 0.05)
445
+ ```
446
+
447
+ Calculate grade (A=90–100, B=75–89, C=60–74, D=45–59, F=0–44).
448
+
449
+ ---
450
+
451
+ ## Step 8 — Generate Design Debt Roadmap
452
+
453
+ Collect all findings from Steps 1–6. Classify each:
454
+
455
+ | Severity | Code | Rule |
456
+ |---|---|---|
457
+ | Blocker | P0 | BAN violations, contrast failures, keyboard nav broken |
458
+ | Major | P1 | SLOP signals, no token layer, off-grid spacing, no scale system |
459
+ | Minor | P2 | Reflex font without reason, inconsistent weights, redundant colors |
460
+ | Cosmetic | P3 | Polish items, minor naming inconsistencies |
461
+
462
+ Group into **debt themes**:
463
+
464
+ 1. **Foundation** — token layer, design system architecture
465
+ 2. **Typography** — scale, hierarchy, families
466
+ 3. **Color** — palette, semantics, dark mode
467
+ 4. **Accessibility** — contrast, focus, semantics, motion
468
+ 5. **Anti-Patterns** — BAN + SLOP removals
469
+ 6. **Components** — inconsistency, missing primitives
470
+ 7. **Motion** — easing, duration, reduced-motion
471
+
472
+ For each debt item, estimate effort:
473
+ - `XS` — single-line grep-and-replace (< 30 min)
474
+ - `S` — localized fix in 1–3 files (< 2h)
475
+ - `M` — affects 5–15 files, requires testing (2–8h)
476
+ - `L` — architectural change, touches 15+ files (1–3 days)
477
+ - `XL` — design system rebuild (3+ days)
478
+
479
+ ### Priority score for ordering DESIGN-DEBT.md entries
480
+
481
+ Each debt item gets three scores:
482
+
483
+ - **severity_weight**: `{ P0: 4, P1: 3, P2: 2, P3: 1 }`
484
+ - **effort_weight**: `{ XS: 5, S: 4, M: 3, L: 2, XL: 1 }` — high effort = lower priority
485
+ - **dependency_depth**: count of other debt items this fix unblocks
486
+
487
+ Formula:
488
+
489
+ ```
490
+ priority_score = (severity_weight * effort_weight) + (dependency_depth * 2)
491
+ ```
492
+
493
+ Ordering rules:
494
+ 1. Sort entries by `priority_score` descending (highest first)
495
+ 2. Tiebreak: file count descending (more files affected = more impact)
496
+ 3. Second tiebreak: alphabetical by item ID (D-001 before D-002)
497
+
498
+ Example: A P1 issue (`severity_weight = 3`) with S effort (`effort_weight = 4`) that unblocks 2 other items (`dependency_depth = 2`) scores: `(3 * 4) + (2 * 2) = 16`. A P0 issue (`4`) with XL effort (`1`) with no dependencies scores: `(4 * 1) + 0 = 4`. The P1 ranks above the P0 despite lower severity because its XL effort makes the P0 low ROI.
499
+
500
+ Identify **quick wins**: P1 issues with XS/S effort — these have the best ROI.
501
+ Identify **blocking dependencies**: fixes that must happen before others (e.g., token layer before dark mode).
502
+
503
+ ---
504
+
505
+ ## Output 1: DESIGN.md
506
+
507
+ Write `DESIGN.md` at the project root:
508
+
509
+ ```markdown
510
+ ---
511
+ generated: [ISO 8601]
512
+ tool: get-design-done scan
513
+ score: [N]/100 ([grade])
514
+ framework: [name]
515
+ css_approach: [tailwind | css-modules | styled-components | plain-css | mixed]
516
+ token_layer: true | false
517
+ ---
518
+
519
+ # Design System Snapshot — [Project Name]
520
+
521
+ > Auto-generated by get-design-done scan. Update manually when the system evolves.
522
+
523
+ ## Current Score
524
+
525
+ | Category | Score | Grade |
526
+ |---|---|---|
527
+ | Accessibility | [N]/10 | |
528
+ | Visual Hierarchy | [N]/10 | |
529
+ | Typography | [N]/10 | |
530
+ | Color | [N]/10 | |
531
+ | Layout & Spacing | [N]/10 | |
532
+ | Anti-Patterns | [N]/10 | |
533
+ | Motion | [N]/10 | |
534
+ | **Weighted Total** | **[N]/100** | **[grade]** |
535
+
536
+ ## Color System
537
+
538
+ **Token layer:** [Yes — CSS custom properties / No — raw values in components]
539
+
540
+ **Palette inventory:**
541
+ | Color | Hex | Role | Occurrences | Issues |
542
+ |---|---|---|---|---|
543
+ | Primary | #[hex] | [inferred role] | [N] | [any issues] |
544
+
545
+ **Semantic consistency:** [Pass / Fail — describe]
546
+ **Dark mode:** [Yes / No / Partial] — [pure black: yes/no]
547
+ **AI-slop palette present:** [Yes (#6366f1 etc.) / No]
548
+
549
+ ## Typography System
550
+
551
+ **Families used:** [family 1], [family 2]
552
+ **Scale:** [defined modular scale / ad-hoc px values / Tailwind defaults]
553
+
554
+ | Token | Size | Found occurrences | Scale-compliant |
555
+ |---|---|---|---|
556
+ | body | [Npx] | [N] | [check/cross] |
557
+ | sm | [Npx] | [N] | [check/cross] |
558
+
559
+ **Line-height body:** [value] ([pass >=1.5 / fail])
560
+ **Weight hierarchy:** [described]
561
+ **Off-scale values found:** [list any non-standard sizes]
562
+
563
+ ## Spacing System
564
+
565
+ **Grid:** [8pt / 4pt / ad-hoc / Tailwind defaults]
566
+ **Non-grid values found:** [list off-grid values with occurrence count]
567
+
568
+ ## Component Inventory
569
+
570
+ **Total components:** [N]
571
+ **With consistent styling:** [N] (~[N]%)
572
+ **Core primitives present:** [Button check, Input check, Modal cross, Toast cross, ...]
573
+
574
+ ## Anti-Pattern Status
575
+
576
+ | Pattern | Status | Occurrences | Locations |
577
+ |---|---|---|---|
578
+ | BAN-01: Side-stripe border | [Clear / Found] | [N] | [file:line] |
579
+ | BAN-02: Gradient text | [Clear / Found] | [N] | |
580
+ | BAN-03: Bounce easing | [Clear / Found] | [N] | |
581
+ | BAN-07: outline:none | [Clear / Found] | [N] | |
582
+ | BAN-08: transition:all | [Clear / Found] | [N] | |
583
+ | SLOP-01: AI palette | [Clear / Found] | [N] | |
584
+ | SLOP-04: backdrop-filter | [Clear / Found] | [N] | |
585
+
586
+ ## Motion / Animation
587
+
588
+ **prefers-reduced-motion:** [Implemented / Missing]
589
+ **Easing used:** [list found easing values]
590
+ **Bounce/elastic:** [Found / None]
591
+ ```
592
+
593
+ ---
594
+
595
+ ## Output 2: .design/DESIGN-DEBT.md
596
+
597
+ Create `.design/` if needed. Write `.design/DESIGN-DEBT.md`:
598
+
599
+ ```markdown
600
+ ---
601
+ generated: [ISO 8601]
602
+ score: [N]/100 ([grade])
603
+ p0_count: [N]
604
+ p1_count: [N]
605
+ p2_count: [N]
606
+ p3_count: [N]
607
+ ---
608
+
609
+ # Design Debt — [Project Name]
610
+
611
+ > Prioritized roadmap of design issues found by get-design-done scan.
612
+ > Fix P0s before shipping. Work through P1s in priority order.
613
+ > Quick wins (P1 + XS/S effort) are marked with lightning bolt.
614
+
615
+ ## Summary
616
+
617
+ | Severity | Count | Est. Total Effort |
618
+ |---|---|---|
619
+ | P0 Blocker | [N] | [sum of estimates] |
620
+ | P1 Major | [N] | [sum] |
621
+ | P2 Minor | [N] | [sum] |
622
+ | P3 Cosmetic | [N] | [sum] |
623
+
624
+ **Category score to improve first:** [lowest-scoring category] ([N]/10) — highest impact on overall score.
625
+
626
+ ---
627
+
628
+ ## P0 — Blockers (fix before shipping)
629
+
630
+ ### D-001 — [Issue title]
631
+ Category: [scoring category]
632
+ Theme: [foundation | typography | color | accessibility | anti-patterns | components | motion]
633
+ Severity: [P0/P1/P2/P3]
634
+ Effort: [XS/S/M/L/XL]
635
+ priority_score: [computed: (severity_weight * effort_weight) + (dependency_depth * 2)]
636
+ Description: [What the issue is and where it was found]
637
+ Evidence: [file:line or grep pattern that found it]
638
+ Fix: [Concrete steps to fix — specific enough to execute without extra research]
639
+ Acceptance: [What pass looks like — verifiable]
640
+ Depends on: [D-XXX if this fix requires another fix first, else "none"]
641
+ Dependency depth: [N — count of items this fix unblocks]
642
+
643
+ ---
644
+
645
+ ## P1 — Major (fix in current design pass)
646
+
647
+ ### D-010 — [Issue title] (quick-win)
648
+ Category: [category]
649
+ Theme: [theme]
650
+ Severity: P1
651
+ Effort: XS
652
+ priority_score: [computed: (3 * 5) + (dependency_depth * 2) = 15+]
653
+ Description: [...]
654
+ Evidence: [...]
655
+ Fix: [...]
656
+ Acceptance: [...]
657
+ Dependency depth: [N]
658
+
659
+ ---
660
+
661
+ ## P2 — Minor (fix if time allows)
662
+
663
+ [same structure]
664
+
665
+ ---
666
+
667
+ ## P3 — Cosmetic (deferred to polish pass)
668
+
669
+ [same structure]
670
+
671
+ ---
672
+
673
+ ## Recommended Fix Order
674
+
675
+ Based on dependencies and ROI:
676
+
677
+ 1. **[D-XXX]** — [title] (unblocks [D-XXX, D-XXX])
678
+ 2. **[D-XXX]** — quick win
679
+ 3. **[D-XXX]** — [title]
680
+ ...
681
+
682
+ ## Pipeline Recommendation
683
+
684
+ Given the scan results:
685
+
686
+ ```
687
+ Suggested first pipeline run:
688
+ /get-design-done:discover --auto
689
+ -> Will use DESIGN.md as baseline context
690
+ /get-design-done:plan
691
+ -> Scope: address all P0s + top 5 P1s
692
+ /get-design-done:design
693
+ /get-design-done:verify
694
+ -> Target score: [current + 15 points minimum]
695
+ ```
696
+
697
+ Focus areas for first design pass:
698
+ 1. [highest-impact category]: [specific what to fix]
699
+ 2. [second-highest-impact]: [specific what to fix]
700
+ 3. Quick wins: [D-XXX], [D-XXX], [D-XXX] (all XS effort, instant score gain)
701
+ ```
702
+
703
+ ---
704
+
705
+ ## After Writing
706
+
707
+ ```
708
+ === Scan complete ===
709
+ Project: [name]
710
+ Score: [N]/100 ([grade])
711
+ P0 blockers: [N]
712
+ P1 major: [N]
713
+ Quick wins: [N] (P1 + XS/S effort)
714
+
715
+ Artifacts written:
716
+ DESIGN.md — design system snapshot
717
+ .design/DESIGN-DEBT.md — prioritized debt roadmap
718
+
719
+ Next steps:
720
+ Option A — Start the pipeline:
721
+ /get-design-done:discover
722
+ (DESIGN.md will be used as baseline context)
723
+
724
+ Option B — Fix quick wins first, then start:
725
+ [list top 3 quick win fixes inline]
726
+ Then: /get-design-done:discover
727
+
728
+ Option C — Just reference the debt:
729
+ DESIGN-DEBT.md is your backlog. Filter by theme or severity.
730
+ =====================
731
+ ```