@polymorphism-tech/morph-spec 4.10.7 → 4.10.9

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 (123) hide show
  1. package/CLAUDE.md +3 -3
  2. package/LICENSE +71 -71
  3. package/README.md +379 -379
  4. package/bin/morph-spec.js +1 -1
  5. package/claude-plugin.json +14 -14
  6. package/docs/CHEATSHEET.md +1 -1
  7. package/docs/QUICKSTART.md +206 -206
  8. package/framework/agents/README.md +14 -14
  9. package/framework/agents/architecture/standards-architect.md +159 -159
  10. package/framework/agents/frontend/blazor-builder.md +13 -0
  11. package/framework/agents/frontend/css-specialist.md +87 -0
  12. package/framework/agents/frontend/nextjs-expert.md +13 -0
  13. package/framework/agents/frontend/nextjs-ui-specialist.md +218 -0
  14. package/framework/agents/frontend/ui-ux-designer.md +80 -10
  15. package/framework/agents/infrastructure/azure-architect.md +149 -149
  16. package/framework/agents/infrastructure/infra-architect.md +48 -48
  17. package/framework/agents.json +2268 -2204
  18. package/framework/hooks/README.md +204 -204
  19. package/framework/hooks/claude-code/session-start/inject-morph-context.js +10 -24
  20. package/framework/hooks/shared/phase-utils.js +139 -139
  21. package/framework/hooks/shared/worktree-helpers.js +30 -8
  22. package/framework/rules/csharp-standards.md +13 -13
  23. package/framework/rules/frontend-standards.md +13 -13
  24. package/framework/rules/infrastructure-standards.md +16 -16
  25. package/framework/rules/testing-standards.md +14 -14
  26. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +12 -0
  27. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +254 -254
  28. package/framework/skills/level-0-meta/morph-init/SKILL.md +136 -3
  29. package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +247 -247
  30. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +270 -270
  31. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +515 -499
  32. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +508 -500
  33. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +12 -1
  34. package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +272 -262
  35. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +317 -311
  36. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +457 -323
  37. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
  38. package/framework/standards/STANDARDS.json +2040 -2040
  39. package/framework/standards/frontend/nextjs/motion-patterns.md +321 -0
  40. package/framework/standards/frontend/nextjs/nextjs-patterns.md +17 -17
  41. package/framework/templates/README.md +814 -814
  42. package/framework/templates/code/dotnet/contracts/Commands.cs +74 -74
  43. package/framework/templates/code/dotnet/contracts/Entities.cs +25 -25
  44. package/framework/templates/code/dotnet/contracts/Queries.cs +74 -74
  45. package/framework/templates/code/dotnet/contracts/README.md +74 -74
  46. package/framework/templates/code/dotnet/contracts/api-contracts.cs +173 -173
  47. package/framework/templates/code/dotnet/frontend/component.razor +239 -239
  48. package/framework/templates/code/dotnet/jobs/agent.cs +163 -163
  49. package/framework/templates/code/dotnet/jobs/job.cs +171 -171
  50. package/framework/templates/code/dotnet/test.cs +239 -239
  51. package/framework/templates/code/sql/rls-policy.sql +57 -57
  52. package/framework/templates/code/sql/supabase-migration.sql +100 -100
  53. package/framework/templates/code/sql/supabase-migration.template.sql +113 -113
  54. package/framework/templates/code/typescript/contracts.ts +168 -168
  55. package/framework/templates/context/CONTEXT.md +181 -181
  56. package/framework/templates/context/design-system.md +211 -0
  57. package/framework/templates/docs/proposal.md +182 -182
  58. package/framework/templates/docs/user-stories.md +34 -34
  59. package/framework/templates/examples/design-system-examples.md +357 -357
  60. package/framework/templates/examples/spec-examples.md +90 -90
  61. package/framework/templates/feature/decisions.md +187 -187
  62. package/framework/templates/feature/recap.md +146 -146
  63. package/framework/templates/feature/tasks.md +199 -199
  64. package/framework/templates/infrastructure/azure/README.md +286 -286
  65. package/framework/templates/infrastructure/azure/deploy-checklist.md +426 -426
  66. package/framework/templates/infrastructure/azure/parameters.dev.json +29 -29
  67. package/framework/templates/infrastructure/azure/parameters.prod.json +29 -29
  68. package/framework/templates/infrastructure/azure/parameters.staging.json +29 -29
  69. package/framework/templates/infrastructure/docker/docker-compose.template.yml +67 -67
  70. package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -38
  71. package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -48
  72. package/framework/templates/infrastructure/docker/easypanel.template.json +54 -54
  73. package/package.json +82 -82
  74. package/src/commands/agents/index.js +13 -13
  75. package/src/commands/project/install-plugin-cmd.js +28 -28
  76. package/src/commands/project/setup-infra-cmd.js +12 -12
  77. package/src/commands/project/worktree.js +58 -2
  78. package/src/commands/tasks/index.js +4 -4
  79. package/src/commands/templates/index.js +5 -5
  80. package/src/commands/utils/index.js +3 -3
  81. package/src/commands/validation/index.js +4 -4
  82. package/src/core/state/phase-state-machine.js +217 -217
  83. package/src/lib/detectors/design-system-detector.js +73 -31
  84. package/src/lib/generators/design-system-generator.js +298 -298
  85. package/src/lib/generators/index.js +10 -10
  86. package/src/lib/generators/metadata-extractor.js +387 -387
  87. package/src/lib/stack-filter.js +65 -65
  88. package/src/lib/standards/index.js +7 -7
  89. package/src/lib/standards/standards-context-injector.js +302 -302
  90. package/src/lib/validators/architecture/architecture-validator.js +387 -387
  91. package/src/lib/validators/architecture/index.js +7 -7
  92. package/src/lib/validators/blazor/blazor-concurrency-analyzer.js +316 -316
  93. package/src/lib/validators/blazor/blazor-state-validator.js +279 -279
  94. package/src/lib/validators/blazor/blazor-validator.js +369 -369
  95. package/src/lib/validators/blazor/index.js +9 -9
  96. package/src/lib/validators/content/content-validator.js +287 -287
  97. package/src/lib/validators/content/index.js +7 -7
  98. package/src/lib/validators/contracts/index.js +7 -7
  99. package/src/lib/validators/css/css-validator.js +352 -352
  100. package/src/lib/validators/css/index.js +7 -7
  101. package/src/lib/validators/design-system/design-system-validator.js +231 -231
  102. package/src/lib/validators/design-system/index.js +7 -7
  103. package/src/lib/validators/nextjs/index.js +6 -6
  104. package/src/lib/validators/nextjs/next-component-validator.js +183 -183
  105. package/src/lib/validators/packages/index.js +7 -7
  106. package/src/lib/validators/packages/package-validator.js +360 -360
  107. package/src/lib/validators/shared/index.js +12 -12
  108. package/src/lib/validators/shared/issue-counter.js +18 -18
  109. package/src/lib/validators/shared/result-formatter.js +124 -124
  110. package/src/lib/validators/ui/index.js +7 -7
  111. package/src/lib/validators/ui/ui-contrast-validator.js +422 -422
  112. package/src/scripts/global-install.js +58 -58
  113. package/src/scripts/install-plugin.js +126 -126
  114. package/src/utils/claude-md-injector.js +90 -90
  115. package/src/utils/file-copier.js +200 -196
  116. package/src/utils/hooks-installer.js +556 -494
  117. package/src/utils/logger.js +32 -32
  118. package/src/utils/skills-installer.js +178 -178
  119. package/src/utils/version-checker.js +175 -175
  120. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  121. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  122. package/framework/templates/.idea/morph-templates.xml +0 -92
  123. package/framework/templates/.vscode/morph-templates.code-snippets +0 -186
