@polymorphism-tech/morph-spec 4.10.7 → 4.10.8

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 (122) 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 +88 -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 +424 -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/generators/design-system-generator.js +298 -298
  84. package/src/lib/generators/index.js +10 -10
  85. package/src/lib/generators/metadata-extractor.js +387 -387
  86. package/src/lib/stack-filter.js +65 -65
  87. package/src/lib/standards/index.js +7 -7
  88. package/src/lib/standards/standards-context-injector.js +302 -302
  89. package/src/lib/validators/architecture/architecture-validator.js +387 -387
  90. package/src/lib/validators/architecture/index.js +7 -7
  91. package/src/lib/validators/blazor/blazor-concurrency-analyzer.js +316 -316
  92. package/src/lib/validators/blazor/blazor-state-validator.js +279 -279
  93. package/src/lib/validators/blazor/blazor-validator.js +369 -369
  94. package/src/lib/validators/blazor/index.js +9 -9
  95. package/src/lib/validators/content/content-validator.js +287 -287
  96. package/src/lib/validators/content/index.js +7 -7
  97. package/src/lib/validators/contracts/index.js +7 -7
  98. package/src/lib/validators/css/css-validator.js +352 -352
  99. package/src/lib/validators/css/index.js +7 -7
  100. package/src/lib/validators/design-system/design-system-validator.js +231 -231
  101. package/src/lib/validators/design-system/index.js +7 -7
  102. package/src/lib/validators/nextjs/index.js +6 -6
  103. package/src/lib/validators/nextjs/next-component-validator.js +183 -183
  104. package/src/lib/validators/packages/index.js +7 -7
  105. package/src/lib/validators/packages/package-validator.js +360 -360
  106. package/src/lib/validators/shared/index.js +12 -12
  107. package/src/lib/validators/shared/issue-counter.js +18 -18
  108. package/src/lib/validators/shared/result-formatter.js +124 -124
  109. package/src/lib/validators/ui/index.js +7 -7
  110. package/src/lib/validators/ui/ui-contrast-validator.js +422 -422
  111. package/src/scripts/global-install.js +58 -58
  112. package/src/scripts/install-plugin.js +126 -126
  113. package/src/utils/claude-md-injector.js +90 -90
  114. package/src/utils/file-copier.js +200 -196
  115. package/src/utils/hooks-installer.js +556 -494
  116. package/src/utils/logger.js +32 -32
  117. package/src/utils/skills-installer.js +178 -178
  118. package/src/utils/version-checker.js +175 -175
  119. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  120. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  121. package/framework/templates/.idea/morph-templates.xml +0 -92
  122. package/framework/templates/.vscode/morph-templates.code-snippets +0 -186
