@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,173 @@
1
+ # Claude Preview / Playwright MCP — Connection Specification
2
+
3
+ This file is the connection specification for the Claude Preview (Playwright-backed) MCP within the get-design-done pipeline. Its primary role is to provide live browser screenshots for the verify stage — replacing `? VISUAL` flags with real rendered evidence. It also powers dark-mode screenshot capture in the darkmode stage and before/after screenshot delta in the compare stage. See `connections/connections.md` for the full connection index and capability matrix.
4
+
5
+ ---
6
+
7
+ ## Setup
8
+
9
+ **Prerequisites:**
10
+
11
+ - None. The Preview MCP is built into the Claude Code environment — no install required, no external package dependency.
12
+
13
+ **Verification:**
14
+
15
+ After session start, run:
16
+
17
+ ```
18
+ ToolSearch({ query: "Claude_Preview", max_results: 5 })
19
+ ```
20
+
21
+ Expect non-empty results listing `mcp__Claude_Preview__*` tools. If results are empty, the Preview MCP is not loaded in this session — all Preview steps will be skipped and visual checks will remain as `? VISUAL` static analysis only.
22
+
23
+ **Warning — naming confusion:**
24
+
25
+ This spec targets ONLY the built-in Claude Preview MCP. It uses the `mcp__Claude_Preview__` prefix (capital C, capital P). Do NOT confuse with any external Playwright npm packages (`@playwright/test`, `playwright-chromium`, etc.) or with `mcp__computer-use__*` screenshot tools. This spec covers ONLY `mcp__Claude_Preview__*` tools. Other Playwright-related packages cannot be invoked via the MCP protocol.
26
+
27
+ ---
28
+
29
+ ## Tools
30
+
31
+ All tools use the `mcp__Claude_Preview__` prefix.
32
+
33
+ | Tool shortname | Full name | Returns | Pipeline use |
34
+ |---------------|-----------|---------|--------------|
35
+ | `preview_list` | `mcp__Claude_Preview__preview_list` | Array of running preview sessions (may be empty) | **Lightweight probe** — used as the availability check; does not start a browser |
36
+ | `preview_start` | `mcp__Claude_Preview__preview_start` | Preview session object with URL | Start a new preview server; used in compare stage interaction mode |
37
+ | `preview_stop` | `mcp__Claude_Preview__preview_stop` | Confirmation of stop | Stop a preview server; used at end of compare stage |
38
+ | `preview_navigate` | `mcp__Claude_Preview__preview_navigate` | Navigation confirmation | Navigate to a route URL before screenshot; used in verify, compare, darkmode |
39
+ | `preview_screenshot` | `mcp__Claude_Preview__preview_screenshot` | Base64-encoded PNG image | **Primary verify workhorse** — captures rendered page screenshot; save to `.design/screenshots/<route>.png` by path, do NOT embed base64 inline |
40
+ | `preview_eval` | `mcp__Claude_Preview__preview_eval` | JS return value | **Dark mode injection tool** — inject `document.documentElement.classList.add('dark')` or project-specific toggle; also used for focus-visible checks |
41
+ | `preview_snapshot` | `mcp__Claude_Preview__preview_snapshot` | Accessibility tree (Aria roles, labels, focus state) | Used in Phase 4B for focus-visible heuristic check |
42
+ | `preview_inspect` | `mcp__Claude_Preview__preview_inspect` | Computed styles, bounding box for an element | Used in Phase 4B for visual rhythm / spacing verification |
43
+ | `preview_click` | `mcp__Claude_Preview__preview_click` | Click confirmation | Interaction mode: trigger UI state before screenshot |
44
+ | `preview_fill` | `mcp__Claude_Preview__preview_fill` | Fill confirmation | Interaction mode: populate form fields before screenshot |
45
+ | `preview_console_logs` | `mcp__Claude_Preview__preview_console_logs` | Array of console log entries | Diagnostic — capture JS errors during screenshot capture |
46
+ | `preview_logs` | `mcp__Claude_Preview__preview_logs` | Server-side log entries | Diagnostic — server logs during dev server operation |
47
+ | `preview_network` | `mcp__Claude_Preview__preview_network` | Network request/response log | Diagnostic — identify failed asset loads affecting screenshot |
48
+ | `preview_resize` | `mcp__Claude_Preview__preview_resize` | Resize confirmation | Set viewport dimensions (e.g., mobile 375px, desktop 1280px) |
49
+
50
+ `preview_list` is preferred for probing because it returns the current session list without starting a new browser context. `preview_screenshot` is the primary workhorse for the verify and compare stages. `preview_eval` is the dedicated dark-mode injection tool.
51
+
52
+ ---
53
+
54
+ ## Which Stages Use This Connection
55
+
56
+ | Stage | Skill/Agent | Tools used | Purpose |
57
+ |-------|------------|------------|---------|
58
+ | verify | `skills/verify/SKILL.md` + `agents/design-verifier.md` | `preview_navigate`, `preview_screenshot`, `preview_eval`, `preview_snapshot`, `preview_inspect` | Per-route screenshots for `? VISUAL` heuristics (H-02, H-06, H-07); dark mode parity via `preview_eval`; focus-visible via `preview_snapshot` |
59
+ | compare | `skills/compare/SKILL.md` | `preview_start`, `preview_navigate`, `preview_screenshot`, `preview_stop` | Before/after screenshot delta in COMPARE-REPORT.md |
60
+ | darkmode | `skills/darkmode/SKILL.md` | `preview_navigate`, `preview_eval`, `preview_screenshot` | Forced dark-mode screenshots for DARKMODE-AUDIT.md `## Dark Mode Rendering` section |
61
+
62
+ ---
63
+
64
+ ## Availability Probe
65
+
66
+ **Call ToolSearch first — always.** In Claude Code sessions with many MCP servers, `mcp__Claude_Preview__*` tools may be in the deferred tool set (not loaded into context at session start). Calling a deferred tool directly fails silently or errors. ToolSearch loads the tools into context and confirms their presence in a single call.
67
+
68
+ **Preview probe sequence:**
69
+
70
+ ```
71
+ Step P1 — ToolSearch check:
72
+ ToolSearch({ query: "Claude_Preview", max_results: 5 })
73
+ → Empty result → preview: not_configured (skip all Preview steps)
74
+ → Non-empty result → proceed to Step P2
75
+
76
+ Step P2 — Live tool call:
77
+ call mcp__Claude_Preview__preview_list
78
+ → Success (returns array, even empty) → preview: available
79
+ → Error → preview: unavailable
80
+ ```
81
+
82
+ Write the result to `.design/STATE.md <connections>` immediately after probing.
83
+
84
+ **Two operating modes:**
85
+
86
+ **Screenshot mode** (primary — used in verify and darkmode):
87
+ 1. `preview_navigate` to route URL (e.g., `http://localhost:3000/dashboard`)
88
+ 2. `preview_screenshot` → returns base64 PNG
89
+ 3. Save to `.design/screenshots/<route>.png` — reference by path in markdown
90
+ 4. Repeat per route
91
+
92
+ **Interaction mode** (used in compare):
93
+ 1. `preview_start` → returns session URL (if no server already running)
94
+ 2. `preview_navigate` to route URL
95
+ 3. `preview_click` / `preview_fill` to reach desired UI state
96
+ 4. `preview_screenshot` → save to path
97
+ 5. `preview_stop` when done
98
+
99
+ ---
100
+
101
+ ## Fallback Behavior
102
+
103
+ When preview is `not_configured` or `unavailable`, stages degrade gracefully — no error is raised.
104
+
105
+ **verify stage (`skills/verify/SKILL.md` + `agents/design-verifier.md`):**
106
+
107
+ - Skip Phase 4B screenshot evidence loop entirely
108
+ - Keep existing `? VISUAL` static analysis path for H-02, H-06, H-07 heuristics
109
+ - Mark all Phase 4B checks: `[SKIPPED — browser not available]`
110
+ - Design-verifier continues to Phase 5 gap analysis with partial scores
111
+
112
+ **compare stage (`skills/compare/SKILL.md`):**
113
+
114
+ - Omit `## Screenshot Delta` section from COMPARE-REPORT.md
115
+ - Emit exactly: `Screenshot delta skipped — preview not configured.` in the Notes section
116
+ - All text-based delta sections (Score Delta, Anti-Pattern Delta, Must-Have Status, Design Drift) are unaffected
117
+
118
+ **darkmode stage (`skills/darkmode/SKILL.md`):**
119
+
120
+ - Omit `## Dark Mode Rendering` section from DARKMODE-AUDIT.md
121
+ - Emit: `Visual dark mode check skipped — preview not configured.` in the Notes section
122
+ - All static architecture detection, contrast audit, and token override checks are unaffected
123
+
124
+ Neither stage appends a `<blocker>` for a missing Preview connection — Preview is an enhancement, not a requirement. If a `must_have` explicitly requires browser-rendered evidence, THEN append a blocker.
125
+
126
+ ---
127
+
128
+ ## STATE.md Integration
129
+
130
+ Every stage writes its probe result to `.design/STATE.md` under the `<connections>` section:
131
+
132
+ ```xml
133
+ <connections>
134
+ figma: available
135
+ refero: not_configured
136
+ preview: available
137
+ </connections>
138
+ ```
139
+
140
+ **Status values:**
141
+
142
+ | Value | Meaning |
143
+ |-------|---------|
144
+ | `available` | `preview_list` returned a successful response (array, even empty) |
145
+ | `unavailable` | Tool is in the session but errored (no running server, tool timeout, internal error) |
146
+ | `not_configured` | ToolSearch returned empty for `Claude_Preview` — MCP not registered in this session |
147
+
148
+ **Which stages probe vs. read:**
149
+
150
+ - **scan** — probes at pipeline entry; writes initial status to STATE.md `<connections>`
151
+ - **verify** — probes at stage entry (re-confirm; tool availability can change between sessions)
152
+ - **compare** — probes at stage entry
153
+ - **darkmode** — probes at stage entry
154
+
155
+ Downstream stages (verify, compare, darkmode) re-probe rather than blindly reading STATE.md because MCP availability can change between sessions. However, if STATE.md already contains a `preview:` status from a prior stage in the SAME session, that status can be trusted for the rest of that session.
156
+
157
+ ---
158
+
159
+ ## Caveats and Pitfalls
160
+
161
+ 1. **`preview_screenshot` returns base64 — save by path.** The tool returns a full base64-encoded PNG. Embedding multiple screenshots inline in DESIGN-VERIFICATION.md or COMPARE-REPORT.md creates 500KB+ files that are unreadable and slow. **Always save to `.design/screenshots/<route>.png` and reference via file path in markdown. Only embed base64 for one critical single-image check at most.**
162
+
163
+ 2. **`preview_list` is the correct probe tool.** It returns the list of current preview sessions without starting a new browser context. Using `preview_start` as a probe would spin up a browser unnecessarily. Use `preview_list` always for probing.
164
+
165
+ 3. **Dark mode injection — check the project's actual toggle mechanism.** The default injection `document.documentElement.classList.add('dark')` works for Tailwind dark mode and most class-based toggles. However, some projects use `setAttribute('data-theme', 'dark')`, `classList.add('theme-dark')`, or CSS `prefers-color-scheme` media queries only (where JS injection has no effect). **Before injecting, check DESIGN-CONTEXT.md D-XX decisions to confirm the project's dark mode mechanism.** Alternatives:
166
+ - Tailwind: `document.documentElement.classList.add('dark')`
167
+ - data-theme: `document.documentElement.setAttribute('data-theme', 'dark')`
168
+ - Custom class: `document.documentElement.classList.add('theme-dark')`
169
+ - Media query only: `preview_eval` cannot force this; use `preview_resize` or check if a system media override is available
170
+
171
+ 4. **`preview_start` may require a running dev server.** If the project has no dev server running, `preview_list` may return an empty array — that is `preview: available` (not unavailable). The empty array means the MCP is functional but no sessions are running. The verify stage should attempt `preview_navigate` to `http://localhost:3000` (or project-configured port) and handle 404 / connection-refused gracefully — if navigation fails, update STATE.md to `preview: unavailable` for this session and fall back to static analysis.
172
+
173
+ 5. **`.design/screenshots/` should be gitignored.** Screenshots may contain rendered UI with sensitive data (user info, internal tools). The `.design/` directory is already gitignored in get-design-done projects (see Phase 1). Confirm `.gitignore` includes `.design/` before saving screenshots.
@@ -0,0 +1,189 @@
1
+ # Refero MCP — Connection Specification
2
+
3
+ This file is the connection specification for Refero within the get-design-done pipeline. It lives in `connections/` alongside other connection specs. See `connections/connections.md` for the full connection index and capability matrix.
4
+
5
+ ---
6
+
7
+ Refero is the **discover stage's primary visual reference tool**. It retrieves real product screenshots and design references, replacing "imagine how this should look" with "look at how Linear/Stripe/Phantom/Raycast did it."
8
+
9
+ ---
10
+
11
+ ## Setup
12
+
13
+ **Prerequisites:**
14
+
15
+ - Refero account with an active subscription (required for search access)
16
+ - Refero MCP installed via Refero's MCP setup instructions (vendor-specific — follow Refero's official documentation; do not use a generic Claude Code MCP add command unless Refero documents one)
17
+
18
+ **Install:**
19
+
20
+ Install per Refero's MCP setup instructions, then restart the Claude Code session. After restart, the `mcp__refero__*` tools appear in the session.
21
+
22
+ **Verification:**
23
+
24
+ ```
25
+ ToolSearch({ query: "refero", max_results: 10 })
26
+ ```
27
+
28
+ Expect non-empty results. If empty, the Refero MCP is not registered — complete the install steps and restart.
29
+
30
+ **Note on tool names:** Exact tool names may vary between Refero MCP versions. Always verify via ToolSearch before calling any `mcp__refero__*` tool. Do not hardcode tool names in prompts — treat the ToolSearch result as the authoritative list.
31
+
32
+ ---
33
+
34
+ ## Why refero is non-negotiable
35
+
36
+ Without references, LLMs converge on:
37
+ - Inter / Space Grotesk / DM Sans typefaces
38
+ - Purple→blue gradients on white backgrounds
39
+ - Glassmorphism + rounded rectangles + generic drop shadows
40
+ - Card-in-card layouts, sparkline-as-decoration
41
+ - Cyan accents on dark backgrounds
42
+ - Identical hero-metric templates
43
+
44
+ With references, you copy the *structure* of best-in-class work and adapt the aesthetic to your brand. This is how pros design.
45
+
46
+ ## When to use refero
47
+
48
+ **Always at the start of the discover stage.** No exceptions:
49
+ - Building any UI → pull references for similar products and layouts
50
+ - Writing UX copy → pull references for how the canonical products in that category write the equivalent string
51
+ - Designing animations → pull references for the interaction (then pair with `emil-design-eng`)
52
+ - Auditing → pull references for "what best-in-class looks like" before calling something bad
53
+
54
+ ## Tools available (after session restart)
55
+
56
+ The refero MCP exposes tools under `mcp__refero__*` after the next session restart. Check available tools via ToolSearch:
57
+
58
+ ```
59
+ ToolSearch({ query: "refero", max_results: 30 })
60
+ ```
61
+
62
+ Typical tool set (names may vary — verify via ToolSearch on first use):
63
+ - **search** — semantic search across refero's indexed design corpus
64
+ - **get** / **fetch** — retrieve a specific reference by ID or URL
65
+ - **browse** by category / tag / brand
66
+
67
+ ## Search strategy
68
+
69
+ Run **at least 2 queries per task**, one structural + one aesthetic:
70
+
71
+ ### Structural queries (what the thing IS)
72
+ - "checkout flow mobile"
73
+ - "empty state messaging app"
74
+ - "admin table dashboard with filters"
75
+ - "login screen minimal"
76
+ - "onboarding wizard steps"
77
+ - "settings page tabs"
78
+ - "data visualization KPI card"
79
+
80
+ ### Aesthetic queries (how it should FEEL)
81
+ - "editorial dark fintech"
82
+ - "brutalist portfolio"
83
+ - "retro-futuristic music player"
84
+ - "warm terracotta SaaS landing"
85
+ - "neutral Swiss design dashboard"
86
+ - "Japanese minimalist e-commerce"
87
+ - "maximalist magazine web"
88
+
89
+ ### Brand-specific queries (when you have a north star)
90
+ - "linear app dashboard" — fast, dense, unimpressed
91
+ - "stripe payments docs" — clear, direct, honest
92
+ - "phantom wallet crypto" — calm, editorial, confident
93
+ - "raycast launcher" — sleek, opinionated
94
+ - "vercel dashboard" — black/white precision
95
+
96
+ ## Workflow
97
+
98
+ ```
99
+ 1. refero search "checkout flow mobile" # structural
100
+ 2. refero search "warm editorial consumer app" # aesthetic
101
+ 3. pick 3-7 that match the brief
102
+ 4. save URLs + brief notes into the discover reference pack
103
+ 5. if relevant DESIGN.md exists for one of them:
104
+ → read ~/.claude/libs/awesome-design-md/{brand}/README.md
105
+ 6. proceed to the plan stage with the pack
106
+ ```
107
+
108
+ ## Citing references in output
109
+
110
+ When presenting designs, **always name the references**. Don't say "I designed this." Say "This takes Linear's issue list structure and applies Claude's editorial warmth." This:
111
+ - Shows the user the logic so they can push back precisely
112
+ - Makes iteration faster (user can say "less Linear, more Notion")
113
+ - Prevents claims of originality that don't hold up
114
+
115
+ ## STATE.md Integration
116
+
117
+ Every stage that probes Refero writes the result to `.design/STATE.md` under the `<connections>` section:
118
+
119
+ ```xml
120
+ <connections>
121
+ figma: available
122
+ refero: not_configured
123
+ </connections>
124
+ ```
125
+
126
+ **Status values:**
127
+
128
+ | Value | Meaning |
129
+ |-------|---------|
130
+ | `available` | ToolSearch returned non-empty results for `refero` |
131
+ | `unavailable` | Refero tools are present but a live call errored |
132
+ | `not_configured` | ToolSearch returned empty for `refero` — MCP not registered |
133
+
134
+ **Probe pattern (ToolSearch-only — no tool call needed):**
135
+
136
+ ```
137
+ ToolSearch({ query: "refero", max_results: 5 })
138
+ → Empty result → refero: not_configured
139
+ → Non-empty result → refero: available
140
+ ```
141
+
142
+ Rationale: calling a real Refero search as the probe would waste tokens and incur API cost before confirming the connection is even needed. ToolSearch presence is sufficient — if the tools are registered, the connection is available. A live call failure would downgrade to `unavailable`, but this is rare and best handled when an actual search is attempted.
143
+
144
+ **Which stages probe Refero:** the discover stage (via `agents/design-context-builder.md`). The scan, plan, and verify stages do not use Refero and do not probe it.
145
+
146
+ ---
147
+
148
+ ## Fallback chain
149
+
150
+ When Refero is `not_configured` or `unavailable`, the discover stage falls back through this three-tier chain:
151
+
152
+ **Tier 1 — Refero MCP** (`mcp__refero__search` or verified tool name from ToolSearch):
153
+ Real product screenshots from Refero's corpus of 125,000+ screens. Best quality, broadest coverage. Use when `refero: available`.
154
+
155
+ **Tier 2 — awesome-design-md library** (`~/.claude/libs/awesome-design-md/design-md/`):
156
+ 68 brand archetypes with structured DESIGN.md token files. Pick 1–2 closest matches by brand category. Provides concrete token values (colors, fonts, spacing) you can copy-adapt. Use when Refero is unavailable.
157
+
158
+ **Tier 3 — WebFetch** (getdesign.md URLs from the awesome-design-md list):
159
+ Last resort. Fetch design reference URLs directly. Slower and less reliable than the MCP. Use only when tiers 1 and 2 are both unavailable.
160
+
161
+ Never proceed without references — that's the whole point of Discover.
162
+
163
+ ## Fallbacks if refero is down / not installed
164
+
165
+ 1. **awesome-design-md library** — `~/.claude/libs/awesome-design-md/design-md/` has 68 real brand archetypes with DESIGN.md pointers. Pick 1–2 closest matches.
166
+ 2. **Figma MCP** — if the user's project has Figma connected, read existing designs or search their design system.
167
+ 3. **Last resort: WebFetch** getdesign.md URLs from the awesome-design-md list.
168
+
169
+ Never proceed without references — that's the whole point of Discover.
170
+
171
+ ## Combining refero with awesome-design-md
172
+
173
+ ```
174
+ Refero → how does best-in-class look right now (images)
175
+ awesome-design-md → structured DESIGN.md tokens for 68 brands (text)
176
+ ```
177
+
178
+ Use both. Refero for visual direction, awesome-design-md for concrete token values (colors, fonts, spacing) you can copy-adapt.
179
+
180
+ ## Anti-pattern
181
+
182
+ Do NOT use refero to:
183
+ - Collect a huge dump of references and paste them all into the response (noise)
184
+ - Justify a direction you've already decided on (confirmation bias; pull first, then decide)
185
+ - Skip the plan stage ("the references tell me the brand") — references inform direction, they don't *replace* context gathering with the user.
186
+
187
+ ## If refero's API changes
188
+
189
+ Keep this file up to date. If tool names or invocation patterns shift, update the examples here and adjust the routing in SKILL.md.
@@ -0,0 +1,280 @@
1
+ # Storybook — Connection Specification
2
+
3
+ This file is the connection specification for Storybook within the get-design-done pipeline. It lives in `connections/` alongside other connection specs. See `connections/connections.md` for the full connection index and capability matrix.
4
+
5
+ ---
6
+
7
+ Storybook is a local or CI dev server probed via HTTP `GET /index.json`. Its role is to serve as the **authoritative component inventory** for the discover stage (replacing grep-based enumeration) and to provide per-story a11y test output for the verify stage. No dedicated Storybook MCP is required — the probe is HTTP-based, using `curl` directly from Bash. For the full connection index see `connections/connections.md`.
8
+
9
+ ---
10
+
11
+ ## Setup
12
+
13
+ **Prerequisites:**
14
+
15
+ - Storybook installed as a dev dependency:
16
+ ```bash
17
+ npm install --save-dev storybook @storybook/react @storybook/addon-a11y
18
+ ```
19
+ - Project configured in `.storybook/` (run `npx storybook init` for first-time setup — this is a one-time developer step, not a probe step)
20
+
21
+ **Start command:**
22
+
23
+ ```bash
24
+ npx storybook dev -p 6006
25
+ ```
26
+
27
+ **Verification:**
28
+
29
+ ```bash
30
+ curl -sf http://localhost:6006/index.json | head -1
31
+ ```
32
+
33
+ Expect JSON with `"v": 5` as the first field. If this returns empty, the dev server is not running — start it with the command above.
34
+
35
+ **Note on versions:** Storybook 8 serves `/index.json`. Storybook 7 serves `/stories.json`. The probe tries both (see Availability Probe section). When Storybook 8 is confirmed, always prefer `index.json`.
36
+
37
+ ---
38
+
39
+ ## Why Storybook is non-negotiable
40
+
41
+ Storybook declares every component state **explicitly and exhaustively**. A component with five variants (Primary, Disabled, Loading, WithIcon, Destructive) has five stories — not one component grep match.
42
+
43
+ Grep-based component inventory:
44
+ - Misses unnamed variants (a `<Button variant="ghost">` used inline is invisible to grep)
45
+ - Generates false positives from test files, storybook stories themselves, and import declarations
46
+ - Cannot enumerate story args or describe what states exist
47
+
48
+ `index.json` is the canonical, exhaustive component state register. It has zero false positives (every entry is a real, intentionally-declared story) and zero missed states (if a state is undeclared, it does not exist in Storybook either — which is itself a signal).
49
+
50
+ The verify stage iterates every declared story state to check a11y coverage. This is only possible because `index.json` enumerates them.
51
+
52
+ ---
53
+
54
+ ## When to use Storybook
55
+
56
+ **At the discover stage entry** (when the dev server is running) to build the authoritative component inventory. Replaces the grep-based component scan in `design-context-builder.md` Step 1.
57
+
58
+ **At the verify stage** after the design executor runs, to enumerate all story states for a11y coverage via `npx storybook test --ci`.
59
+
60
+ **At the design stage** (project detection only — dev server not required) to determine whether to emit `.stories.tsx` stubs alongside newly scaffolded components.
61
+
62
+ ---
63
+
64
+ ## Endpoints (HTTP GET — not MCP tools)
65
+
66
+ Storybook has no dedicated MCP. All integration is via HTTP GET to the running dev server or via Bash commands against the project files.
67
+
68
+ | Endpoint | Returns | Pipeline use |
69
+ |----------|---------|-------------|
70
+ | `GET /index.json` | Flat map of storyId → `{id, title, name, importPath, type, tags}` | Authoritative component inventory (Storybook 8) |
71
+ | `GET /stories.json` | Equivalent flat map in Storybook 7 format | Fallback for older Storybook versions |
72
+
73
+ **CRITICAL: Storybook 8 `index.json` does NOT include `parameters`.** Do NOT attempt to read `entry.parameters` from index.json entries — the field does not exist in Storybook 8. A11y configuration lives in `.storybook/preview.ts`, not in index.json. (See Caveats section.)
74
+
75
+ ---
76
+
77
+ ## index.json format (Storybook 8)
78
+
79
+ ```json
80
+ {
81
+ "v": 5,
82
+ "entries": {
83
+ "button--primary": {
84
+ "id": "button--primary",
85
+ "title": "Button",
86
+ "name": "Primary",
87
+ "importPath": "./src/components/Button.stories.tsx",
88
+ "type": "story",
89
+ "tags": ["autodocs"]
90
+ },
91
+ "button--disabled": {
92
+ "id": "button--disabled",
93
+ "title": "Button",
94
+ "name": "Disabled",
95
+ "importPath": "./src/components/Button.stories.tsx",
96
+ "type": "story",
97
+ "tags": []
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ **Key fields per entry:**
104
+
105
+ | Field | Description |
106
+ |-------|-------------|
107
+ | `id` | Kebab-case unique identifier: `{component-title}--{story-name}` |
108
+ | `title` | Component name / hierarchy path (e.g., `"Components/Button"` or `"Button"`) |
109
+ | `name` | Story variant name (e.g., `"Primary"`, `"Disabled"`, `"With Icon"`) |
110
+ | `importPath` | Relative path to the `.stories.tsx` file |
111
+ | `type` | `"story"` \| `"docs"` \| `"component"` — filter to `"story"` for variant enumeration |
112
+ | `tags` | Array of strings; `"autodocs"` marks auto-generated docs entries |
113
+
114
+ **Component inventory from index.json:** Group entries by `title` field to get the component list. Each unique `title` is one component; entries under it are its declared states. Example:
115
+
116
+ ```
117
+ Title: "Button"
118
+ States: Primary, Secondary, Disabled, Loading, WithIcon
119
+ Stories file: ./src/components/Button.stories.tsx
120
+
121
+ Title: "Input"
122
+ States: Default, Error, Disabled, WithHelperText
123
+ Stories file: ./src/components/Input.stories.tsx
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Which Stages Use This Connection
129
+
130
+ | Stage | Agent | Endpoint / Command | Purpose |
131
+ |-------|-------|--------------------|---------|
132
+ | discover | `agents/design-context-builder.md` | `GET /index.json` | Component inventory (replaces grep) |
133
+ | verify | `agents/design-verifier.md` | `npx storybook test --ci` | Per-story a11y output for a11y gap analysis |
134
+ | design | `skills/design/SKILL.md` | `.storybook/` project detection (no server required) | `.stories.tsx` stub emission alongside new components |
135
+
136
+ ---
137
+
138
+ ## Availability Probe
139
+
140
+ The probe is two-phase. Run both steps in sequence at stage entry.
141
+
142
+ ### Step B1 — Project detection
143
+
144
+ ```bash
145
+ ls .storybook/ 2>/dev/null || grep '"storybook"' package.json 2>/dev/null
146
+ ```
147
+
148
+ - **Found** → `storybook_project: true` → proceed to Step B2
149
+ - **Not found** → `storybook: not_configured` — skip all Storybook steps
150
+
151
+ ### Step B2 — Dev server detection
152
+
153
+ ```bash
154
+ curl -sf http://localhost:6006/index.json 2>/dev/null | head -1
155
+ ```
156
+
157
+ - **Returns JSON** → `storybook: available` (Storybook 8 endpoint confirmed)
158
+ - **Fails (empty / connection refused)** → try the Storybook 7 compat endpoint:
159
+
160
+ ```bash
161
+ curl -sf http://localhost:6006/stories.json 2>/dev/null | head -1
162
+ ```
163
+
164
+ - **Returns JSON** → `storybook: available` (using `stories.json` compat endpoint — log which was used)
165
+ - **Fails** → `storybook: unavailable` (project detected but dev server not running)
166
+
167
+ ### Three-value result
168
+
169
+ | Status | Meaning |
170
+ |--------|---------|
171
+ | `available` | Dev server running; `index.json` (or `stories.json` compat) confirmed |
172
+ | `unavailable` | Project has Storybook (`.storybook/` present) but dev server is not running |
173
+ | `not_configured` | No `.storybook/` directory and no `"storybook"` in `package.json` |
174
+
175
+ Write the resulting status to `.design/STATE.md` `<connections>`.
176
+
177
+ ---
178
+
179
+ ## Fallback Behavior
180
+
181
+ **discover stage:**
182
+
183
+ - `storybook: available` → read `index.json`, group entries by `title`, use as authoritative component list
184
+ - `storybook: unavailable` → fall back to grep-based component inventory; note in output: "component inventory via grep (storybook server not running)"
185
+ - `storybook: not_configured` → grep inventory only; no Storybook-specific steps
186
+
187
+ **verify stage:**
188
+
189
+ - `storybook: available` → run `npx storybook test --ci 2>&1 | tee .design/storybook-a11y-report.txt`; pass report to design-verifier
190
+ - `storybook: unavailable` → skip per-story a11y loop; run standard WCAG grep-based a11y checks only
191
+ - `storybook: not_configured` → skip; emit no note (this is an opt-in feature)
192
+
193
+ **design stage:**
194
+
195
+ - `storybook_project: true` (B1 found — dev server irrelevant) → emit `.stories.tsx` stubs alongside all new components
196
+ - `storybook: not_configured` (B1 not found) → skip `.stories.tsx` stub emission
197
+
198
+ Note: design stage uses **only Step B1** (project detection). Whether the dev server is running (B2) does not affect `.stories.tsx` stub emission — if the project has Storybook configured, new components need stories regardless.
199
+
200
+ ---
201
+
202
+ ## STATE.md Integration
203
+
204
+ Every stage that probes Storybook writes the result to `.design/STATE.md` under the `<connections>` section:
205
+
206
+ ```xml
207
+ <connections>
208
+ figma: available
209
+ refero: not_configured
210
+ storybook: available
211
+ </connections>
212
+ ```
213
+
214
+ **Status value table:**
215
+
216
+ | Value | Meaning |
217
+ |-------|---------|
218
+ | `available` | HTTP GET confirmed; `index.json` (or stories.json) returned valid JSON |
219
+ | `unavailable` | Project has Storybook configured but dev server is not running |
220
+ | `not_configured` | No `.storybook/` directory and no storybook dependency in `package.json` |
221
+
222
+ The scan stage writes the initial status at pipeline startup. Subsequent stages (discover, verify) re-read from STATE.md without re-probing unless they explicitly re-probe as part of their own stage entry.
223
+
224
+ ---
225
+
226
+ ## .stories.tsx CSF Stub Template
227
+
228
+ When `storybook_project: true`, the design stage emits this stub alongside every new component file:
229
+
230
+ ```tsx
231
+ import type { Meta, StoryObj } from '@storybook/react';
232
+ import { ComponentName } from './ComponentName';
233
+
234
+ const meta: Meta<typeof ComponentName> = {
235
+ title: 'Components/ComponentName',
236
+ component: ComponentName,
237
+ parameters: { a11y: { test: 'error' } },
238
+ };
239
+ export default meta;
240
+
241
+ type Story = StoryObj<typeof ComponentName>;
242
+
243
+ export const Default: Story = { args: {} };
244
+ export const Primary: Story = { args: { variant: 'primary' } };
245
+ export const Disabled: Story = { args: { disabled: true } };
246
+ ```
247
+
248
+ Adjust `title` to match the component's directory structure:
249
+ - `src/components/Button.tsx` → `title: 'Components/Button'`
250
+ - `src/features/auth/LoginForm.tsx` → `title: 'Features/Auth/LoginForm'`
251
+
252
+ The `parameters.a11y.test = 'error'` setting makes axe-core a11y violations fail the Vitest test run, surfacing accessibility issues as CI failures.
253
+
254
+ ---
255
+
256
+ ## Caveats and Pitfalls
257
+
258
+ **1. Storybook 8 `index.json` does NOT contain `parameters`**
259
+
260
+ Storybook 7's `stories.json` included a `parameters` field per story (used by some tooling to detect addon config). Storybook 8 removed this from `index.json`. Never read `entry.parameters.a11y` from index.json — it does not exist and will return `undefined` for all entries, making a11y integration appear unconfigured even when it is. A11y configuration lives in `.storybook/preview.ts` — read that file to determine if `@storybook/addon-a11y` is enabled.
261
+
262
+ **2. Group by `title` to get component list**
263
+
264
+ Each unique `title` is one component. Each entry under that title is a declared story state. Iterating entries without grouping gives stories, not components. For a component inventory, iterate unique titles.
265
+
266
+ **3. Filter out `type: "docs"` entries**
267
+
268
+ Auto-generated docs entries (`type: "docs"`, often tagged `"autodocs"`) are not story states. Filter to `type: "story"` when building the variant list.
269
+
270
+ **4. First-time Storybook setup requires `npx storybook init`**
271
+
272
+ This is a one-time developer setup step, not part of the probe. The probe only detects whether Storybook is already configured in the project — it does not initialize Storybook.
273
+
274
+ **5. Chromatic dependency**
275
+
276
+ Chromatic requires Storybook. If `storybook: not_configured`, Chromatic cannot function even if its API token is present. See `connections/chromatic.md` for details.
277
+
278
+ **6. `stories.json` vs `index.json` version split**
279
+
280
+ Always probe `index.json` first. Only fall back to `stories.json` if `index.json` returns 404 or an error. Log which endpoint was used so downstream steps know the Storybook version.