@@ -1,324 +1,458 @@
1
- ---
2
- name: morph-phase-uiux
3
- description: MORPH-SPEC Phase 1.5 (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.10.7"
8
- ---
9
-
10
- # MORPH UI/UX Design - Phase 1.5
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
- - [ ] Phase 1 (Setup) completed
19
- - [ ] Feature has detected UI keywords (blazor, ui, component, page, dashboard, wizard, form, chart)
20
- - [ ] `uiux-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/**/*.razor` or `**/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
- | Inspect page structure | **Playwright MCP** `browser_snapshot()` | **WebFetch** + manual parse |
36
- | Test responsive layout | **Playwright MCP** `browser_resize()` + `browser_take_screenshot()` | Manual testing |
37
- | External design references | **WebSearch** + **WebFetch** | — |
38
- | Render UI templates | **Bash** `npx morph-spec template render docs/ui-mockups ...` | — |
39
- | Generate design system from existing CSS | **Bash** `npx morph-spec generate design-system --scan` | — |
40
- | Update state | **Bash** `npx morph-spec state mark-output ...` | — |
41
-
42
- **MCPs for this phase:** Playwright (preview, inspection, responsiveness), Context7 (component docs).
43
-
44
- **Anti-patterns:**
45
- - WebSearch for MudBlazor docs (use Context7 MCP — more precise)
46
- - Task agent to read a screenshot (use Read directly on image)
47
- - Guess component props (use Context7 for actual API)
48
-
49
- ---
50
-
51
- ## Workflow
52
-
53
- ### Step 0: Ensure uiux phase
54
-
55
- ```bash
56
- npx morph-spec state get $ARGUMENTS
57
- ```
58
-
59
- Check the `"phase"` field in the output:
60
-
61
- **If `"phase": "uiux"`** → correct phase, proceed.
62
-
63
- **If `"phase": "setup"`** → execute:
64
- 1. `npx morph-spec phase advance $ARGUMENTS` (→ uiux)
65
-
66
- **Any other value** → do not proceed — inconsistent state, report to user.
67
-
68
- > **Rule:** Never write to `2-ui/` until the phase is `uiux`. The hook will block writes.
69
-
70
- ---
71
-
72
- ### Step 0.5: Check Design System Exists
73
-
74
- **CRITICAL:** Before starting UI/UX phase, check if a design system exists:
75
-
76
- ```
77
- Read: .morph/context/design-system.md
78
- ```
79
-
80
- If the file doesn't exist (design system not found):
81
-
82
- 1. **Option A - Automatic scaffold:**
83
- - The system will automatically create a design system when advancing to implementation
84
- - You can generate manually now: `npx morph-spec generate design-system`
85
-
86
- 2. **Option B - Create manually:**
87
- - Create `.morph/context/design-system.md` (project-level, shared)
88
- - Or `.morph/features/$ARGUMENTS/2-ui/design-system.md` (feature-specific)
89
-
90
- 3. **Option C - Scan existing CSS:**
91
- - If the project already has CSS with variables: `npx morph-spec generate design-system --scan`
92
-
93
- **IMPORTANT:**
94
- - Design system is **mandatory** for UI features
95
- - Automatic gate will block implementation (Phase 5) if design system doesn't exist
96
- - Better to create now to ensure visual consistency
97
-
98
- ### Step 1: Detect If Phase Is Needed
99
-
100
- Check if active agents include `uiux-designer`:
101
-
102
- ```bash
103
- npx morph-spec state get $ARGUMENTS
104
- ```
105
-
106
- If `uiux-designer` is NOT in `activeAgents`, skip this phase and continue to Phase 2 (Design).
107
-
108
- ### Step 1.5: Design Thinking — Aesthetic Direction
109
-
110
- > **Ref:** `framework/standards/frontend/design-system/aesthetic-direction.md`
111
-
112
- **BEFORE collecting technical requirements**, define visual direction with 4 questions:
113
-
114
- 1. **Purpose**: What problem does it solve? Who uses it? What is the professional context?
115
- 2. **Tone**: What direction? (Minimal Refined / Editorial / Soft Professional / Industrial / Modern Luxury)
116
- 3. **Differentiation**: What is the 1 memorable element of this interface?
117
- 4. **Constraints**: Framework, performance budget, existing brand guidelines
118
-
119
- **CRITICAL:** Commit to direction BEFORE technical specs. Document in `ui-design-system.md`
120
- in section `## Aesthetic Direction` (template available in the standard above).
121
-
122
- **Anti-patterns to avoid:**
123
- - Purple gradient on white background (AI cliche)
124
- - Inter/Roboto as display font
125
- - 3-column card grid without visual differentiation
126
- - 5-color palette with equal weight (without dominant + accent)
127
-
128
- ### Step 2: Collect User Input
129
-
130
- **ALWAYS ask the user FIRST:**
131
-
132
- 1. **Layout and style**:
133
- - Do you have any layout ideas in mind?
134
- - Do you have visual references? (sites, apps, screenshots)
135
- - How do you envision the user flow?
136
-
137
- 2. **Components and interactions**:
138
- - What are the main components of this screen/page?
139
- - What states need to be considered? (loading, error, empty, success)
140
-
141
- 3. **Reference images**:
142
- - Do you have example images I can analyze?
143
- - If YES: use Read tool to read screenshots and extract patterns
144
-
145
- ### Step 3: Choose UI Library
146
-
147
- Detect the stack from `.morph/config/config.json` and recommend the appropriate library:
148
-
149
- **Blazor stack:**
150
- - **Fluent UI Blazor** — dashboards, simple forms, AI components, Microsoft design language
151
- - **MudBlazor** — advanced data grids, complex charts, material design
152
-
153
- **Next.js stack:**
154
- - **shadcn/ui + Radix** (recommended) — composable primitives, full control, Tailwind-native
155
- - **MUI** — feature-rich, enterprise-grade, material design
156
-
157
- **Document the decision as an ADR in `decisions.md`** with: context, options considered, decision, and rationale.
158
-
159
- ### Step 4: Generate Deliverables
160
-
161
- Create the following files in `.morph/features/$ARGUMENTS/`:
162
-
163
- > **Use templates:** Use `npx 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`.
164
-
165
- #### 4.1. `ui-design-system.md`
166
-
167
- **If project-level design system exists (`.morph/context/design-system.md`):**
168
- - Reference it in specs: "Uses project design system at .morph/context/design-system.md"
169
- - Create `ui-design-system.md` only if there are feature-specific colors/components
170
-
171
- **If it doesn't exist:**
172
- - Create complete feature-level design system with:
173
- - **Section `## Aesthetic Direction`** (use template from `aesthetic-direction.md`):
174
- direction, font pair, color philosophy, motion intent, composition approach
175
- - Color palette (primary, secondary, accent, semantic)
176
- - Typography (heading scales, body text, code)
177
- - Spacing and layout (grid, margins, paddings)
178
- - Base components (buttons, inputs, cards)
179
-
180
- #### 4.2. `ui-mockups.md`
181
-
182
- ASCII wireframes + descriptions:
183
- - General layout of each screen/page
184
- - Component positioning
185
- - Responsiveness (desktop, tablet, mobile)
186
- - States (loading, error, empty, success)
187
-
188
- #### 4.3. `ui-components.md`
189
-
190
- Technical specs for Fluent UI/MudBlazor components:
191
- - Component to use (FluentButton, MudDataGrid, etc.)
192
- - Props and configurations
193
- - Events and bindings
194
- - Validations and states
195
-
196
- #### 4.4. `ui-flows.md`
197
-
198
- Complete user flows:
199
- - User stories
200
- - Flow diagrams (text/ASCII)
201
- - Edge cases (what happens if...?)
202
- - Validations and feedback
203
-
204
- ### CHECKPOINT: Validate UI Deliverables
205
-
206
- **PAUSE - Before proceeding to accessibility:**
207
-
208
- - [ ] Aesthetic direction defined and documented in `ui-design-system.md`?
209
- - [ ] Font pair specified (not just Inter/Roboto for display)?
210
- - [ ] Color philosophy: dominant + accent + rationale documented?
211
- - [ ] Design system defined (project-level or feature-level)?
212
- - [ ] Wireframes cover all states (loading, error, empty, success)?
213
- - [ ] Components specified with actual props from chosen UI library?
214
- - [ ] Complete user flows with edge cases?
215
- - [ ] Chosen UI library documented as ADR in `decisions.md`?
216
-
217
- **If any checkbox is NOT checked:**
218
- → Go back and complete the missing deliverable
219
-
220
- **If ALL checkboxes are checked:**
221
- → Proceed to accessibility validation
222
-
223
- ---
224
-
225
- ### Step 5: Validate Accessibility and Responsiveness
226
-
227
- Document in UI files:
228
- - **WCAG 2.1 Level AA** compliance
229
- - Adequate color contrast
230
- - Accessible labels for screen readers
231
- - Keyboard navigation
232
- - **Responsive breakpoints**
233
- - Desktop (>1200px)
234
- - Tablet (768px - 1199px)
235
- - Mobile (<768px)
236
-
237
- ### Step 6: Update State
238
-
239
- ```bash
240
- npx morph-spec state mark-output $ARGUMENTS ui-design-system
241
- npx morph-spec state mark-output $ARGUMENTS ui-mockups
242
- npx morph-spec state mark-output $ARGUMENTS ui-components
243
- npx morph-spec state mark-output $ARGUMENTS ui-flows
244
- ```
245
-
246
- > **Format note:** The `mark-output` commands accept BOTH kebab-case (`ui-design-system`)
247
- > AND camelCase (`uiDesignSystem`). Both formats work equally! Use whichever is more
248
- > comfortable for you. Examples:
249
- > - `npx morph-spec state mark-output my-feature uiDesignSystem`
250
- > - `npx morph-spec state mark-output my-feature ui-design-system`
251
-
252
- ## Generated Outputs
253
-
254
- - `.morph/features/$ARGUMENTS/2-ui/design-system.md`
255
- - `.morph/features/$ARGUMENTS/2-ui/mockups.md`
256
- - `.morph/features/$ARGUMENTS/2-ui/components.md`
257
- - `.morph/features/$ARGUMENTS/2-ui/flows.md`
258
- - `.morph/features/$ARGUMENTS/1-design/decisions.md` (updated with UI library ADR)
259
-
260
- ### Step 7: Validate Design with Frontend Review
261
-
262
- After generating all 4 UI outputs and updating state (Step 6):
263
-
264
- ```bash
265
- /frontend-review $ARGUMENTS
266
- ```
267
-
268
- The skill validates: WCAG token contrast, existence of all outputs, static design accessibility, and generates mockup screenshots if dev server is available.
269
-
270
- **If frontend-review blocks**, fix issues before presenting to user.
271
-
272
- ---
273
-
274
- ## MANDATORY PAUSE
275
-
276
- Use `AskUserQuestion` to capture explicit approval before advancing:
277
-
278
- ```json
279
- {
280
- "questions": [{
281
- "header": "Approval",
282
- "question": "UI/UX generated. Approve to advance to technical design?",
283
- "multiSelect": false,
284
- "options": [
285
- { "label": "Approve UI/UX", "description": "Advance to technical design phase" },
286
- { "label": "I have feedback", "description": "Type what you want to adjust in the field below (Other)" }
287
- ]
288
- }]
289
- }
290
- ```
291
-
292
- - **"Approve UI/UX"** →
293
- ```bash
294
- npx morph-spec approve $ARGUMENTS uiux
295
- npx morph-spec phase advance $ARGUMENTS
296
- ```
297
- - **"I have feedback" or "Other"** → apply the received feedback and repeat this PAUSE
298
-
299
- ## Advancement Criteria
300
-
301
- - [x] User input collected (layout, references)
302
- - [x] UI library chosen and justified (ADR)
303
- - [x] 4 deliverables created (design-system, mockups, components, flows)
304
- - [x] WCAG 2.1 accessibility documented
305
- - [x] Responsiveness specified
306
- - [x] State updated
307
- - [x] User approved UI/UX
308
-
309
- ---
310
-
311
- ## Phase Outputs
312
-
313
- <!-- morph-outputs:uiux -->
314
- | Output | Path |
315
- |--------|------|
316
- | `uiDesignSystem` | `.morph/features/{feature}/2-ui/design-system.md` |
317
- | `uiMockups` | `.morph/features/{feature}/2-ui/mockups.md` |
318
- | `uiComponents` | `.morph/features/{feature}/2-ui/components.md` |
319
- | `uiFlows` | `.morph/features/{feature}/2-ui/flows.md` |
320
- <!-- /morph-outputs -->
321
-
322
- ---
323
-
1
+ ---
2
+ name: morph-phase-uiux
3
+ description: MORPH-SPEC Phase 1.5 (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.10.9"
8
+ ---
9
+
10
+ # MORPH UI/UX Design - Phase 1.5
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
+ - [ ] Phase 1 (Setup) completed
19
+ - [ ] Feature has detected UI keywords (blazor, 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/**/*.razor` or `**/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** `npx morph-spec template render docs/ui-mockups ...` | — |
40
+ | Generate design system from existing CSS | **Bash** `npx morph-spec generate design-system --scan` | — |
41
+ | Update state | **Bash** `npx morph-spec state mark-output ...` | — |
42
+
43
+ **MCPs for this phase:** Playwright (preview, inspection, responsiveness), Context7 (component docs).
44
+
45
+ **Anti-patterns:**
46
+ - WebSearch for MudBlazor docs (use Context7 MCP — more precise)
47
+ - Task agent to read a screenshot (use Read directly on image)
48
+ - Guess component props (use Context7 for actual API)
49
+
50
+ ---
51
+
52
+ ## Workflow
53
+
54
+ ### Step 0: Ensure uiux phase
55
+
56
+ ```bash
57
+ npx morph-spec state get $ARGUMENTS
58
+ ```
59
+
60
+ Check the `"phase"` field in the output:
61
+
62
+ **If `"phase": "uiux"`** → correct phase, proceed.
63
+
64
+ **If `"phase": "setup"`** → execute:
65
+ 1. `npx morph-spec phase advance $ARGUMENTS` (→ uiux)
66
+
67
+ **Any other value** → do not proceed — inconsistent state, report to user.
68
+
69
+ > **Rule:** Never write to `2-ui/` until the phase is `uiux`. The hook will block writes.
70
+
71
+ ---
72
+
73
+ ### Step 0.5: Check Design System
74
+
75
+ **This step is MANDATORY and must always run before Step 1.**
76
+
77
+ #### Step 0.5.1 — Scan frontend for CSS tokens (ALWAYS)
78
+
79
+ Search for existing CSS custom properties in the project's frontend directories.
80
+
81
+ Glob these patterns (exclude `node_modules/`, `.next/`, `dist/`, `build/`):
82
+ ```
83
+ wwwroot/**/*.css
84
+ wwwroot/**/*.scss
85
+ styles/**/*.css
86
+ src/styles/**/*.css
87
+ src/**/*.css
88
+ src/**/*.scss
89
+ src/**/*.module.css
90
+ public/**/*.css
91
+ ```
92
+
93
+ For each CSS/SCSS file found, Grep for `:root {` blocks containing `--` custom properties.
94
+
95
+ Classify found tokens:
96
+ - **Colors**: lines with `--color-*`, or any `--*` containing `#hex` / `rgb(...)`
97
+ - **Fonts**: `--font-*` or `font-family:` declarations
98
+ - **Spacing**: `--space-*`, `--gap-*`, `--size-*` with rem/px values
99
+
100
+ Track: `cssTokensFound` (bool), token counts by category, source file list.
101
+
102
+ #### Step 0.5.2 — Check if design-system.md exists
103
+
104
+ ```
105
+ Read: .morph/context/design-system.md
106
+ ```
107
+
108
+ Track: `dsExists` (bool).
109
+
110
+ #### Step 0.5.3 — Decision tree (4 cases)
111
+
112
+ | Case | Condition | Action |
113
+ |------|-----------|--------|
114
+ | **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. |
115
+ | **B** | `dsExists` AND NOT `cssTokensFound` | Print: `✓ Design system found (no CSS tokens to cross-check)`. Proceed to Step 1. |
116
+ | **C** | NOT `dsExists` AND `cssTokensFound` | Auto-generate `.morph/context/design-system.md` from scanned tokens (see Case C detail below). Proceed to Step 1. |
117
+ | **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. |
118
+
119
+ **Case C — auto-generate from scanned tokens:**
120
+
121
+ Create `.morph/context/design-system.md` with these sections populated from scan results:
122
+ - `## Color Tokens` → `:root { }` block with all found color variables (preserve exact variable names)
123
+ - `## Typography` → found font-family values (map by variable name heuristic: `--font-display` vs `--font-body`)
124
+ - `## Spacing Tokens` → found spacing variables
125
+ - `## Aesthetic Direction` → `#TODO` (requires user judgment, fill in manually)
126
+ - `## Changelog` → `- [today's date] [morph-phase-uiux] Auto-generated from CSS scan ([N] tokens from [files])`
127
+
128
+ Print: `✓ Design system generated from [N] tokens — .morph/context/design-system.md`
129
+
130
+ > **Design system is mandatory** for UI features. The implementation gate (Phase 5) will block if no design system exists.
131
+
132
+ ### Step 1: Detect If Phase Is Needed
133
+
134
+ Check if active agents include `ui-designer`:
135
+
136
+ ```bash
137
+ npx morph-spec state get $ARGUMENTS
138
+ ```
139
+
140
+ If `ui-designer` is NOT in `activeAgents`, skip this phase and continue to Phase 2 (Design).
141
+
142
+ ### Step 1.5: Design Thinking — Aesthetic Direction
143
+
144
+ > **Ref:** `framework/standards/frontend/design-system/aesthetic-direction.md`
145
+
146
+ **BEFORE collecting technical requirements**, define visual direction with 4 questions:
147
+
148
+ 1. **Purpose**: What problem does it solve? Who uses it? What is the professional context?
149
+ 2. **Tone**: What direction? (Minimal Refined / Editorial / Soft Professional / Industrial / Modern Luxury)
150
+ 3. **Differentiation**: What is the 1 memorable element of this interface?
151
+ 4. **Constraints**: Framework, performance budget, existing brand guidelines
152
+
153
+ **CRITICAL:** Commit to direction BEFORE technical specs. Document in `ui-design-system.md`
154
+ in section `## Aesthetic Direction` (template available in the standard above).
155
+
156
+ **Anti-patterns to avoid:**
157
+ - Purple gradient on white background (AI cliche)
158
+ - Inter/Roboto as display font
159
+ - 3-column card grid without visual differentiation
160
+ - 5-color palette with equal weight (without dominant + accent)
161
+
162
+ ### Step 2: Collect User Input
163
+
164
+ **ALWAYS ask the user FIRST:**
165
+
166
+ 1. **Layout and style**:
167
+ - Do you have any layout ideas in mind?
168
+ - Do you have visual references? (sites, apps, screenshots)
169
+ - How do you envision the user flow?
170
+
171
+ 2. **Components and interactions**:
172
+ - What are the main components of this screen/page?
173
+ - What states need to be considered? (loading, error, empty, success)
174
+
175
+ 3. **Reference images**:
176
+ - Do you have example images I can analyze?
177
+ - If YES: use Read tool to read screenshots and extract patterns
178
+
179
+ ### Step 3: Choose UI Library
180
+
181
+ Detect the stack from `.morph/config/config.json` and recommend the appropriate library:
182
+
183
+ **Blazor stack:**
184
+ - **Fluent UI Blazor** — dashboards, simple forms, AI components, Microsoft design language
185
+ - **MudBlazor** — advanced data grids, complex charts, material design
186
+
187
+ **Next.js stack:**
188
+ - **shadcn/ui + Radix** (recommended) — composable primitives, full control, Tailwind-native
189
+ - **MUI** — feature-rich, enterprise-grade, material design
190
+
191
+ **Document the decision as an ADR in `decisions.md`** with: context, options considered, decision, and rationale.
192
+
193
+ ### Step 3.5: Visual Mockup (Playwright MCP)
194
+
195
+ > **Purpose:** Generate a real HTML preview using project design tokens before writing formal specs.
196
+ > Seeing the actual visual before committing to components prevents misaligned specs.
197
+
198
+ #### 3.5.1 — Generate HTML Mockup
199
+
200
+ Create an HTML file that represents the main screen/layout using **real tokens from `.morph/context/design-system.md`**:
201
+
202
+ **Rules for the HTML:**
203
+ - `<style>` block must have `:root { }` with real values from design-system.md (not Tailwind colors)
204
+ - Tailwind CDN only for layout utilities (flex, grid, padding) — NOT for colors or typography
205
+ - Represents real layout hierarchy and visual weight — not ASCII
206
+ - Include representative content (realistic text, placeholder images)
207
+ - All colors via CSS variables: `color: var(--color-primary)` not `color: #3b82f6`
208
+
209
+ **Save to:** `.morph/features/$ARGUMENTS/2-ui/mockup.html`
210
+
211
+ Example structure:
212
+ ```html
213
+ <!DOCTYPE html>
214
+ <html lang="en">
215
+ <head>
216
+ <meta charset="UTF-8">
217
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
218
+ <title>[Feature] Mockup</title>
219
+ <link rel="preconnect" href="https://fonts.googleapis.com">
220
+ <!-- Load fonts from design-system.md font pair -->
221
+ <script src="https://cdn.tailwindcss.com"></script>
222
+ <style>
223
+ /* Real tokens from .morph/context/design-system.md */
224
+ :root {
225
+ --color-primary: [value from design-system.md];
226
+ --color-accent: [value from design-system.md];
227
+ --color-surface: [value from design-system.md];
228
+ --color-text-primary: [value from design-system.md];
229
+ --color-text-secondary: [value from design-system.md];
230
+ --font-display: [value from design-system.md];
231
+ --font-body: [value from design-system.md];
232
+ /* ... add all relevant tokens ... */
233
+ }
234
+ body {
235
+ font-family: var(--font-body);
236
+ background-color: var(--color-surface);
237
+ color: var(--color-text-primary);
238
+ }
239
+ h1, h2, h3 { font-family: var(--font-display); }
240
+ </style>
241
+ </head>
242
+ <body>
243
+ <!-- Layout representing the feature's main screen -->
244
+ </body>
245
+ </html>
246
+ ```
247
+
248
+ #### 3.5.2 — Screenshot at 3 Breakpoints
249
+
250
+ **Navigate to the file:**
251
+ ```
252
+ mcp__plugin_playwright_playwright__browser_navigate({ url: "file:///[ABSOLUTE_PATH_TO].morph/features/$ARGUMENTS/2-ui/mockup.html" })
253
+ ```
254
+
255
+ **Take screenshots at 3 breakpoints** (resize then screenshot for each):
256
+
257
+ **Mobile (375px):**
258
+ ```
259
+ mcp__plugin_playwright_playwright__browser_resize({ width: 375, height: 812 })
260
+ mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/2-ui/mockup-mobile.png
261
+ ```
262
+
263
+ **Tablet (768px):**
264
+ ```
265
+ mcp__plugin_playwright_playwright__browser_resize({ width: 768, height: 1024 })
266
+ mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/2-ui/mockup-tablet.png
267
+ ```
268
+
269
+ **Desktop (1440px):**
270
+ ```
271
+ mcp__plugin_playwright_playwright__browser_resize({ width: 1440, height: 900 })
272
+ mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/2-ui/mockup-desktop.png
273
+ ```
274
+
275
+ #### 3.5.3 — Present and Iterate
276
+
277
+ 1. **Show all 3 screenshots to the user**
278
+ 2. Ask for feedback:
279
+ - "Does this visual direction match your intent?"
280
+ - "Any layout, color, or typography adjustments?"
281
+ 3. **Iterate:** Refine `mockup.html` → re-take screenshots → show updated previews
282
+ 4. **Continue only when user approves** this visual direction
283
+
284
+ > **Note:** `ui-mockups.md` (Step 4.2) continues to exist as the reference for states and interactions.
285
+ > The PNGs are the visual reference; the .md covers behavior and edge cases.
286
+
287
+ ---
288
+
289
+ ### Step 4: Generate Deliverables
290
+
291
+ Create the following files in `.morph/features/$ARGUMENTS/`:
292
+
293
+ > **Use templates:** Use `npx 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`.
294
+
295
+ #### 4.1. `ui-design-system.md`
296
+
297
+ **If project-level design system exists (`.morph/context/design-system.md`):**
298
+ - Reference it in specs: "Uses project design system at .morph/context/design-system.md"
299
+ - Create `ui-design-system.md` only if there are feature-specific colors/components
300
+
301
+ **If it doesn't exist:**
302
+ - Create complete feature-level design system with:
303
+ - **Section `## Aesthetic Direction`** (use template from `aesthetic-direction.md`):
304
+ direction, font pair, color philosophy, motion intent, composition approach
305
+ - Color palette (primary, secondary, accent, semantic)
306
+ - Typography (heading scales, body text, code)
307
+ - Spacing and layout (grid, margins, paddings)
308
+ - Base components (buttons, inputs, cards)
309
+
310
+ #### 4.2. `ui-mockups.md`
311
+
312
+ ASCII wireframes + descriptions:
313
+ - General layout of each screen/page
314
+ - Component positioning
315
+ - Responsiveness (desktop, tablet, mobile)
316
+ - States (loading, error, empty, success)
317
+
318
+ #### 4.3. `ui-components.md`
319
+
320
+ Technical specs for Fluent UI/MudBlazor components:
321
+ - Component to use (FluentButton, MudDataGrid, etc.)
322
+ - Props and configurations
323
+ - Events and bindings
324
+ - Validations and states
325
+
326
+ #### 4.4. `ui-flows.md`
327
+
328
+ Complete user flows:
329
+ - User stories
330
+ - Flow diagrams (text/ASCII)
331
+ - Edge cases (what happens if...?)
332
+ - Validations and feedback
333
+
334
+ ### CHECKPOINT: Validate UI Deliverables
335
+
336
+ **PAUSE - Before proceeding to accessibility:**
337
+
338
+ - [ ] Aesthetic direction defined and documented in `ui-design-system.md`?
339
+ - [ ] Font pair specified (not just Inter/Roboto for display)?
340
+ - [ ] Color philosophy: dominant + accent + rationale documented?
341
+ - [ ] Design system defined (project-level or feature-level)?
342
+ - [ ] Wireframes cover all states (loading, error, empty, success)?
343
+ - [ ] Components specified with actual props from chosen UI library?
344
+ - [ ] Complete user flows with edge cases?
345
+ - [ ] Chosen UI library documented as ADR in `decisions.md`?
346
+
347
+ **If any checkbox is NOT checked:**
348
+ → Go back and complete the missing deliverable
349
+
350
+ **If ALL checkboxes are checked:**
351
+ → Proceed to accessibility validation
352
+
353
+ ---
354
+
355
+ ### Step 5: Validate Accessibility and Responsiveness
356
+
357
+ Document in UI files:
358
+ - **WCAG 2.1 Level AA** compliance
359
+ - Adequate color contrast
360
+ - Accessible labels for screen readers
361
+ - Keyboard navigation
362
+ - **Responsive breakpoints**
363
+ - Desktop (>1200px)
364
+ - Tablet (768px - 1199px)
365
+ - Mobile (<768px)
366
+
367
+ ### Step 6: Update State
368
+
369
+ ```bash
370
+ npx morph-spec state mark-output $ARGUMENTS ui-design-system
371
+ npx morph-spec state mark-output $ARGUMENTS ui-mockups
372
+ npx morph-spec state mark-output $ARGUMENTS ui-components
373
+ npx morph-spec state mark-output $ARGUMENTS ui-flows
374
+ ```
375
+
376
+ > **Format note:** The `mark-output` commands accept BOTH kebab-case (`ui-design-system`)
377
+ > AND camelCase (`uiDesignSystem`). Both formats work equally! Use whichever is more
378
+ > comfortable for you. Examples:
379
+ > - `npx morph-spec state mark-output my-feature uiDesignSystem`
380
+ > - `npx morph-spec state mark-output my-feature ui-design-system`
381
+
382
+ ## Generated Outputs
383
+
384
+ - `.morph/features/$ARGUMENTS/2-ui/design-system.md`
385
+ - `.morph/features/$ARGUMENTS/2-ui/mockups.md`
386
+ - `.morph/features/$ARGUMENTS/2-ui/components.md`
387
+ - `.morph/features/$ARGUMENTS/2-ui/flows.md`
388
+ - `.morph/features/$ARGUMENTS/1-design/decisions.md` (updated with UI library ADR)
389
+
390
+ ### Step 7: Validate Design with Frontend Review
391
+
392
+ After generating all 4 UI outputs and updating state (Step 6):
393
+
394
+ ```bash
395
+ /frontend-review $ARGUMENTS
396
+ ```
397
+
398
+ The skill validates: WCAG token contrast, existence of all outputs, static design accessibility, and generates mockup screenshots if dev server is available.
399
+
400
+ **If frontend-review blocks**, fix issues before presenting to user.
401
+
402
+ ---
403
+
404
+ ## MANDATORY PAUSE
405
+
406
+ Use `AskUserQuestion` to capture explicit approval before advancing:
407
+
408
+ ```json
409
+ {
410
+ "questions": [{
411
+ "header": "Approval",
412
+ "question": "UI/UX generated. Approve to advance to technical design?",
413
+ "multiSelect": false,
414
+ "options": [
415
+ { "label": "Approve UI/UX", "description": "Advance to technical design phase" },
416
+ { "label": "I have feedback", "description": "Type what you want to adjust in the field below (Other)" }
417
+ ]
418
+ }]
419
+ }
420
+ ```
421
+
422
+ - **"Approve UI/UX"** →
423
+ ```bash
424
+ npx morph-spec approve $ARGUMENTS uiux
425
+ npx morph-spec phase advance $ARGUMENTS
426
+ ```
427
+ - **"I have feedback" or "Other"** → apply the received feedback and repeat this PAUSE
428
+
429
+ ## Advancement Criteria
430
+
431
+ - [x] User input collected (layout, references)
432
+ - [x] UI library chosen and justified (ADR)
433
+ - [x] 4 deliverables created (design-system, mockups, components, flows)
434
+ - [x] WCAG 2.1 accessibility documented
435
+ - [x] Responsiveness specified
436
+ - [x] State updated
437
+ - [x] User approved UI/UX
438
+
439
+ ---
440
+
441
+ ## Phase Outputs
442
+
443
+ <!-- morph-outputs:uiux -->
444
+ | Output | Caminho |
445
+ |--------|---------|
446
+ | `uiDesignSystem` | `.morph/features/{feature}/2-ui/design-system.md` |
447
+ | `uiMockups` | `.morph/features/{feature}/2-ui/mockups.md` |
448
+ | `uiComponents` | `.morph/features/{feature}/2-ui/components.md` |
449
+ | `uiFlows` | `.morph/features/{feature}/2-ui/flows.md` |
450
+ | `uiMockupHtml` | `.morph/features/{feature}/2-ui/mockup.html` |
451
+ | `uiMockupMobile` | `.morph/features/{feature}/2-ui/mockup-mobile.png` |
452
+ | `uiMockupTablet` | `.morph/features/{feature}/2-ui/mockup-tablet.png` |
453
+ | `uiMockupDesktop` | `.morph/features/{feature}/2-ui/mockup-desktop.png` |
454
+ <!-- /morph-outputs -->
455
+
456
+ ---
457
+
324
458
  Continue automatically to Phase 2 (Design) after approval.