@@ -1,324 +1,425 @@
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.8"
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 Exists
74
+
75
+ **CRITICAL:** Before starting UI/UX phase, check if a design system exists:
76
+
77
+ ```
78
+ Read: .morph/context/design-system.md
79
+ ```
80
+
81
+ If the file doesn't exist (design system not found):
82
+
83
+ 1. **Option A - Automatic scaffold:**
84
+ - The system will automatically create a design system when advancing to implementation
85
+ - You can generate manually now: `npx morph-spec generate design-system`
86
+
87
+ 2. **Option B - Create manually:**
88
+ - Create `.morph/context/design-system.md` (project-level, shared)
89
+ - Or `.morph/features/$ARGUMENTS/2-ui/design-system.md` (feature-specific)
90
+
91
+ 3. **Option C - Scan existing CSS:**
92
+ - If the project already has CSS with variables: `npx morph-spec generate design-system --scan`
93
+
94
+ **IMPORTANT:**
95
+ - Design system is **mandatory** for UI features
96
+ - Automatic gate will block implementation (Phase 5) if design system doesn't exist
97
+ - Better to create now to ensure visual consistency
98
+
99
+ ### Step 1: Detect If Phase Is Needed
100
+
101
+ Check if active agents include `ui-designer`:
102
+
103
+ ```bash
104
+ npx morph-spec state get $ARGUMENTS
105
+ ```
106
+
107
+ If `ui-designer` is NOT in `activeAgents`, skip this phase and continue to Phase 2 (Design).
108
+
109
+ ### Step 1.5: Design Thinking — Aesthetic Direction
110
+
111
+ > **Ref:** `framework/standards/frontend/design-system/aesthetic-direction.md`
112
+
113
+ **BEFORE collecting technical requirements**, define visual direction with 4 questions:
114
+
115
+ 1. **Purpose**: What problem does it solve? Who uses it? What is the professional context?
116
+ 2. **Tone**: What direction? (Minimal Refined / Editorial / Soft Professional / Industrial / Modern Luxury)
117
+ 3. **Differentiation**: What is the 1 memorable element of this interface?
118
+ 4. **Constraints**: Framework, performance budget, existing brand guidelines
119
+
120
+ **CRITICAL:** Commit to direction BEFORE technical specs. Document in `ui-design-system.md`
121
+ in section `## Aesthetic Direction` (template available in the standard above).
122
+
123
+ **Anti-patterns to avoid:**
124
+ - Purple gradient on white background (AI cliche)
125
+ - Inter/Roboto as display font
126
+ - 3-column card grid without visual differentiation
127
+ - 5-color palette with equal weight (without dominant + accent)
128
+
129
+ ### Step 2: Collect User Input
130
+
131
+ **ALWAYS ask the user FIRST:**
132
+
133
+ 1. **Layout and style**:
134
+ - Do you have any layout ideas in mind?
135
+ - Do you have visual references? (sites, apps, screenshots)
136
+ - How do you envision the user flow?
137
+
138
+ 2. **Components and interactions**:
139
+ - What are the main components of this screen/page?
140
+ - What states need to be considered? (loading, error, empty, success)
141
+
142
+ 3. **Reference images**:
143
+ - Do you have example images I can analyze?
144
+ - If YES: use Read tool to read screenshots and extract patterns
145
+
146
+ ### Step 3: Choose UI Library
147
+
148
+ Detect the stack from `.morph/config/config.json` and recommend the appropriate library:
149
+
150
+ **Blazor stack:**
151
+ - **Fluent UI Blazor** — dashboards, simple forms, AI components, Microsoft design language
152
+ - **MudBlazor** — advanced data grids, complex charts, material design
153
+
154
+ **Next.js stack:**
155
+ - **shadcn/ui + Radix** (recommended) — composable primitives, full control, Tailwind-native
156
+ - **MUI** — feature-rich, enterprise-grade, material design
157
+
158
+ **Document the decision as an ADR in `decisions.md`** with: context, options considered, decision, and rationale.
159
+
160
+ ### Step 3.5: Visual Mockup (Playwright MCP)
161
+
162
+ > **Purpose:** Generate a real HTML preview using project design tokens before writing formal specs.
163
+ > Seeing the actual visual before committing to components prevents misaligned specs.
164
+
165
+ #### 3.5.1 — Generate HTML Mockup
166
+
167
+ Create an HTML file that represents the main screen/layout using **real tokens from `.morph/context/design-system.md`**:
168
+
169
+ **Rules for the HTML:**
170
+ - `<style>` block must have `:root { }` with real values from design-system.md (not Tailwind colors)
171
+ - Tailwind CDN only for layout utilities (flex, grid, padding) — NOT for colors or typography
172
+ - Represents real layout hierarchy and visual weight — not ASCII
173
+ - Include representative content (realistic text, placeholder images)
174
+ - All colors via CSS variables: `color: var(--color-primary)` not `color: #3b82f6`
175
+
176
+ **Save to:** `.morph/features/$ARGUMENTS/2-ui/mockup.html`
177
+
178
+ Example structure:
179
+ ```html
180
+ <!DOCTYPE html>
181
+ <html lang="en">
182
+ <head>
183
+ <meta charset="UTF-8">
184
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
185
+ <title>[Feature] Mockup</title>
186
+ <link rel="preconnect" href="https://fonts.googleapis.com">
187
+ <!-- Load fonts from design-system.md font pair -->
188
+ <script src="https://cdn.tailwindcss.com"></script>
189
+ <style>
190
+ /* Real tokens from .morph/context/design-system.md */
191
+ :root {
192
+ --color-primary: [value from design-system.md];
193
+ --color-accent: [value from design-system.md];
194
+ --color-surface: [value from design-system.md];
195
+ --color-text-primary: [value from design-system.md];
196
+ --color-text-secondary: [value from design-system.md];
197
+ --font-display: [value from design-system.md];
198
+ --font-body: [value from design-system.md];
199
+ /* ... add all relevant tokens ... */
200
+ }
201
+ body {
202
+ font-family: var(--font-body);
203
+ background-color: var(--color-surface);
204
+ color: var(--color-text-primary);
205
+ }
206
+ h1, h2, h3 { font-family: var(--font-display); }
207
+ </style>
208
+ </head>
209
+ <body>
210
+ <!-- Layout representing the feature's main screen -->
211
+ </body>
212
+ </html>
213
+ ```
214
+
215
+ #### 3.5.2 — Screenshot at 3 Breakpoints
216
+
217
+ **Navigate to the file:**
218
+ ```
219
+ mcp__plugin_playwright_playwright__browser_navigate({ url: "file:///[ABSOLUTE_PATH_TO].morph/features/$ARGUMENTS/2-ui/mockup.html" })
220
+ ```
221
+
222
+ **Take screenshots at 3 breakpoints** (resize then screenshot for each):
223
+
224
+ **Mobile (375px):**
225
+ ```
226
+ mcp__plugin_playwright_playwright__browser_resize({ width: 375, height: 812 })
227
+ mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/2-ui/mockup-mobile.png
228
+ ```
229
+
230
+ **Tablet (768px):**
231
+ ```
232
+ mcp__plugin_playwright_playwright__browser_resize({ width: 768, height: 1024 })
233
+ mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/2-ui/mockup-tablet.png
234
+ ```
235
+
236
+ **Desktop (1440px):**
237
+ ```
238
+ mcp__plugin_playwright_playwright__browser_resize({ width: 1440, height: 900 })
239
+ mcp__plugin_playwright_playwright__browser_take_screenshot({}) → save as .morph/features/$ARGUMENTS/2-ui/mockup-desktop.png
240
+ ```
241
+
242
+ #### 3.5.3 — Present and Iterate
243
+
244
+ 1. **Show all 3 screenshots to the user**
245
+ 2. Ask for feedback:
246
+ - "Does this visual direction match your intent?"
247
+ - "Any layout, color, or typography adjustments?"
248
+ 3. **Iterate:** Refine `mockup.html` → re-take screenshots → show updated previews
249
+ 4. **Continue only when user approves** this visual direction
250
+
251
+ > **Note:** `ui-mockups.md` (Step 4.2) continues to exist as the reference for states and interactions.
252
+ > The PNGs are the visual reference; the .md covers behavior and edge cases.
253
+
254
+ ---
255
+
256
+ ### Step 4: Generate Deliverables
257
+
258
+ Create the following files in `.morph/features/$ARGUMENTS/`:
259
+
260
+ > **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`.
261
+
262
+ #### 4.1. `ui-design-system.md`
263
+
264
+ **If project-level design system exists (`.morph/context/design-system.md`):**
265
+ - Reference it in specs: "Uses project design system at .morph/context/design-system.md"
266
+ - Create `ui-design-system.md` only if there are feature-specific colors/components
267
+
268
+ **If it doesn't exist:**
269
+ - Create complete feature-level design system with:
270
+ - **Section `## Aesthetic Direction`** (use template from `aesthetic-direction.md`):
271
+ direction, font pair, color philosophy, motion intent, composition approach
272
+ - Color palette (primary, secondary, accent, semantic)
273
+ - Typography (heading scales, body text, code)
274
+ - Spacing and layout (grid, margins, paddings)
275
+ - Base components (buttons, inputs, cards)
276
+
277
+ #### 4.2. `ui-mockups.md`
278
+
279
+ ASCII wireframes + descriptions:
280
+ - General layout of each screen/page
281
+ - Component positioning
282
+ - Responsiveness (desktop, tablet, mobile)
283
+ - States (loading, error, empty, success)
284
+
285
+ #### 4.3. `ui-components.md`
286
+
287
+ Technical specs for Fluent UI/MudBlazor components:
288
+ - Component to use (FluentButton, MudDataGrid, etc.)
289
+ - Props and configurations
290
+ - Events and bindings
291
+ - Validations and states
292
+
293
+ #### 4.4. `ui-flows.md`
294
+
295
+ Complete user flows:
296
+ - User stories
297
+ - Flow diagrams (text/ASCII)
298
+ - Edge cases (what happens if...?)
299
+ - Validations and feedback
300
+
301
+ ### CHECKPOINT: Validate UI Deliverables
302
+
303
+ **PAUSE - Before proceeding to accessibility:**
304
+
305
+ - [ ] Aesthetic direction defined and documented in `ui-design-system.md`?
306
+ - [ ] Font pair specified (not just Inter/Roboto for display)?
307
+ - [ ] Color philosophy: dominant + accent + rationale documented?
308
+ - [ ] Design system defined (project-level or feature-level)?
309
+ - [ ] Wireframes cover all states (loading, error, empty, success)?
310
+ - [ ] Components specified with actual props from chosen UI library?
311
+ - [ ] Complete user flows with edge cases?
312
+ - [ ] Chosen UI library documented as ADR in `decisions.md`?
313
+
314
+ **If any checkbox is NOT checked:**
315
+ → Go back and complete the missing deliverable
316
+
317
+ **If ALL checkboxes are checked:**
318
+ → Proceed to accessibility validation
319
+
320
+ ---
321
+
322
+ ### Step 5: Validate Accessibility and Responsiveness
323
+
324
+ Document in UI files:
325
+ - **WCAG 2.1 Level AA** compliance
326
+ - Adequate color contrast
327
+ - Accessible labels for screen readers
328
+ - Keyboard navigation
329
+ - **Responsive breakpoints**
330
+ - Desktop (>1200px)
331
+ - Tablet (768px - 1199px)
332
+ - Mobile (<768px)
333
+
334
+ ### Step 6: Update State
335
+
336
+ ```bash
337
+ npx morph-spec state mark-output $ARGUMENTS ui-design-system
338
+ npx morph-spec state mark-output $ARGUMENTS ui-mockups
339
+ npx morph-spec state mark-output $ARGUMENTS ui-components
340
+ npx morph-spec state mark-output $ARGUMENTS ui-flows
341
+ ```
342
+
343
+ > **Format note:** The `mark-output` commands accept BOTH kebab-case (`ui-design-system`)
344
+ > AND camelCase (`uiDesignSystem`). Both formats work equally! Use whichever is more
345
+ > comfortable for you. Examples:
346
+ > - `npx morph-spec state mark-output my-feature uiDesignSystem`
347
+ > - `npx morph-spec state mark-output my-feature ui-design-system`
348
+
349
+ ## Generated Outputs
350
+
351
+ - `.morph/features/$ARGUMENTS/2-ui/design-system.md`
352
+ - `.morph/features/$ARGUMENTS/2-ui/mockups.md`
353
+ - `.morph/features/$ARGUMENTS/2-ui/components.md`
354
+ - `.morph/features/$ARGUMENTS/2-ui/flows.md`
355
+ - `.morph/features/$ARGUMENTS/1-design/decisions.md` (updated with UI library ADR)
356
+
357
+ ### Step 7: Validate Design with Frontend Review
358
+
359
+ After generating all 4 UI outputs and updating state (Step 6):
360
+
361
+ ```bash
362
+ /frontend-review $ARGUMENTS
363
+ ```
364
+
365
+ The skill validates: WCAG token contrast, existence of all outputs, static design accessibility, and generates mockup screenshots if dev server is available.
366
+
367
+ **If frontend-review blocks**, fix issues before presenting to user.
368
+
369
+ ---
370
+
371
+ ## MANDATORY PAUSE
372
+
373
+ Use `AskUserQuestion` to capture explicit approval before advancing:
374
+
375
+ ```json
376
+ {
377
+ "questions": [{
378
+ "header": "Approval",
379
+ "question": "UI/UX generated. Approve to advance to technical design?",
380
+ "multiSelect": false,
381
+ "options": [
382
+ { "label": "Approve UI/UX", "description": "Advance to technical design phase" },
383
+ { "label": "I have feedback", "description": "Type what you want to adjust in the field below (Other)" }
384
+ ]
385
+ }]
386
+ }
387
+ ```
388
+
389
+ - **"Approve UI/UX"** →
390
+ ```bash
391
+ npx morph-spec approve $ARGUMENTS uiux
392
+ npx morph-spec phase advance $ARGUMENTS
393
+ ```
394
+ - **"I have feedback" or "Other"** → apply the received feedback and repeat this PAUSE
395
+
396
+ ## Advancement Criteria
397
+
398
+ - [x] User input collected (layout, references)
399
+ - [x] UI library chosen and justified (ADR)
400
+ - [x] 4 deliverables created (design-system, mockups, components, flows)
401
+ - [x] WCAG 2.1 accessibility documented
402
+ - [x] Responsiveness specified
403
+ - [x] State updated
404
+ - [x] User approved UI/UX
405
+
406
+ ---
407
+
408
+ ## Phase Outputs
409
+
410
+ <!-- morph-outputs:uiux -->
411
+ | Output | Caminho |
412
+ |--------|---------|
413
+ | `uiDesignSystem` | `.morph/features/{feature}/2-ui/design-system.md` |
414
+ | `uiMockups` | `.morph/features/{feature}/2-ui/mockups.md` |
415
+ | `uiComponents` | `.morph/features/{feature}/2-ui/components.md` |
416
+ | `uiFlows` | `.morph/features/{feature}/2-ui/flows.md` |
417
+ | `uiMockupHtml` | `.morph/features/{feature}/2-ui/mockup.html` |
418
+ | `uiMockupMobile` | `.morph/features/{feature}/2-ui/mockup-mobile.png` |
419
+ | `uiMockupTablet` | `.morph/features/{feature}/2-ui/mockup-tablet.png` |
420
+ | `uiMockupDesktop` | `.morph/features/{feature}/2-ui/mockup-desktop.png` |
421
+ <!-- /morph-outputs -->
422
+
423
+ ---
424
+
324
425
  Continue automatically to Phase 2 (Design) after approval.