@polymorphism-tech/morph-spec 4.21.0 → 5.0.1

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 (213) hide show
  1. package/CLAUDE.md +57 -71
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +224 -491
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +55 -38
  8. package/framework/MORPH.md +244 -0
  9. package/framework/agents.json +127 -1183
  10. package/framework/commands/morph-apply.md +56 -240
  11. package/framework/commands/morph-archive.md +48 -85
  12. package/framework/commands/morph-preflight.md +7 -7
  13. package/framework/commands/morph-proposal.md +35 -191
  14. package/framework/commands/morph-status.md +19 -50
  15. package/framework/commands/morph-troubleshoot.md +2 -2
  16. package/framework/evals/rubrics/README.md +44 -0
  17. package/framework/evals/rubrics/architecture.md +46 -0
  18. package/framework/evals/rubrics/code-quality.md +50 -0
  19. package/framework/evals/rubrics/contracts.md +47 -0
  20. package/framework/evals/rubrics/test-coverage.md +50 -0
  21. package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
  22. package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
  23. package/framework/evals/suites/standard.yaml +5 -0
  24. package/framework/evals/trace-schema.md +67 -0
  25. package/framework/hooks/claude-code/core/README.md +3 -0
  26. package/framework/hooks/claude-code/core/denylist.json +14 -0
  27. package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
  28. package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
  29. package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
  30. package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
  31. package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
  32. package/framework/hooks/shared/phase-utils.js +20 -28
  33. package/framework/hooks/shared/state-reader.js +4 -5
  34. package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -210
  35. package/framework/phases.json +40 -114
  36. package/framework/rubrics/eval-rubric.json +66 -0
  37. package/framework/skills/README.md +39 -64
  38. package/framework/skills/core/README.md +3 -0
  39. package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
  40. package/framework/skills/core/morph-eval/SKILL.md +57 -0
  41. package/framework/skills/core/morph-implement/SKILL.md +83 -0
  42. package/framework/skills/core/morph-plan/SKILL.md +64 -0
  43. package/framework/skills/core/morph-review/SKILL.md +62 -0
  44. package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
  45. package/framework/skills/core/morph-standards/SKILL.md +49 -0
  46. package/framework/standards/STANDARDS.json +32 -0
  47. package/framework/standards/frontend/design-system/ai-image-generation.md +244 -0
  48. package/framework/standards/integration/mcp/mcp-tools.md +48 -0
  49. package/framework/templates/CLAUDE.md.core.guide.md +29 -0
  50. package/framework/templates/CLAUDE.md.core.template +22 -0
  51. package/framework/templates/REGISTRY.json +4 -4
  52. package/framework/workflows/configs/fast-track.json +5 -10
  53. package/framework/workflows/configs/full.json +4 -8
  54. package/framework/workflows/configs/quick.json +32 -0
  55. package/framework/workflows/configs/standard.json +57 -64
  56. package/package.json +7 -6
  57. package/src/commands/mcp/mcp-setup.js +58 -31
  58. package/src/commands/project/doctor.js +69 -70
  59. package/src/commands/project/init.js +26 -5
  60. package/src/commands/project/status.js +18 -19
  61. package/src/commands/state/approve.js +1 -1
  62. package/src/commands/validation/validate-feature.js +18 -112
  63. package/src/core/paths/output-schema.js +133 -151
  64. package/src/core/state/phase-state-machine.js +10 -24
  65. package/src/core/state/state-manager.js +17 -17
  66. package/src/core/workflows/workflow-detector.js +214 -31
  67. package/src/core/workflows/workflow-router.js +204 -0
  68. package/src/dashboard/app/pages/AgentMap.jsx +32 -33
  69. package/src/dashboard/app/pages/LiveState.jsx +1 -1
  70. package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
  71. package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
  72. package/src/dashboard/app/pages/Workflows.jsx +2 -2
  73. package/src/dashboard/scanner/agents-scanner.js +30 -35
  74. package/src/lib/agents/metrics-aggregator.js +1 -1
  75. package/src/lib/agents/output-collector.js +7 -8
  76. package/src/lib/context/context-builder.js +289 -0
  77. package/src/lib/detectors/claude-config-detector.js +19 -3
  78. package/src/lib/generators/context-generator.js +20 -42
  79. package/src/lib/generators/index.js +1 -0
  80. package/src/lib/generators/mandate-generator.js +512 -0
  81. package/src/lib/generators/metadata-extractor.js +1 -1
  82. package/src/lib/generators/recap-generator.js +3 -4
  83. package/src/lib/installers/mcp-installer.js +300 -92
  84. package/src/lib/phase-chain/phase-validator.js +36 -40
  85. package/src/lib/stack/stack-profile.js +74 -91
  86. package/src/lib/tasks/task-parser.js +1 -1
  87. package/src/lib/tasks/wave-resolver.js +353 -0
  88. package/src/lib/validators/checkpoint-persistence.js +2 -2
  89. package/src/lib/validators/content/cross-phase-validator.js +281 -0
  90. package/src/lib/validators/content/index.js +1 -0
  91. package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
  92. package/src/scripts/global-install.js +2 -27
  93. package/src/utils/agents-installer.js +224 -447
  94. package/src/utils/claude-settings-manager.js +57 -15
  95. package/src/utils/file-copier.js +1 -0
  96. package/src/utils/hooks-installer.js +15 -117
  97. package/src/utils/skills-installer.js +12 -18
  98. package/bin/detect-agents.js +0 -226
  99. package/bin/task-manager.js +0 -1036
  100. package/framework/agents/README.md +0 -13
  101. package/framework/agents/ai-agents/ai-system-architect.md +0 -194
  102. package/framework/agents/ai-agents/vector-search-expert.md +0 -247
  103. package/framework/agents/architecture/architecture-expert.md +0 -98
  104. package/framework/agents/architecture/morph-spec-architect.md +0 -66
  105. package/framework/agents/architecture/packages-validator.md +0 -89
  106. package/framework/agents/architecture/security-expert.md +0 -79
  107. package/framework/agents/architecture/seo-growth-hacker.md +0 -168
  108. package/framework/agents/architecture/standards-architect.md +0 -153
  109. package/framework/agents/backend/dotnet-senior.md +0 -163
  110. package/framework/agents/backend/ef-modeler.md +0 -119
  111. package/framework/agents/backend/hangfire-orchestrator.md +0 -133
  112. package/framework/agents/backend/ms-agent-expert.md +0 -55
  113. package/framework/agents/backend/neon-expert.md +0 -379
  114. package/framework/agents/frontend/css-specialist.md +0 -89
  115. package/framework/agents/frontend/design-system-validator.md +0 -100
  116. package/framework/agents/frontend/gsap-animator.md +0 -131
  117. package/framework/agents/frontend/nextjs-component-validator.md +0 -97
  118. package/framework/agents/frontend/nextjs-expert.md +0 -201
  119. package/framework/agents/frontend/ui-designer.md +0 -259
  120. package/framework/agents/infrastructure/infra-architect.md +0 -215
  121. package/framework/agents/integrations/asaas-financial.md +0 -138
  122. package/framework/agents/integrations/neon-auth.md +0 -151
  123. package/framework/agents/integrations/resend-email.md +0 -127
  124. package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
  125. package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
  126. package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
  127. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
  128. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
  129. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
  130. package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
  131. package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
  132. package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
  133. package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
  134. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
  135. package/framework/hooks/shared/compact-restore.js +0 -123
  136. package/framework/hooks/shared/dispatch-helpers.js +0 -147
  137. package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
  138. package/framework/hooks/shared/stale-task-reset.js +0 -57
  139. package/framework/hooks/shared/worktree-helpers.js +0 -75
  140. package/framework/skills/level-0-meta/README.md +0 -7
  141. package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
  142. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
  143. package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
  144. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
  145. package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
  146. package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
  147. package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
  148. package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
  149. package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
  150. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
  151. package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
  152. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
  153. package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
  154. package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
  155. package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
  156. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -382
  157. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
  158. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
  159. package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
  160. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
  161. package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
  162. package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
  163. package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
  164. package/framework/skills/level-1-workflows/README.md +0 -7
  165. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
  166. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
  167. package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
  168. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
  169. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
  170. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  171. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -493
  172. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
  173. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -46
  174. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
  175. package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
  176. package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
  177. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
  178. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  179. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
  180. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
  181. package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
  182. package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
  183. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -788
  184. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
  185. package/framework/squad-templates/backend-only.json +0 -47
  186. package/framework/squad-templates/frontend-only.json +0 -56
  187. package/framework/squad-templates/full-stack.json +0 -74
  188. package/src/commands/agents/agent-metrics.js +0 -174
  189. package/src/commands/agents/audit-dispatch.js +0 -82
  190. package/src/commands/agents/detect-agents.js +0 -275
  191. package/src/commands/agents/dispatch-agents.js +0 -461
  192. package/src/commands/agents/index.js +0 -13
  193. package/src/commands/agents/manage-agents.js +0 -352
  194. package/src/commands/agents/project-metrics.js +0 -74
  195. package/src/commands/phase/phase-reset.js +0 -74
  196. package/src/commands/scope/escalate.js +0 -217
  197. package/src/commands/state/advance-phase.js +0 -600
  198. package/src/commands/state/phase-runner.js +0 -215
  199. package/src/commands/state/state.js +0 -444
  200. package/src/commands/task/expand.js +0 -100
  201. package/src/commands/tasks/index.js +0 -4
  202. package/src/commands/tasks/task.js +0 -105
  203. package/src/commands/templates/index.js +0 -5
  204. package/src/commands/templates/template-render.js +0 -93
  205. package/src/commands/trust/trust.js +0 -118
  206. package/src/lib/agents/agents-manager.js +0 -349
  207. package/src/lib/build/build-runner.js +0 -99
  208. package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
  209. package/src/lib/contracts/sprint-contract-generator.js +0 -137
  210. package/src/lib/scope/impact-analyzer.js +0 -106
  211. package/src/lib/trust/trust-manager.js +0 -157
  212. package/src/utils/tier-helpers.js +0 -24
  213. /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
