@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,311 +1,317 @@
1
- ---
2
- name: morph-phase-tasks
3
- description: MORPH-SPEC Phase 4 (Tasks). Breaks approved spec into bottom-up ordered implementation tasks (T001...TXXX) with dependencies, checkpoints every 3 tasks, and effort estimates, producing tasks.md. Use after design and clarification phases to create a structured implementation plan before coding starts.
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 Tasks — Phase 4
11
-
12
- > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
-
14
- Break the approved specification into executable tasks, define execution order, and establish checkpoints.
15
-
16
- ## Prerequisites
17
-
18
- - [ ] Phase 3 (Clarify) completed
19
- - [ ] `spec.md` updated with clarifications
20
- - [ ] All edge cases documented
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
- > **Example:** `references/tasks-example.md` — filled-in tasks.md showing expected granularity and format.
27
- > **Script:** `scripts/validate-tasks.mjs` — validates tasks.md structure, T### IDs, and required fields.
28
-
29
- | Action | Tool | Alternative |
30
- |--------|------|-------------|
31
- | Read spec + contracts + decisions | **Read** all outputs | — |
32
- | Analyze implementation complexity | **Grep** patterns in existing code | — |
33
- | Count similar existing patterns | **Glob** `**/Services/**/*.cs` | — |
34
- | Look up implementation patterns | **Context7 MCP** `query_docs()` | **WebSearch** |
35
- | Create GitHub issues from tasks | **GitHub MCP** `create_issue()` | **Bash** `gh issue create ...` |
36
- | Render tasks template | **Bash** `npx morph-spec template render docs/tasks ...` | — |
37
- | Update state with task count | **Bash** `npx morph-spec state set ... tasks.total N` | — |
38
-
39
- **Phase MCPs:** Context7 (estimate complexity), GitHub (create issues).
40
-
41
- **Anti-patterns:**
42
- - Task agent to break down a simple single-domain spec (do it directly)
43
- - Creating tasks without reading all design outputs first
44
- - **(VSA)** Creating separate tasks for Handler, Validator, and Endpoint — one slice = one task
45
- - **(VSA)** Using DDD categories (`domain`, `application`, `infrastructure`) in VSA projects — use VSA categories: `entity`, `errors`, `tags`, `migration`, `slice`, `frontend`, `tests`
46
- - **(VSA)** Creating a "Implement Service layer" task — there is no Service layer in VSA
47
- - Using vague effort labels ("Low", "Medium", "S/M") — always use specific minute estimates
48
- - Using non-standard task IDs (TASK-001, T01) — always use **T001** format (T + 3 digits)
49
-
50
- ---
51
-
52
- ## Pre-flight (before starting task breakdown)
53
-
54
- ### 0. Ensure tasks phase
55
-
56
- ```bash
57
- npx morph-spec state get $ARGUMENTS
58
- ```
59
-
60
- Check the `"phase"` field:
61
-
62
- **If `"phase": "tasks"`** → correct phase, proceed.
63
-
64
- **If `"phase": "clarify"`** → run in sequence:
65
- 1. `npx morph-spec state mark-output $ARGUMENTS clarifications`
66
- 2. `npx morph-spec phase advance $ARGUMENTS` (→ tasks)
67
-
68
- **Any other value** → STOP — inconsistent state, report to user.
69
-
70
- > **Rule:** Never write to `4-tasks/` until the phase is `tasks`. The hook will block writes.
71
-
72
- ---
73
-
74
- ### 1. Read all prerequisites in PARALLEL
75
-
76
- ```
77
- # Single parallel call, not sequential:
78
- Read: .morph/features/{feature}/1-design/spec.md
79
- + Read: .morph/features/{feature}/1-design/contracts.cs (or contracts.ts for TypeScript projects)
80
- + Read: .morph/features/{feature}/1-design/decisions.md
81
- + Read: .morph/features/{feature}/1-design/schema-analysis.md (if exists)
82
- + Read: .morph/config/config.json (→ architecture.style)
83
- ```
84
-
85
- ### 2. Create session tasks for visibility
86
-
87
- ```
88
- TaskCreate: "Analyze spec and define tasks" → activeForm: "Analyzing spec"
89
- TaskCreate: "Generate tasks.md" → activeForm: "Generating tasks.md"
90
- TaskCreate: "Phase advance" → activeForm: "Advancing phase"
91
- ```
92
-
93
- > **Note:** Individual T001-T00N tasks are created as native tasks during the implementation phase (`phase-implement`). Here we only keep the 3 high-level tasks for this planning session.
94
-
95
- ---
96
-
97
- ### 3. Entry checkpoint — verify prerequisites
98
-
99
- Before starting the breakdown:
100
-
101
- - [ ] `spec.md` exists and approved by user?
102
- - [ ] `contracts.cs`/`.ts` exists and matches real schema?
103
- - [ ] `schema-analysis.md` validated (if applicable)?
104
- - [ ] `decisions.md` contains ADRs for all critical choices?
105
- - [ ] Design gate (`morph-spec approve $ARGUMENTS design`) approved?
106
- - [ ] Clarifications (Phase 3) resolved and spec updated?
107
-
108
- If any checkbox is NOT checked → return to corresponding phase and resolve.
109
-
110
- ```bash
111
- npx morph-spec state get $ARGUMENTS
112
- npx morph-spec approval-status $ARGUMENTS
113
- ```
114
-
115
- ---
116
-
117
- ## Workflow
118
-
119
- ### Step 0: Detect Architecture Style
120
-
121
- Before anything else, determine if the project is VSA or DDD:
122
-
123
- ```bash
124
- cat .morph/config/config.json | grep -A3 '"architecture"'
125
- ```
126
-
127
- **If `config.architecture.style === "vertical-slice"`** → follow **Step 0.5 (VSA)** and skip DDD path.
128
- **Otherwise** → follow **Step 0.6 (DDD)** below.
129
-
130
- ---
131
-
132
- ### Step 0.5: VSA Task Plan
133
-
134
- > For VSA task patterns and DDD-level mappings, see `references/task-planning-patterns.md`
135
-
136
- Read the `## Architecture Style: Vertical Slice` section from spec.md for the **VSA Blueprint**:
137
-
138
- ```bash
139
- grep -A30 "## Architecture Style" ".morph/features/$ARGUMENTS/1-design/spec.md"
140
- ```
141
-
142
- Create one task per slice following this order: entity → errors → tags → migration → CRUD slices → custom slices → frontend → tests. Each slice = Handler + Validator + Endpoint in a **single task**. `GetAll` operations do NOT have a Validator (no input parameters to validate).
143
-
144
- Use VSA-specific categories: `entity`, `errors`, `tags`, `migration`, `slice`, `frontend`, `tests`.
145
-
146
- **After defining VSA tasks, skip directly to Step 3 (Dependencies).**
147
-
148
- ---
149
-
150
- ### Step 0.6: Read Domain Level — DDD
151
-
152
- Read the `## Domain Complexity` section from spec.md:
153
-
154
- ```bash
155
- grep -A15 "## Domain Complexity" ".morph/features/$ARGUMENTS/1-design/spec.md"
156
- ```
157
-
158
- > If the section doesn't exist, assume **Level 1 (CRUD)**.
159
-
160
- Use the level to constrain categories:
161
- - **Level 1**: domain → infrastructure → application → presentation → tests
162
- - **Level 2**: adds AggregateRoot, ValueObjects, DomainEvents, CQRS handlers
163
- - **Level 3**: adds BC setup, Integration Events
164
-
165
- See `references/task-planning-patterns.md` for the complete table.
166
-
167
- ---
168
-
169
- ### Step 1: Analyze Spec
170
-
171
- > **VSA:** If coming from Step 0.5, the task breakdown was already defined — use the generated examples as a base and skip to Step 3 (Dependencies).
172
-
173
- Read `.morph/features/$ARGUMENTS/1-design/spec.md` and identify:
174
-
175
- 1. **Functional requirements** (FR001, FR002, ...)
176
- 2. **Technical components** (Entities, Services/Slices, Controllers/Endpoints, Pages)
177
- 3. **Infrastructure** (Bicep, migrations, configs)
178
- 4. **Tests** (Unit tests, integration tests)
179
-
180
- ### Step 2: Break Into Tasks
181
-
182
- > For structure, categories, and implementation order, see `references/task-planning-patterns.md`
183
-
184
- Create tasks using the **T{NNN}** format (T001, T002, ...) following bottom-up order: domain → infrastructure → application → presentation → tests → infra → docs.
185
-
186
- The T### format is mandatory — it is used by `morph-spec task start/done` commands and the validate-tasks script. Do not use TASK-001, T01, or other formats.
187
-
188
- ### Step 3: Define Dependencies
189
-
190
- For each task, specify dependencies:
191
-
192
- ```json
193
- {
194
- "id": "T005",
195
- "title": "Create {Name}Service",
196
- "dependencies": ["T001", "T002"],
197
- "status": "pending"
198
- }
199
- ```
200
-
201
- **Rule:** A task can only be executed when all its dependencies are `completed`.
202
-
203
- ### Step 4: Establish Checkpoints
204
-
205
- Define checkpoints after every **3 tasks** — this cadence matches the implementation phase's checkpoint-save frequency. Regular checkpoints catch integration issues early rather than at the end.
206
-
207
- ```json
208
- {
209
- "id": "CHECKPOINT_001",
210
- "title": "Domain Layer Complete",
211
- "afterTasks": ["T001", "T002", "T003"],
212
- "validations": [
213
- "All entities created",
214
- "Migrations applied",
215
- "Domain tests passing"
216
- ]
217
- }
218
- ```
219
-
220
- ### Step 5: Estimate Effort
221
-
222
- For each task, estimate time **in minutes** (not vague labels like "Low/Medium"). Specific estimates help the plan phase determine execution strategy and parallelization.
223
-
224
- | Complexity | Estimated Time |
225
- |------------|----------------|
226
- | Trivial (basic CRUD) | 15-30 min |
227
- | Simple (Service, Controller) | 30-60 min |
228
- | Medium (Business logic, validations) | 60-120 min |
229
- | Complex (Integrations, AI) | 120-240 min |
230
-
231
- ### Step 6: Generate `tasks.md`
232
-
233
- Create `.morph/features/$ARGUMENTS/4-tasks/tasks.md` with the complete task structure, checkpoints, and estimates.
234
-
235
- ### Step 7: Include IaC Tasks (if needed)
236
-
237
- If there are Azure resources, add Bicep and migration tasks.
238
-
239
- ### Step 8: Update State
240
-
241
- ```bash
242
- npx morph-spec state set $ARGUMENTS tasks.total {N}
243
- npx morph-spec state mark-output $ARGUMENTS tasks
244
- ```
245
-
246
- ## Outputs
247
-
248
- - `.morph/features/$ARGUMENTS/4-tasks/tasks.md` — Complete task breakdown
249
-
250
- ## Mandatory Approval Pause
251
-
252
- Use `AskUserQuestion` to capture explicit approval before advancing. This gate prevents implementation from starting with an unapproved task list.
253
-
254
- ```json
255
- {
256
- "questions": [{
257
- "header": "Approval",
258
- "question": "Tasks generated. Approve to start implementation?",
259
- "multiSelect": false,
260
- "options": [
261
- { "label": "Approve and implement", "description": "Advance to implementation phase" },
262
- { "label": "I have feedback", "description": "Type what you want to change" }
263
- ]
264
- }]
265
- }
266
- ```
267
-
268
- - **"Approve and implement"** →
269
- ```bash
270
- npx morph-spec approve $ARGUMENTS tasks
271
- npx morph-spec phase advance $ARGUMENTS
272
- ```
273
- - **"I have feedback" or "Other"** → apply the feedback and repeat this PAUSE
274
-
275
- ## Completion Criteria
276
-
277
- - [x] `tasks.md` created with all tasks
278
- - [x] Tasks use T### format (T001, T002, ...) consistently
279
- - [x] Tasks categorized correctly (DDD layers or VSA categories)
280
- - [x] Dependencies mapped
281
- - [x] Checkpoints defined (every 3 tasks)
282
- - [x] Effort estimated in minutes per task
283
- - [x] Execution order clear
284
- - [x] IaC tasks included (if applicable)
285
- - [x] State updated with total tasks (`state set tasks.total`)
286
- - [x] User approved breakdown via `AskUserQuestion`
287
-
288
- ---
289
-
290
- ## Superpowers Integration
291
-
292
- > Available when the `superpowers` plugin is installed.
293
-
294
- | Skill | When to Use | Invocation |
295
- |-------|-------------|-----------|
296
- | `writing-plans` | After task breakdown, to plan implementation sequence | `Skill(superpowers:writing-plans)` |
297
- | `executing-plans` | To execute the task plan in a separate session | `Skill(superpowers:executing-plans)` |
298
-
299
- ---
300
-
301
- ## Phase Outputs
302
-
303
- <!-- morph-outputs:tasks -->
304
- | Output | Path |
305
- |--------|------|
306
- | `tasks` | `.morph/features/{feature}/4-tasks/tasks.md` |
307
- <!-- /morph-outputs -->
308
-
309
- ---
310
-
311
- After approval: "Planning complete! Run `/morph-apply $ARGUMENTS` to start implementation."
1
+ ---
2
+ name: morph-phase-tasks
3
+ description: MORPH-SPEC Phase 4 (Tasks). Breaks approved spec into bottom-up ordered implementation tasks (T001...TXXX) with dependencies, checkpoints every 3 tasks, and effort estimates, producing tasks.md. Use after design and clarification phases to create a structured implementation plan before coding starts.
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 Tasks — Phase 4
11
+
12
+ > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
+
14
+ Break the approved specification into executable tasks, define execution order, and establish checkpoints.
15
+
16
+ ## Prerequisites
17
+
18
+ - [ ] Phase 3 (Clarify) completed
19
+ - [ ] `spec.md` updated with clarifications
20
+ - [ ] All edge cases documented
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
+ > **Example:** `references/tasks-example.md` — filled-in tasks.md showing expected granularity and format.
27
+ > **Script:** `scripts/validate-tasks.mjs` — validates tasks.md structure, T### IDs, and required fields.
28
+
29
+ | Action | Tool | Alternative |
30
+ |--------|------|-------------|
31
+ | Read spec + contracts + decisions | **Read** all outputs | — |
32
+ | Analyze implementation complexity | **Grep** patterns in existing code | — |
33
+ | Count similar existing patterns | **Glob** `**/Services/**/*.cs` | — |
34
+ | Look up implementation patterns | **Context7 MCP** `query_docs()` | **WebSearch** |
35
+ | Create GitHub issues from tasks | **GitHub MCP** `create_issue()` | **Bash** `gh issue create ...` |
36
+ | Render tasks template | **Bash** `npx morph-spec template render docs/tasks ...` | — |
37
+ | Update state with task count | **Bash** `npx morph-spec state set ... tasks.total N` | — |
38
+
39
+ **Phase MCPs:** Context7 (estimate complexity), GitHub (create issues).
40
+
41
+ **Anti-patterns:**
42
+ - Task agent to break down a simple single-domain spec (do it directly)
43
+ - Creating tasks without reading all design outputs first
44
+ - **(VSA)** Creating separate tasks for Handler, Validator, and Endpoint — one slice = one task
45
+ - **(VSA)** Using DDD categories (`domain`, `application`, `infrastructure`) in VSA projects — use VSA categories: `entity`, `errors`, `tags`, `migration`, `slice`, `frontend`, `tests`
46
+ - **(VSA)** Creating a "Implement Service layer" task — there is no Service layer in VSA
47
+ - Using vague effort labels ("Low", "Medium", "S/M") — always use specific minute estimates
48
+ - Using non-standard task IDs (TASK-001, T01) — always use **T001** format (T + 3 digits)
49
+
50
+ ---
51
+
52
+ ## Pre-flight (before starting task breakdown)
53
+
54
+ ### 0. Ensure tasks phase
55
+
56
+ ```bash
57
+ npx morph-spec state get $ARGUMENTS
58
+ ```
59
+
60
+ Check the `"phase"` field:
61
+
62
+ **If `"phase": "tasks"`** → correct phase, proceed.
63
+
64
+ **If `"phase": "clarify"`** → run in sequence:
65
+ 1. `npx morph-spec state mark-output $ARGUMENTS clarifications`
66
+ 2. `npx morph-spec phase advance $ARGUMENTS` (→ tasks)
67
+
68
+ **Any other value** → STOP — inconsistent state, report to user.
69
+
70
+ > **Rule:** Never write to `4-tasks/` until the phase is `tasks`. The hook will block writes.
71
+
72
+ ---
73
+
74
+ ### 1. Read all prerequisites in PARALLEL
75
+
76
+ ```
77
+ # Single parallel call, not sequential:
78
+ Read: .morph/features/{feature}/1-design/spec.md
79
+ + Read: .morph/features/{feature}/1-design/contracts.cs (or contracts.ts for TypeScript projects)
80
+ + Read: .morph/features/{feature}/1-design/decisions.md
81
+ + Read: .morph/features/{feature}/1-design/schema-analysis.md (if exists)
82
+ + Read: .morph/config/config.json (→ architecture.style)
83
+ ```
84
+
85
+ ### 2. Create session tasks for visibility
86
+
87
+ After detecting `activeAgents` from state, create tasks with agent context:
88
+
89
+ ```
90
+ TaskCreate: "Analyze spec and define tasks"
91
+ → description: "Active agents: {activeAgents.join(', ')}"
92
+ → activeForm: "Analyzing spec"
93
+ TaskCreate: "Generate tasks.md"
94
+ → description: "Architecture: {config.architecture.style}"
95
+ → activeForm: "Generating tasks.md"
96
+ TaskCreate: "Phase advance" → activeForm: "Awaiting tasks approval + advancing phase"
97
+ ```
98
+
99
+ > **Note:** Individual T001-T00N tasks are created as native tasks during the implementation phase (`phase-implement`). Here we only keep the 3 high-level tasks for this planning session.
100
+
101
+ ---
102
+
103
+ ### 3. Entry checkpoint — verify prerequisites
104
+
105
+ Before starting the breakdown:
106
+
107
+ - [ ] `spec.md` exists and approved by user?
108
+ - [ ] `contracts.cs`/`.ts` exists and matches real schema?
109
+ - [ ] `schema-analysis.md` validated (if applicable)?
110
+ - [ ] `decisions.md` contains ADRs for all critical choices?
111
+ - [ ] Design gate (`morph-spec approve $ARGUMENTS design`) approved?
112
+ - [ ] Clarifications (Phase 3) resolved and spec updated?
113
+
114
+ If any checkbox is NOT checked → return to corresponding phase and resolve.
115
+
116
+ ```bash
117
+ npx morph-spec state get $ARGUMENTS
118
+ npx morph-spec approval-status $ARGUMENTS
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Workflow
124
+
125
+ ### Step 0: Detect Architecture Style
126
+
127
+ Before anything else, determine if the project is VSA or DDD:
128
+
129
+ ```bash
130
+ cat .morph/config/config.json | grep -A3 '"architecture"'
131
+ ```
132
+
133
+ **If `config.architecture.style === "vertical-slice"`** → follow **Step 0.5 (VSA)** and skip DDD path.
134
+ **Otherwise** → follow **Step 0.6 (DDD)** below.
135
+
136
+ ---
137
+
138
+ ### Step 0.5: VSA Task Plan
139
+
140
+ > For VSA task patterns and DDD-level mappings, see `references/task-planning-patterns.md`
141
+
142
+ Read the `## Architecture Style: Vertical Slice` section from spec.md for the **VSA Blueprint**:
143
+
144
+ ```bash
145
+ grep -A30 "## Architecture Style" ".morph/features/$ARGUMENTS/1-design/spec.md"
146
+ ```
147
+
148
+ Create one task per slice following this order: entity → errors → tags → migration → CRUD slices → custom slices → frontend → tests. Each slice = Handler + Validator + Endpoint in a **single task**. `GetAll` operations do NOT have a Validator (no input parameters to validate).
149
+
150
+ Use VSA-specific categories: `entity`, `errors`, `tags`, `migration`, `slice`, `frontend`, `tests`.
151
+
152
+ **After defining VSA tasks, skip directly to Step 3 (Dependencies).**
153
+
154
+ ---
155
+
156
+ ### Step 0.6: Read Domain Level — DDD
157
+
158
+ Read the `## Domain Complexity` section from spec.md:
159
+
160
+ ```bash
161
+ grep -A15 "## Domain Complexity" ".morph/features/$ARGUMENTS/1-design/spec.md"
162
+ ```
163
+
164
+ > If the section doesn't exist, assume **Level 1 (CRUD)**.
165
+
166
+ Use the level to constrain categories:
167
+ - **Level 1**: domain → infrastructure → application → presentation → tests
168
+ - **Level 2**: adds AggregateRoot, ValueObjects, DomainEvents, CQRS handlers
169
+ - **Level 3**: adds BC setup, Integration Events
170
+
171
+ See `references/task-planning-patterns.md` for the complete table.
172
+
173
+ ---
174
+
175
+ ### Step 1: Analyze Spec
176
+
177
+ > **VSA:** If coming from Step 0.5, the task breakdown was already defined — use the generated examples as a base and skip to Step 3 (Dependencies).
178
+
179
+ Read `.morph/features/$ARGUMENTS/1-design/spec.md` and identify:
180
+
181
+ 1. **Functional requirements** (FR001, FR002, ...)
182
+ 2. **Technical components** (Entities, Services/Slices, Controllers/Endpoints, Pages)
183
+ 3. **Infrastructure** (Bicep, migrations, configs)
184
+ 4. **Tests** (Unit tests, integration tests)
185
+
186
+ ### Step 2: Break Into Tasks
187
+
188
+ > For structure, categories, and implementation order, see `references/task-planning-patterns.md`
189
+
190
+ Create tasks using the **T{NNN}** format (T001, T002, ...) following bottom-up order: domain → infrastructure → application → presentation → tests → infra → docs.
191
+
192
+ The T### format is mandatory — it is used by `morph-spec task start/done` commands and the validate-tasks script. Do not use TASK-001, T01, or other formats.
193
+
194
+ ### Step 3: Define Dependencies
195
+
196
+ For each task, specify dependencies:
197
+
198
+ ```json
199
+ {
200
+ "id": "T005",
201
+ "title": "Create {Name}Service",
202
+ "dependencies": ["T001", "T002"],
203
+ "status": "pending"
204
+ }
205
+ ```
206
+
207
+ **Rule:** A task can only be executed when all its dependencies are `completed`.
208
+
209
+ ### Step 4: Establish Checkpoints
210
+
211
+ Define checkpoints after every **3 tasks** — this cadence matches the implementation phase's checkpoint-save frequency. Regular checkpoints catch integration issues early rather than at the end.
212
+
213
+ ```json
214
+ {
215
+ "id": "CHECKPOINT_001",
216
+ "title": "Domain Layer Complete",
217
+ "afterTasks": ["T001", "T002", "T003"],
218
+ "validations": [
219
+ "All entities created",
220
+ "Migrations applied",
221
+ "Domain tests passing"
222
+ ]
223
+ }
224
+ ```
225
+
226
+ ### Step 5: Estimate Effort
227
+
228
+ For each task, estimate time **in minutes** (not vague labels like "Low/Medium"). Specific estimates help the plan phase determine execution strategy and parallelization.
229
+
230
+ | Complexity | Estimated Time |
231
+ |------------|----------------|
232
+ | Trivial (basic CRUD) | 15-30 min |
233
+ | Simple (Service, Controller) | 30-60 min |
234
+ | Medium (Business logic, validations) | 60-120 min |
235
+ | Complex (Integrations, AI) | 120-240 min |
236
+
237
+ ### Step 6: Generate `tasks.md`
238
+
239
+ Create `.morph/features/$ARGUMENTS/4-tasks/tasks.md` with the complete task structure, checkpoints, and estimates.
240
+
241
+ ### Step 7: Include IaC Tasks (if needed)
242
+
243
+ If there are Azure resources, add Bicep and migration tasks.
244
+
245
+ ### Step 8: Update State
246
+
247
+ ```bash
248
+ npx morph-spec state set $ARGUMENTS tasks.total {N}
249
+ npx morph-spec state mark-output $ARGUMENTS tasks
250
+ ```
251
+
252
+ ## Outputs
253
+
254
+ - `.morph/features/$ARGUMENTS/4-tasks/tasks.md` — Complete task breakdown
255
+
256
+ ## Mandatory Approval Pause
257
+
258
+ Use `AskUserQuestion` to capture explicit approval before advancing. This gate prevents implementation from starting with an unapproved task list.
259
+
260
+ ```json
261
+ {
262
+ "questions": [{
263
+ "header": "Approval",
264
+ "question": "Tasks generated. Approve to start implementation?",
265
+ "multiSelect": false,
266
+ "options": [
267
+ { "label": "Approve and implement", "description": "Advance to implementation phase" },
268
+ { "label": "I have feedback", "description": "Type what you want to change" }
269
+ ]
270
+ }]
271
+ }
272
+ ```
273
+
274
+ - **"Approve and implement"** →
275
+ ```bash
276
+ npx morph-spec approve $ARGUMENTS tasks
277
+ npx morph-spec phase advance $ARGUMENTS
278
+ ```
279
+ - **"I have feedback" or "Other"** → apply the feedback and repeat this PAUSE
280
+
281
+ ## Completion Criteria
282
+
283
+ - [x] `tasks.md` created with all tasks
284
+ - [x] Tasks use T### format (T001, T002, ...) consistently
285
+ - [x] Tasks categorized correctly (DDD layers or VSA categories)
286
+ - [x] Dependencies mapped
287
+ - [x] Checkpoints defined (every 3 tasks)
288
+ - [x] Effort estimated in minutes per task
289
+ - [x] Execution order clear
290
+ - [x] IaC tasks included (if applicable)
291
+ - [x] State updated with total tasks (`state set tasks.total`)
292
+ - [x] User approved breakdown via `AskUserQuestion`
293
+
294
+ ---
295
+
296
+ ## Superpowers Integration
297
+
298
+ > Available when the `superpowers` plugin is installed.
299
+
300
+ | Skill | When to Use | Invocation |
301
+ |-------|-------------|-----------|
302
+ | `writing-plans` | After task breakdown, to plan implementation sequence | `Skill(superpowers:writing-plans)` |
303
+ | `executing-plans` | To execute the task plan in a separate session | `Skill(superpowers:executing-plans)` |
304
+
305
+ ---
306
+
307
+ ## Phase Outputs
308
+
309
+ <!-- morph-outputs:tasks -->
310
+ | Output | Caminho |
311
+ |--------|---------|
312
+ | `tasks` | `.morph/features/{feature}/4-tasks/tasks.md` |
313
+ <!-- /morph-outputs -->
314
+
315
+ ---
316
+
317
+ After approval: "Planning complete! Run `/morph-apply $ARGUMENTS` to start implementation."