@@ -1,788 +0,0 @@
1
- ---
2
- name: morph-phase-uiux
3
- description: MORPH-SPEC Phase 2 (UI/UX). Creates design-system.md, mockups.md, components.md, and flows.md using Playwright/Context7 MCPs. Use after setup for features with frontend UI components, pages, dashboards, forms, wizards, or visual interactions requiring design documentation.
4
- argument-hint: "[feature-name]"
5
- user-invocable: false
6
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.21.0"
8
- ---
9
-
10
- # MORPH UI/UX Design - Phase 2
11
-
12
- > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
-
14
- Conditional phase for features with front-end. Collects UI/UX requirements, generates wireframes, component specs, and user flows.
15
-
16
- ## Prerequisites
17
-
18
- - [ ] Proposal approved by the user
19
- - [ ] Feature has detected UI keywords (ui, component, page, dashboard, wizard, form, chart)
20
- - [ ] `ui-designer` agent activated
21
-
22
- ## Recommended Tools
23
-
24
- > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
25
- > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
26
-
27
- | Action | Tool | Alternative |
28
- |--------|------|-------------|
29
- | Check existing design system | **Read** `.morph/context/design-system.md` | — |
30
- | Read user screenshots | **Read** (image file) | — |
31
- | Search for existing CSS variables | **Grep** `--root:` in `*.css,*.scss` | — |
32
- | Find existing components | **Glob** `**/components/**/*.tsx` | — |
33
- | UI component documentation | **Context7 MCP** `query_docs({ libraryId, query })` | **WebSearch** + **WebFetch** |
34
- | Preview existing page | **Playwright MCP** `browser_navigate()` + `browser_take_screenshot()` | **WebFetch** URL |
35
- | Generate visual mockup | **Playwright MCP** `browser_navigate()` + `browser_resize()` + `browser_take_screenshot()` | HTML file + manual screenshot |
36
- | Inspect page structure | **Playwright MCP** `browser_snapshot()` | **WebFetch** + manual parse |
37
- | Test responsive layout | **Playwright MCP** `browser_resize()` + `browser_take_screenshot()` | Manual testing |
38
- | External design references | **WebSearch** + **WebFetch** | — |
39
- | Render UI templates | **Bash** `morph-spec template render docs/ui-mockups ...` | — |
40
- | Generate design system from existing CSS | **Bash** `morph-spec generate design-system --scan` | — |
41
- | Update state | **Bash** `morph-spec state mark-output ...` | — |
42
- | Auto-detect dev server | **Glob** `next.config.*`, `vite.config.*`, `*.csproj` | **Read** `package.json` scripts |
43
- | Capture existing app | **Playwright MCP** `browser_navigate()` + `browser_take_screenshot()` | — |
44
- | Read Tailwind config | **Read** `tailwind.config.{js,ts}` | **Grep** `colors:` |
45
- | Trend research | **Context7 MCP** / **WebSearch** | — |
46
- | Generate AI screen designs | **Stitch MCP** `generate_screen_from_text()` + `fetch_screen_image()` | HTML mockup + Playwright (Step 3.5) |
47
- | Export design tokens from Stitch | **Stitch MCP** `fetch_screen_code()` | Manual design-system.md creation |
48
-
49
- **MCPs for this phase:** Playwright (preview, inspection, responsiveness), Context7 (component docs), Stitch (optional: AI screen generation, design.md export).
50
-
51
- **Anti-patterns:**
52
- - Task agent to read a screenshot (use Read directly on image)
53
- - Guess component props (use Context7 for actual API)
54
-
55
- ---
56
-
57
- ## Workflow
58
-
59
- ### Step 0: Ensure uiux phase
60
-
61
- ```bash
62
- morph-spec state get $ARGUMENTS
63
- ```
64
-
65
- Check the `"phase"` field in the output:
66
-
67
- **If `"phase": "uiux"`** → correct phase, proceed.
68
-
69
- **If `"phase": "proposal"`** → execute in sequence:
70
- 1. `morph-spec state mark-output $ARGUMENTS proposal`
71
- 2. `morph-spec phase advance $ARGUMENTS` (→ uiux)
72
-
73
- **Any other value** → do not proceed — inconsistent state, report to user.
74
-
75
- > **Rule:** Never write to `1-ui/` until the phase is `uiux`. The hook will block writes.
76
-
77
- ---
78
-
79
- ### Step 0.2: Capture Existing App (Playwright)
80
-
81
- > **Purpose:** Before analyzing tokens, capture visual screenshots of the existing app to understand current design patterns.
82
- > **Skip if:** Greenfield project (no existing UI pages).
83
-
84
- #### 0.2.1 — Auto-detect dev server
85
-
86
- Check in priority order:
87
-
88
- 1. **`config.json`**: Read `.morph/config/config.json` → check for `project.devServerUrl` field → use if present
89
- 2. **`package.json` port flags**: Read `package.json` scripts → scan for `--port`, `-p` flags → extract port
90
- 3. **Next.js**: Glob `next.config.*` → try `http://localhost:3000`
91
- 4. **Vite**: Glob `vite.config.*` → try `http://localhost:5173`
92
- 5. **.NET**: Glob `**/Properties/launchSettings.json` → Read → extract `applicationUrl`
93
-
94
- Track: `detectedUrl` (string or null).
95
-
96
- #### 0.2.2 — Attempt connection
97
-
98
- If `detectedUrl` is not null:
99
-
100
- ```
101
- mcp__plugin_playwright_playwright__browser_navigate({ url: detectedUrl })
102
- ```
103
-
104
- - **Timeout:** 5 seconds
105
- - **If connects:** proceed to 0.2.3
106
- - **If fails (timeout/error):**
107
-
108
- ```json
109
- {
110
- "questions": [{
111
- "header": "Dev Server",
112
- "question": "Could not connect to dev server at {detectedUrl}. How to proceed?",
113
- "multiSelect": false,
114
- "options": [
115
- { "label": "Start server first", "description": "I'll start the dev server — wait for me" },
116
- { "label": "Use different URL", "description": "I'll provide the correct URL (Other)" },
117
- { "label": "Skip screenshots", "description": "Continue without existing app screenshots" }
118
- ]
119
- }]
120
- }
121
- ```
122
-
123
- If `detectedUrl` is null (no indicators found):
124
-
125
- ```json
126
- {
127
- "questions": [{
128
- "header": "Existing UI?",
129
- "question": "Does this project have existing UI pages I should capture?",
130
- "multiSelect": false,
131
- "options": [
132
- { "label": "Yes, provide URL", "description": "I'll provide the URL in the field below (Other)" },
133
- { "label": "No, greenfield", "description": "Skip — this is a new project" }
134
- ]
135
- }]
136
- }
137
- ```
138
-
139
- #### 0.2.3 — Screenshot main pages
140
-
141
- Once connected, take screenshots of up to 5 pages:
142
-
143
- 1. **Current page** (usually home/root)
144
- 2. Navigate to common routes: `/dashboard`, `/admin`, `/settings`, or detect from sidebar links via `browser_snapshot()`
145
- 3. For each page:
146
- ```
147
- mcp__plugin_playwright_playwright__browser_resize({ width: 1440, height: 900 })
148
- mcp__plugin_playwright_playwright__browser_take_screenshot({})
149
- ```
150
- 4. Save screenshots to `.morph/features/$ARGUMENTS/1-ui/existing-*.png`
151
-
152
- #### 0.2.4 — Visual analysis
153
-
154
- Analyze the captured screenshots and write `.morph/features/$ARGUMENTS/1-ui/existing-ui-analysis.md`:
155
-
156
- > **Note:** This is an intermediate artifact — NOT a tracked output in `output-schema.js`. It will not appear in `state mark-output`. Advisory warnings from `task-tracking-guard.js` are expected.
157
-
158
- ```markdown
159
- # Existing UI Analysis — {Feature}
160
-
161
- ## Visual Summary
162
- - **Color palette:** [dominant colors observed]
163
- - **Typography:** [serif/sans/mono, approximate weights, scale]
164
- - **Layout:** [sidebar/topbar/fullwidth, grid system, card patterns]
165
- - **Sophistication level:** [basic/intermediate/advanced]
166
- - **Dark/Light mode:** [which mode detected, or both]
167
-
168
- ## Design Tokens Detected Visually
169
- - Primary color: [approx hex from screenshots]
170
- - Background: [surface colors observed]
171
- - Border style: [rounded/sharp, thickness]
172
- - Shadow style: [flat/elevated/colored]
173
-
174
- ## Patterns Worth Preserving
175
- - [List patterns that work well and should be maintained]
176
-
177
- ## Opportunities for Improvement
178
- - [List areas where modern techniques could improve the UI]
179
- ```
180
-
181
- This analysis feeds into Step 0.5 (cross-check with extracted tokens) and Step 1.5 (domain-adaptive direction).
182
-
183
- ---
184
-
185
- ### Step 0.5: Check Design System
186
-
187
- **This step is MANDATORY and must always run before Step 1.**
188
-
189
- #### Step 0.5.1 — Scan frontend for design tokens (ALWAYS)
190
-
191
- Search for existing design tokens across ALL supported stacks. Run these scans in parallel:
192
-
193
- **A. CSS Custom Properties (all stacks):**
194
- Glob these patterns (exclude `node_modules/`, `.next/`, `dist/`, `build/`, `obj/`, `bin/`):
195
- ```
196
- wwwroot/**/*.css
197
- wwwroot/**/*.scss
198
- styles/**/*.css
199
- src/styles/**/*.css
200
- src/**/*.css
201
- src/**/*.scss
202
- src/**/*.module.css
203
- public/**/*.css
204
- app/**/*.css
205
- ```
206
- For each file found, Grep for `:root {` blocks containing `--` custom properties.
207
-
208
- **B. Tailwind Config (Next.js / Vite):**
209
- Glob: `tailwind.config.{js,ts,mjs,cjs}`
210
- If found, Read the file and extract:
211
- - `theme.colors` / `theme.extend.colors` → map to color tokens
212
- - `theme.fontFamily` → map to font tokens
213
- - `theme.spacing` → map to spacing tokens
214
- - `theme.borderRadius` → map to radius tokens
215
-
216
- **C. shadcn/ui Config:**
217
- Glob: `components.json`
218
- If found and contains `"style"` field, also scan `src/lib/utils.ts` or `lib/utils.ts` for CSS var references.
219
-
220
- **D. Global theme files:**
221
- Glob: `**/theme.{ts,js}`, `**/tokens.{ts,js}`, `**/design-tokens.{ts,js}`
222
- If found, Read and extract exported color/spacing/font objects.
223
-
224
- Classify ALL found tokens into:
225
- - **Colors**: `--color-*`, hex values, rgb()
226
- - **Fonts**: `--font-*`, `font-family:`, fontFamily config
227
- - **Spacing**: `--space-*`, `--gap-*`, spacing config
228
- - **Radius**: `--radius-*`, borderRadius config
229
- - **Shadows**: `--shadow-*`, boxShadow config
230
-
231
- Track: `tokensFound` (object by category), `tokenSources` (array of {file, stack, tokenCount}).
232
-
233
- #### Step 0.5.2 — Check if design-system.md exists
234
-
235
- ```
236
- Read: .morph/context/design-system.md
237
- ```
238
-
239
- Track: `dsExists` (bool).
240
-
241
- #### Step 0.5.3 — Decision tree (4 cases)
242
-
243
- | Case | Condition | Action |
244
- |------|-----------|--------|
245
- | **A** | `dsExists` AND `cssTokensFound` | Cross-check DS vs scanned tokens. If >2 colors diverge, flag misalignment and ask user if they want to update DS with `AskUserQuestion`. Proceed to Step 1. |
246
- | **B** | `dsExists` AND NOT `cssTokensFound` | Print: `✓ Design system found (no CSS tokens to cross-check)`. Proceed to Step 1. |
247
- | **C** | NOT `dsExists` AND tokens found | Auto-generate `.morph/context/design-system.md` from ALL scanned token sources (CSS vars, Tailwind config, etc.). Merge tokens from multiple sources, preferring Tailwind/Theme config over raw CSS. If Step 0.2 produced `existing-ui-analysis.md`, cross-reference visual analysis with extracted tokens. Proceed to Step 1. |
248
- | **D** | NOT `dsExists` AND NOT `cssTokensFound` | Greenfield project. Ask user for aesthetic direction + brand color using `AskUserQuestion` (same options as morph-init). Scaffold from template. Proceed to Step 1. |
249
- | **E** | Stitch MCP available AND `design.md` found in project root | Parse Stitch design.md, extract color/typography/spacing/radius/shadow tokens, map into `.morph/context/design-system.md` template. If `dsExists`, merge (Stitch fills gaps, manually-set tokens preserved). Add changelog entry. Proceed to Step 1. |
250
-
251
- **Case E — Stitch design.md integration:**
252
-
253
- > **Prerequisite:** Stitch MCP detected (tools matching pattern `stitch` found) OR a `design.md` file exists in the project root.
254
-
255
- 1. If Stitch MCP is available, check for existing projects:
256
- ```
257
- stitch__list_projects({})
258
- ```
259
- If projects exist, list screens and fetch the design export:
260
- ```
261
- stitch__list_screens({ projectId: selectedProjectId })
262
- stitch__fetch_screen_code({ screenId: screenId })
263
- ```
264
-
265
- 2. If `design.md` exists in project root (manual export from Stitch), read it directly.
266
-
267
- 3. Parse the design.md content and map tokens into `design-system.md` template sections:
268
- - Color values → `## Color Tokens` (map to `--color-primary`, `--color-accent`, etc.)
269
- - Font families/sizes → `## Typography` (map to `--font-display`, `--font-body`)
270
- - Spacing values → `## Spacing Tokens`
271
- - Border radius → `## Border Radius Tokens`
272
- - Shadow definitions → `## Shadow Tokens`
273
-
274
- 4. Write or merge into `.morph/context/design-system.md` using the existing template structure.
275
-
276
- 5. Add changelog entry:
277
- `- [today's date] [morph-phase-uiux] Tokens imported from Stitch design.md ({N} tokens)`
278
-
279
- Print: `✓ Design system populated from Stitch design — .morph/context/design-system.md`
280
-
281
- **Case C — auto-generate from scanned tokens:**
282
-
283
- Create `.morph/context/design-system.md` with these sections populated from scan results:
284
- - `## Color Tokens` → `:root { }` block with all found color variables (preserve exact variable names)
285
- - `## Typography` → found font-family values (map by variable name heuristic: `--font-display` vs `--font-body`)
286
- - `## Spacing Tokens` → found spacing variables
287
- - `## Aesthetic Direction` → `#TODO` (requires user judgment, fill in manually)
288
- - `## Changelog` → `- [today's date] [morph-phase-uiux] Auto-generated from CSS scan ([N] tokens from [files])`
289
-
290
- Print: `✓ Design system generated from [N] tokens — .morph/context/design-system.md`
291
-
292
- > **Design system is mandatory** for UI features. The implementation gate (Phase 7) will block if no design system exists.
293
-
294
- ## MANDATORY: Session Tasks
295
-
296
- > **BEFORE starting UI/UX work**, analyze the workflow below and create session tasks.
297
- >
298
- > **Rules:** Minimum 3 tasks, typically 5-7. Mark `in_progress` before starting, `completed` after.
299
- >
300
- > **Typical tasks:** design system check, user input collection, UI library selection, visual mockup, deliverable generation, accessibility validation, approval
301
-
302
- ### Step 1: Detect If Phase Is Needed
303
-
304
- Check if active agents include `ui-designer`:
305
-
306
- ```bash
307
- morph-spec state get $ARGUMENTS
308
- ```
309
-
310
- If `ui-designer` is NOT in `activeAgents`, skip this phase and continue to Phase 3 (Design).
311
-
312
- ### Step 1.3: Trend Research
313
-
314
- > **Purpose:** Before defining aesthetic direction, research current design trends relevant to this project's domain.
315
- > Use Context7 MCP or web search for current design trends.
316
-
317
- #### 1.3.1 — Research current trends
318
-
319
- > **MCP:** Use **WebSearch** to research current design trends for the detected domain (e.g., "{currentYear} UI design trends {detectedDomain}"). WebSearch provides real-time results that are more current than any static reference. If WebSearch is not available, use **Context7 MCP** to query UI library documentation for latest component patterns and best practices. If neither is available, rely on your training knowledge of current design trends.
320
-
321
- Research current design trends relevant to the project's domain and stack. Identify 3-5 techniques that fit the project.
322
-
323
- #### 1.3.2 — Detect project domain
324
-
325
- Scan `.morph/features/$ARGUMENTS/0-proposal/proposal.md` for domain keywords:
326
-
327
- | Domain | Keywords |
328
- |--------|----------|
329
- | SaaS Dashboard | dashboard, analytics, metrics, monitoring, kpi, chart |
330
- | E-commerce | e-commerce, store, product, cart, checkout, catalog |
331
- | Landing Page | landing, marketing, site, hero, launch, waitlist |
332
- | Internal Tool | admin, backoffice, internal, settings, management |
333
- | Social/Community | social, feed, community, chat, post, notification |
334
-
335
- Count keyword hits per domain. Use the domain with most hits. If zero hits across all domains, skip domain-specific filtering.
336
-
337
- #### 1.3.3 — Research current trends (optional enhancement)
338
-
339
- If Context7 MCP or WebSearch is available:
340
- - Search: "{currentYear} UI design trends {detectedDomain}"
341
- - Extract 2-3 additional techniques not in the curated catalog
342
- - Evaluate if they are production-ready (browser support, performance)
343
-
344
- #### 1.3.4 — Present recommendations
345
-
346
- Use `AskUserQuestion` to present 3-4 recommended modern techniques:
347
-
348
- ```json
349
- {
350
- "questions": [{
351
- "header": "Trends",
352
- "question": "Based on your project domain ({detectedDomain}), these modern techniques are recommended. Which ones do you want to incorporate?",
353
- "multiSelect": true,
354
- "options": [
355
- { "label": "{Technique 1}", "description": "{Brief description + when to use}" },
356
- { "label": "{Technique 2}", "description": "{Brief description + when to use}" },
357
- { "label": "{Technique 3}", "description": "{Brief description + when to use}" },
358
- { "label": "None / custom", "description": "Skip trends or describe your own preference (Other)" }
359
- ]
360
- }]
361
- }
362
- ```
363
-
364
- Selected trends feed into Step 1.5 (Aesthetic Direction) and Step 4 (Deliverables).
365
-
366
- ---
367
-
368
- ### Step 1.5: Design Thinking — Aesthetic Direction
369
-
370
- **BEFORE collecting technical requirements**, define visual direction with 4 questions:
371
-
372
- 1. **Purpose**: What problem does it solve? Who uses it? What is the professional context?
373
- 2. **Tone**: What direction? (Minimal Refined / Editorial / Soft Professional / Industrial / Modern Luxury)
374
- 3. **Differentiation**: What is the 1 memorable element of this interface?
375
- 4. **Constraints**: Framework, performance budget, existing brand guidelines
376
-
377
- **CRITICAL:** Commit to direction BEFORE technical specs. Document in `design-system.md`
378
- in section `## Aesthetic Direction` (template available in the standard above).
379
-
380
- #### Domain-Adaptive Patterns
381
-
382
- After defining aesthetic direction, apply domain-specific pattern suggestions:
383
-
384
- Based on the domain detected in Step 1.3.2, suggest domain-adaptive patterns:
385
-
386
- | Domain | Preferred Directions | Key Patterns to Suggest |
387
- |--------|---------------------|------------------------|
388
- | SaaS Dashboard | Industrial, Minimal Refined | Dense bento grid KPIs, skeleton loaders, sidebar glassmorphism, dark mode default |
389
- | E-commerce | Modern Luxury, Soft Professional | Product card hover lift, CTA colored shadows, image-first layouts, scroll galleries |
390
- | Landing Page | Editorial, Modern Luxury | Hero aurora gradient, scroll-driven narrative, fluid typography, overlapping layers |
391
- | Internal Tool | Industrial, Minimal Refined | Compact forms, dense tables, status chips, monospace data displays |
392
- | Social/Community | Soft Professional, Editorial | Card feed, notification badges, avatar systems, drawer navigation |
393
-
394
- If the user's chosen direction conflicts with domain recommendations (e.g., Industrial for E-commerce), present an `AskUserQuestion` advisory:
395
-
396
- ```json
397
- {
398
- "questions": [{
399
- "header": "Direction",
400
- "question": "You chose {direction} for a {domain} project. The recommended directions are {recommended}. Keep your choice or adapt?",
401
- "multiSelect": false,
402
- "options": [
403
- { "label": "Keep {direction}", "description": "I have specific reasons for this choice" },
404
- { "label": "Switch to {recommended[0]}", "description": "{Brief rationale}" }
405
- ]
406
- }]
407
- }
408
- ```
409
-
410
- #### Integration with Selected Trends
411
-
412
- Incorporate the trends selected in Step 1.3.4 into the aesthetic direction documentation:
413
-
414
- - Add selected trends to `## Aesthetic Direction` in `design-system.md`
415
- - Document how each trend maps to the chosen direction
416
-
417
- **Anti-patterns to avoid:**
418
- - Purple gradient on white background (AI cliche)
419
- - Inter/Roboto as display font
420
- - 3-column card grid without visual differentiation
421
- - 5-color palette with equal weight (without dominant + accent)
422
-
423
- ### Step 2: Collect User Input
424
-
425
- **ALWAYS ask the user FIRST:**
426
-
427
- 1. **Layout and style**:
428
- - Do you have any layout ideas in mind?
429
- - Do you have visual references? (sites, apps, screenshots)
430
- - How do you envision the user flow?
431
-
432
- 2. **Components and interactions**:
433
- - What are the main components of this screen/page?
434
- - What states need to be considered? (loading, error, empty, success)
435
-
436
- 3. **Reference images**:
437
- - Do you have example images I can analyze?
438
- - If YES: use Read tool to read screenshots and extract patterns
439
-
440
- ### Step 3: Choose UI Library
441
-
442
- Detect the stack from `.morph/config/config.json` and recommend the appropriate library:
443
-
444
- **Next.js stack:**
445
- - **shadcn/ui + Radix** (recommended) — composable primitives, full control, Tailwind-native
446
- - **MUI** — feature-rich, enterprise-grade, material design
447
-
448
- **Document the decision as an ADR in `decisions.md`** with: context, options considered, decision, and rationale.
449
-
450
- > **MCP:** After selecting the UI library, use **Context7 MCP** (`resolve-library-id` → `query-docs`) to fetch the library's latest component API (e.g., shadcn/ui primitives, Radix props, MUI component APIs). This ensures component specs in `components.md` reference real, current props — not outdated or hallucinated ones. If Context7 is not available, use **WebSearch** + **WebFetch** to check the official component documentation.
451
-
452
- ### Step 3.5: Visual Mockup (Playwright MCP or Stitch MCP)
453
-
454
- > **Purpose:** Generate a real visual preview using project design tokens before writing formal specs.
455
- > Seeing the actual visual before committing to components prevents misaligned specs.
456
-
457
- #### 3.5.0 — Stitch MCP Path (Alternative to HTML Mockup)
458
-
459
- > **Skip if:** Stitch MCP is NOT available. Fall through to 3.5.1 (HTML mockup).
460
- > **Use when:** Stitch MCP is detected and user wants AI-generated screen designs.
461
-
462
- If Stitch MCP is available, present the user with a choice:
463
-
464
- ```json
465
- {
466
- "questions": [{
467
- "header": "Design Tool",
468
- "question": "Stitch MCP is available for AI-generated screen designs. How would you like to create visual mockups?",
469
- "multiSelect": false,
470
- "options": [
471
- { "label": "Use Stitch", "description": "Generate screens via Google Stitch AI — higher fidelity, exportable design.md" },
472
- { "label": "Use HTML mockup", "description": "Generate HTML file + Playwright screenshots — current default workflow" }
473
- ]
474
- }]
475
- }
476
- ```
477
-
478
- **If "Use Stitch" selected:**
479
-
480
- 1. **Create or select project:**
481
- ```
482
- stitch__create_project({ name: "{feature-name}-design" })
483
- ```
484
- Or if project already exists (from Case E in Step 0.5.3), reuse it.
485
-
486
- 2. **Generate screens from design brief:**
487
- Build a prompt from the aesthetic direction (Step 1.5), selected trends (Step 1.3), and user input (Step 2):
488
- ```
489
- stitch__generate_screen_from_text({
490
- projectId: projectId,
491
- prompt: "Create a {detectedDomain} screen with {aestheticDirection} direction. Colors: {primaryColor}, {accentColor}. Font: {fontPair}. Layout: {layoutDescription}. Features: {componentList}"
492
- })
493
- ```
494
-
495
- 3. **Fetch screen images for review:**
496
- ```
497
- stitch__list_screens({ projectId: projectId })
498
- stitch__fetch_screen_image({ screenId: screenId })
499
- ```
500
- Save images to `.morph/features/$ARGUMENTS/1-ui/stitch-screen-*.png`
501
-
502
- 4. **Present to user for feedback** (same approval loop as 3.5.3):
503
- - Show Stitch-generated screen images
504
- - Ask: "Does this visual direction match your intent?"
505
- - Iterate: regenerate via `generate_screen_from_text` with refined prompts
506
-
507
- 5. **Export design tokens:**
508
- ```
509
- stitch__fetch_screen_code({ screenId: approvedScreenId })
510
- ```
511
- Parse the design.md export and update `.morph/context/design-system.md` with any new or refined tokens.
512
-
513
- 6. **Skip to Step 4** — Stitch screens replace the HTML mockup. `mockups.md` still documents states and interactions textually.
514
-
515
- > **Key advantage:** Unlike screenshots, the Stitch MCP transmits real HTML/CSS code via `fetch_screen_code()`.
516
- > This produces dramatically higher fidelity results than screenshot-based workflows because Claude Code
517
- > receives the actual component structure, CSS properties, and design tokens — not pixel approximations.
518
- > Use `react-components` or `shadcn-ui` companion skills to convert Stitch HTML into production React components.
519
-
520
- **If "Use HTML mockup" selected:**
521
- → Proceed to 3.5.1 (existing workflow, unchanged)
522
-
523
- ---
524
-
525
- #### 3.5.1 — Generate HTML Mockup
526
-
527
- Create an HTML file that represents the main screen/layout using **real tokens from `.morph/context/design-system.md`**:
528
-
529
- **Rules for the HTML:**
530
- - `<style>` block must have `:root { }` with real values from design-system.md (not Tailwind colors)
531
- - Tailwind CDN only for layout utilities (flex, grid, padding) — NOT for colors or typography
532
- - Represents real layout hierarchy and visual weight — not ASCII
533
- - Include representative content (realistic text, placeholder images)
534
- - All colors via CSS variables: `color: var(--color-primary)` not `color: #3b82f6`
535
-
536
- **Save to:** `.morph/features/$ARGUMENTS/1-ui/mockup.html`
537
-
538
- Example structure:
539
- ```html
540
- <!DOCTYPE html>
541
- <html lang="en">
542
- <head>
543
- <meta charset="UTF-8">
544
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
545
- <title>[Feature] Mockup</title>
546
- <link rel="preconnect" href="https://fonts.googleapis.com">
547
- <!-- Load fonts from design-system.md font pair -->
548
- <script src="https://cdn.tailwindcss.com"></script>
549
- <style>
550
- /* Real tokens from .morph/context/design-system.md */
551
- :root {
552
- --color-primary: [value from design-system.md];
553
- --color-accent: [value from design-system.md];
554
- --color-surface: [value from design-system.md];
555
- --color-text-primary: [value from design-system.md];
556
- --color-text-secondary: [value from design-system.md];
557
- --font-display: [value from design-system.md];
558
- --font-body: [value from design-system.md];
559
- /* ... add all relevant tokens ... */
560
- }
561
- body {
562
- font-family: var(--font-body);
563
- background-color: var(--color-surface);
564
- color: var(--color-text-primary);
565
- }
566
- h1, h2, h3 { font-family: var(--font-display); }
567
- </style>
568
- </head>
569
- <body>
570
- <!-- Layout representing the feature's main screen -->
571
- </body>
572
- </html>
573
- ```
574
-
575
- #### 3.5.2 — Screenshot at 3 Breakpoints
576
-
577
- **Navigate to the file:**
578
- ```
579
- mcp__plugin_playwright_playwright__browser_navigate({ url: "file:///[ABSOLUTE_PATH_TO].morph/features/$ARGUMENTS/1-ui/mockup.html" })
580
- ```
581
-
582
- **Take screenshots at 3 breakpoints** (resize then screenshot for each):
583
-
584
- **Mobile (375px):**
585
- ```
586
- mcp__plugin_playwright_playwright__browser_resize({ width: 375, height: 812 })
587
- mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/1-ui/mockup-mobile.png
588
- ```
589
-
590
- **Tablet (768px):**
591
- ```
592
- mcp__plugin_playwright_playwright__browser_resize({ width: 768, height: 1024 })
593
- mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/1-ui/mockup-tablet.png
594
- ```
595
-
596
- **Desktop (1440px):**
597
- ```
598
- mcp__plugin_playwright_playwright__browser_resize({ width: 1440, height: 900 })
599
- mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/1-ui/mockup-desktop.png
600
- ```
601
-
602
- #### 3.5.3 — Present and Iterate
603
-
604
- 1. **Show all 3 screenshots to the user**
605
- 2. Ask for feedback:
606
- - "Does this visual direction match your intent?"
607
- - "Any layout, color, or typography adjustments?"
608
- 3. **Iterate:** Refine `mockup.html` → re-take screenshots → show updated previews
609
- 4. **Continue only when user approves** this visual direction
610
-
611
- > **Note:** `mockups.md` (Step 4.2) continues to exist as the reference for states and interactions.
612
- > The PNGs are the visual reference; the .md covers behavior and edge cases.
613
-
614
- ---
615
-
616
- ### Step 4: Generate Deliverables
617
-
618
- Create the following files in `.morph/features/$ARGUMENTS/`:
619
-
620
- > **Use templates:** Use `morph-spec template render` to generate files from templates in `.morph/framework/templates/docs/`. Available templates: `ui-design-system`, `ui-mockups`, `ui-components`, `ui-flows`.
621
-
622
- #### 4.1. `design-system.md`
623
-
624
- **If project-level design system exists (`.morph/context/design-system.md`):**
625
- - Reference it in specs: "Uses project design system at .morph/context/design-system.md"
626
- - Create `design-system.md` only if there are feature-specific colors/components
627
-
628
- **If it doesn't exist:**
629
- - Create complete feature-level design system with:
630
- - **Section `## Aesthetic Direction`**:
631
- direction, font pair, color philosophy, motion intent, composition approach
632
- - Color palette (primary, secondary, accent, semantic)
633
- - Typography (heading scales, body text, code)
634
- - Spacing and layout (grid, margins, paddings)
635
- - Base components (buttons, inputs, cards)
636
-
637
- **If Stitch was used (Step 3.5.0):**
638
- - Derive `design-system.md` primarily from Stitch's exported design.md
639
- - Map Stitch tokens into existing template sections (Color Tokens, Typography, Spacing, etc.)
640
- - Cross-reference with tokens from Step 0.5 — preserve manually-set tokens, let Stitch values fill gaps
641
- - Add to `## Aesthetic Direction`: "Visual direction generated via Google Stitch (project: {projectName})"
642
- - Ensure all CSS custom properties use the standard `--color-*`, `--font-*`, `--space-*` naming convention
643
-
644
- #### 4.2. `mockups.md`
645
-
646
- ASCII wireframes + descriptions:
647
- - General layout of each screen/page
648
- - Component positioning
649
- - Responsiveness (desktop, tablet, mobile)
650
- - States (loading, error, empty, success)
651
-
652
- #### 4.3. `components.md`
653
-
654
- Technical specs for UI library components:
655
- - Component to use (Button, DataTable, etc.)
656
- - Props and configurations
657
- - Events and bindings
658
- - Validations and states
659
-
660
- #### 4.4. `flows.md`
661
-
662
- Complete user flows:
663
- - User stories
664
- - Flow diagrams (text/ASCII)
665
- - Edge cases (what happens if...?)
666
- - Validations and feedback
667
-
668
- ### CHECKPOINT: Validate UI Deliverables
669
-
670
- **PAUSE - Before proceeding to accessibility:**
671
-
672
- - [ ] Aesthetic direction defined and documented in `design-system.md`?
673
- - [ ] Font pair specified (not just Inter/Roboto for display)?
674
- - [ ] Color philosophy: dominant + accent + rationale documented?
675
- - [ ] Design system defined (project-level or feature-level)?
676
- - [ ] Wireframes cover all states (loading, error, empty, success)?
677
- - [ ] Components specified with actual props from chosen UI library?
678
- - [ ] Complete user flows with edge cases?
679
- - [ ] Chosen UI library documented as ADR in `decisions.md`?
680
-
681
- **If any checkbox is NOT checked:**
682
- → Go back and complete the missing deliverable
683
-
684
- **If ALL checkboxes are checked:**
685
- → Proceed to accessibility validation
686
-
687
- ---
688
-
689
- ### Step 5: Validate Accessibility and Responsiveness
690
-
691
- Document in UI files:
692
- - **WCAG 2.1 Level AA** compliance
693
- - Adequate color contrast
694
- - Accessible labels for screen readers
695
- - Keyboard navigation
696
- - **Responsive breakpoints**
697
- - Desktop (>1200px)
698
- - Tablet (768px - 1199px)
699
- - Mobile (<768px)
700
-
701
- ### Step 6: Update State
702
-
703
- ```bash
704
- morph-spec state mark-output $ARGUMENTS ui-design-system
705
- morph-spec state mark-output $ARGUMENTS ui-mockups
706
- morph-spec state mark-output $ARGUMENTS ui-components
707
- morph-spec state mark-output $ARGUMENTS ui-flows
708
- ```
709
-
710
- > **Format note:** The `mark-output` commands accept BOTH kebab-case (`ui-design-system`)
711
- > AND camelCase (`uiDesignSystem`). Both formats work equally! Use whichever is more
712
- > comfortable for you. Examples:
713
- > - `morph-spec state mark-output my-feature uiDesignSystem`
714
- > - `morph-spec state mark-output my-feature ui-design-system`
715
-
716
- ## Generated Outputs
717
-
718
- - `.morph/features/$ARGUMENTS/1-ui/design-system.md`
719
- - `.morph/features/$ARGUMENTS/1-ui/mockups.md`
720
- - `.morph/features/$ARGUMENTS/1-ui/components.md`
721
- - `.morph/features/$ARGUMENTS/1-ui/flows.md`
722
- - `.morph/features/$ARGUMENTS/2-design/decisions.md` (updated with UI library ADR)
723
-
724
- ### Step 7: Validate Design with Frontend Review
725
-
726
- After generating all 4 UI outputs and updating state (Step 6):
727
-
728
- ```bash
729
- /frontend-review $ARGUMENTS
730
- ```
731
-
732
- The skill validates: WCAG token contrast, existence of all outputs, static design accessibility, and generates mockup screenshots if dev server is available.
733
-
734
- **If frontend-review blocks**, fix issues before presenting to user.
735
-
736
- ---
737
-
738
- ## MANDATORY PAUSE
739
-
740
- Use `AskUserQuestion` to capture explicit approval before advancing:
741
-
742
- ```json
743
- {
744
- "questions": [{
745
- "header": "Approval",
746
- "question": "UI/UX generated. Approve to advance to technical design?",
747
- "multiSelect": false,
748
- "options": [
749
- { "label": "Approve UI/UX", "description": "Advance to technical design phase" },
750
- { "label": "I have feedback", "description": "Type what you want to adjust in the field below (Other)" }
751
- ]
752
- }]
753
- }
754
- ```
755
-
756
- - **"Approve UI/UX"** →
757
- ```bash
758
- morph-spec approve $ARGUMENTS uiux
759
- morph-spec phase advance $ARGUMENTS
760
- ```
761
- - **"I have feedback" or "Other"** → apply the received feedback and repeat this PAUSE
762
-
763
- ## Advancement Criteria
764
-
765
- - [x] User input collected (layout, references)
766
- - [x] UI library chosen and justified (ADR)
767
- - [x] 4 deliverables created (design-system, mockups, components, flows)
768
- - [x] WCAG 2.1 accessibility documented
769
- - [x] Responsiveness specified
770
- - [x] State updated
771
- - [x] User approved UI/UX
772
-
773
- ---
774
-
775
- ## Phase Outputs
776
-
777
- <!-- morph-outputs:uiux -->
778
- | Output | Caminho |
779
- |--------|---------|
780
- | `uiDesignSystem` | `.morph/features/{feature}/1-ui/design-system.md` |
781
- | `uiMockups` | `.morph/features/{feature}/1-ui/mockups.md` |
782
- | `uiComponents` | `.morph/features/{feature}/1-ui/components.md` |
783
- | `uiFlows` | `.morph/features/{feature}/1-ui/flows.md` |
784
- <!-- /morph-outputs -->
785
-
786
- ---
787
-
788
- Continue automatically to Phase 3 (Design) after approval.