@polymorphism-tech/morph-spec 4.22.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +57 -71
- package/README.md +2 -2
- package/bin/morph-spec.js +224 -491
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +55 -38
- package/framework/MORPH.md +244 -0
- package/framework/agents.json +127 -1198
- package/framework/commands/morph-apply.md +56 -240
- package/framework/commands/morph-archive.md +48 -85
- package/framework/commands/morph-preflight.md +7 -7
- package/framework/commands/morph-proposal.md +35 -191
- package/framework/commands/morph-status.md +19 -50
- package/framework/commands/morph-troubleshoot.md +2 -2
- package/framework/evals/rubrics/README.md +44 -0
- package/framework/evals/rubrics/architecture.md +46 -0
- package/framework/evals/rubrics/code-quality.md +50 -0
- package/framework/evals/rubrics/contracts.md +47 -0
- package/framework/evals/rubrics/test-coverage.md +50 -0
- package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
- package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
- package/framework/evals/suites/standard.yaml +5 -0
- package/framework/evals/trace-schema.md +67 -0
- package/framework/hooks/claude-code/core/README.md +3 -0
- package/framework/hooks/claude-code/core/denylist.json +14 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
- package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
- package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
- package/framework/hooks/shared/phase-utils.js +20 -31
- package/framework/hooks/shared/state-reader.js +4 -5
- package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -243
- package/framework/phases.json +41 -115
- package/framework/rubrics/eval-rubric.json +66 -0
- package/framework/skills/README.md +39 -64
- package/framework/skills/core/README.md +3 -0
- package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
- package/framework/skills/core/morph-eval/SKILL.md +57 -0
- package/framework/skills/core/morph-implement/SKILL.md +83 -0
- package/framework/skills/core/morph-plan/SKILL.md +64 -0
- package/framework/skills/core/morph-review/SKILL.md +62 -0
- package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
- package/framework/skills/core/morph-standards/SKILL.md +49 -0
- package/framework/templates/CLAUDE.md.core.guide.md +29 -0
- package/framework/templates/CLAUDE.md.core.template +22 -0
- package/framework/templates/REGISTRY.json +4 -4
- package/framework/workflows/configs/fast-track.json +5 -10
- package/framework/workflows/configs/full.json +4 -8
- package/framework/workflows/configs/quick.json +32 -0
- package/framework/workflows/configs/standard.json +57 -64
- package/package.json +7 -6
- package/src/commands/mcp/mcp-setup.js +58 -31
- package/src/commands/project/doctor.js +69 -70
- package/src/commands/project/init.js +26 -5
- package/src/commands/project/status.js +18 -19
- package/src/commands/state/approve.js +1 -1
- package/src/commands/validation/validate-feature.js +18 -112
- package/src/core/paths/output-schema.js +133 -152
- package/src/core/state/phase-state-machine.js +10 -24
- package/src/core/state/state-manager.js +17 -17
- package/src/core/workflows/workflow-detector.js +214 -31
- package/src/core/workflows/workflow-router.js +204 -0
- package/src/dashboard/app/pages/AgentMap.jsx +32 -33
- package/src/dashboard/app/pages/LiveState.jsx +1 -1
- package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
- package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
- package/src/dashboard/app/pages/Workflows.jsx +2 -2
- package/src/dashboard/scanner/agents-scanner.js +30 -35
- package/src/lib/agents/metrics-aggregator.js +1 -1
- package/src/lib/agents/output-collector.js +7 -9
- package/src/lib/context/context-builder.js +289 -0
- package/src/lib/detectors/claude-config-detector.js +19 -3
- package/src/lib/generators/context-generator.js +20 -42
- package/src/lib/generators/index.js +1 -0
- package/src/lib/generators/mandate-generator.js +512 -0
- package/src/lib/generators/metadata-extractor.js +1 -1
- package/src/lib/generators/recap-generator.js +3 -4
- package/src/lib/installers/mcp-installer.js +300 -92
- package/src/lib/phase-chain/phase-validator.js +36 -40
- package/src/lib/stack/stack-profile.js +74 -91
- package/src/lib/tasks/task-parser.js +1 -1
- package/src/lib/tasks/wave-resolver.js +353 -0
- package/src/lib/validators/checkpoint-persistence.js +2 -2
- package/src/lib/validators/content/cross-phase-validator.js +281 -0
- package/src/lib/validators/content/index.js +1 -0
- package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
- package/src/scripts/global-install.js +2 -27
- package/src/utils/agents-installer.js +224 -447
- package/src/utils/claude-settings-manager.js +57 -15
- package/src/utils/file-copier.js +1 -0
- package/src/utils/hooks-installer.js +15 -117
- package/src/utils/skills-installer.js +12 -18
- package/bin/detect-agents.js +0 -226
- package/bin/task-manager.js +0 -1036
- package/framework/agents/README.md +0 -13
- package/framework/agents/ai-agents/ai-system-architect.md +0 -194
- package/framework/agents/ai-agents/vector-search-expert.md +0 -247
- package/framework/agents/architecture/architecture-expert.md +0 -98
- package/framework/agents/architecture/morph-spec-architect.md +0 -66
- package/framework/agents/architecture/packages-validator.md +0 -89
- package/framework/agents/architecture/security-expert.md +0 -79
- package/framework/agents/architecture/seo-growth-hacker.md +0 -168
- package/framework/agents/architecture/standards-architect.md +0 -153
- package/framework/agents/backend/dotnet-senior.md +0 -163
- package/framework/agents/backend/ef-modeler.md +0 -119
- package/framework/agents/backend/hangfire-orchestrator.md +0 -133
- package/framework/agents/backend/ms-agent-expert.md +0 -55
- package/framework/agents/backend/neon-expert.md +0 -379
- package/framework/agents/frontend/css-specialist.md +0 -89
- package/framework/agents/frontend/design-system-validator.md +0 -100
- package/framework/agents/frontend/gsap-animator.md +0 -131
- package/framework/agents/frontend/nextjs-component-validator.md +0 -97
- package/framework/agents/frontend/nextjs-expert.md +0 -201
- package/framework/agents/frontend/ui-designer.md +0 -259
- package/framework/agents/infrastructure/infra-architect.md +0 -215
- package/framework/agents/integrations/asaas-financial.md +0 -138
- package/framework/agents/integrations/neon-auth.md +0 -151
- package/framework/agents/integrations/resend-email.md +0 -127
- package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
- package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
- package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
- package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
- package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
- package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
- package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
- package/framework/hooks/shared/compact-restore.js +0 -123
- package/framework/hooks/shared/dispatch-helpers.js +0 -147
- package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
- package/framework/hooks/shared/stale-task-reset.js +0 -57
- package/framework/hooks/shared/worktree-helpers.js +0 -75
- package/framework/skills/level-0-meta/README.md +0 -7
- package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
- package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
- package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
- package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
- package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
- package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
- package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
- package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
- package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
- package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
- package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
- package/framework/skills/level-0-meta/morph-gemini-image/SKILL.md +0 -290
- package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
- package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -401
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
- package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
- package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
- package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
- package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
- package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
- package/framework/skills/level-1-workflows/README.md +0 -7
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
- package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -634
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -54
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
- package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
- package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
- package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -995
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
- package/framework/squad-templates/backend-only.json +0 -47
- package/framework/squad-templates/frontend-only.json +0 -56
- package/framework/squad-templates/full-stack.json +0 -74
- package/src/commands/agents/agent-metrics.js +0 -174
- package/src/commands/agents/audit-dispatch.js +0 -82
- package/src/commands/agents/detect-agents.js +0 -275
- package/src/commands/agents/dispatch-agents.js +0 -461
- package/src/commands/agents/index.js +0 -13
- package/src/commands/agents/manage-agents.js +0 -352
- package/src/commands/agents/project-metrics.js +0 -74
- package/src/commands/phase/phase-reset.js +0 -74
- package/src/commands/scope/escalate.js +0 -217
- package/src/commands/state/advance-phase.js +0 -600
- package/src/commands/state/phase-runner.js +0 -215
- package/src/commands/state/state.js +0 -444
- package/src/commands/task/expand.js +0 -100
- package/src/commands/tasks/index.js +0 -4
- package/src/commands/tasks/task.js +0 -105
- package/src/commands/templates/index.js +0 -5
- package/src/commands/templates/template-render.js +0 -93
- package/src/commands/trust/trust.js +0 -118
- package/src/lib/agents/agents-manager.js +0 -349
- package/src/lib/build/build-runner.js +0 -99
- package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
- package/src/lib/contracts/sprint-contract-generator.js +0 -137
- package/src/lib/scope/impact-analyzer.js +0 -106
- package/src/lib/trust/trust-manager.js +0 -157
- package/src/utils/tier-helpers.js +0 -24
- /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
|
@@ -1,634 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: morph-phase-implement
|
|
3
|
-
description: MORPH-SPEC Phase 5 (Implement). Executes feature tasks using TDD with checkpoint validation every 3 tasks, smoke tests via Playwright, and generates code + recap.md. Use after task list approval when starting feature implementation.
|
|
4
|
-
argument-hint: "[feature-name]"
|
|
5
|
-
context: fork
|
|
6
|
-
agent: general-purpose
|
|
7
|
-
user-invocable: false
|
|
8
|
-
cliVersion: "4.22.0"
|
|
9
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# MORPH Implement — Phase 5
|
|
13
|
-
|
|
14
|
-
> INTERNAL: Workflow skill used by /morph-apply during automated phase orchestration. Not a user command.
|
|
15
|
-
|
|
16
|
-
Implement the tasks defined in Phase 4, with checkpoints every 3 tasks and a final recap.
|
|
17
|
-
|
|
18
|
-
## Prerequisites
|
|
19
|
-
|
|
20
|
-
- [ ] Phase 4 (Tasks) completed
|
|
21
|
-
- [ ] `tasks.md` approved by user
|
|
22
|
-
- [ ] Tasks gate approved (`morph-spec approve $ARGUMENTS tasks`)
|
|
23
|
-
- [ ] All design outputs exist (spec.md, contracts.cs/.ts, decisions.md)
|
|
24
|
-
|
|
25
|
-
## Step 0: Ensure Implement Phase
|
|
26
|
-
|
|
27
|
-
**Before any reads or writes — verify the current phase:**
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
morph-spec state get $ARGUMENTS
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Check the `"phase"` field:
|
|
34
|
-
|
|
35
|
-
**If `"phase": "implement"`** → correct phase, proceed.
|
|
36
|
-
|
|
37
|
-
**If `"phase": "tasks"`** → run in sequence:
|
|
38
|
-
1. `morph-spec state mark-output $ARGUMENTS tasks`
|
|
39
|
-
2. `morph-spec approve $ARGUMENTS tasks`
|
|
40
|
-
3. `morph-spec phase advance $ARGUMENTS` (→ implement)
|
|
41
|
-
|
|
42
|
-
**Any other value** → STOP — inconsistent state, report to user.
|
|
43
|
-
|
|
44
|
-
> **Rule:** Never write to `5-implement/` until the phase is `implement`. The hook will block writes.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Pre-flight Validation (MANDATORY)
|
|
49
|
-
|
|
50
|
-
Before any task work, validate that prior phases are truly complete. `state.json` may have been set manually — these commands verify actual filesystem artifacts.
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# 1. Verify mandatory outputs from all prior phases
|
|
54
|
-
morph-spec validate-feature $ARGUMENTS
|
|
55
|
-
|
|
56
|
-
# 2. Confirm all approval gates passed
|
|
57
|
-
morph-spec approval-status $ARGUMENTS
|
|
58
|
-
|
|
59
|
-
# 3. Verify activeAgents are populated
|
|
60
|
-
morph-spec state get $ARGUMENTS | grep -A5 activeAgents
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
If any check fails → **STOP**. Do not start any task. Report what's missing:
|
|
64
|
-
|
|
65
|
-
| Problem | Resolution |
|
|
66
|
-
|---------|-----------|
|
|
67
|
-
| Missing output (spec.md, contracts, etc.) | Return to corresponding phase and generate it |
|
|
68
|
-
| Gate not approved (design, plan, tasks) | `morph-spec approve $ARGUMENTS <gate>` |
|
|
69
|
-
| Invalid phase | `morph-spec phase advance $ARGUMENTS` |
|
|
70
|
-
| Empty activeAgents | Run `/phase-setup $ARGUMENTS` first |
|
|
71
|
-
|
|
72
|
-
**This step is not optional.** Only proceed when all commands return without errors.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Pre-flight — Tool Availability
|
|
77
|
-
|
|
78
|
-
Before starting tasks, verify that CLIs and MCPs needed for this phase are available. The `inject-morph-context` hook reports both at session start.
|
|
79
|
-
|
|
80
|
-
**1. Check CLIs (from session context `CLIs:` line):**
|
|
81
|
-
|
|
82
|
-
| CLI | Required for | If missing |
|
|
83
|
-
|-----|-------------|------------|
|
|
84
|
-
| `docker` | Container services (Redis, etc.) | Start Docker Desktop |
|
|
85
|
-
| `neonctl` | Neon database management, migrations | `npm install -g neonctl` |
|
|
86
|
-
| `psql` | Direct DB queries | Install PostgreSQL client |
|
|
87
|
-
| `az` | Azure resource management | `winget install Microsoft.AzureCLI` |
|
|
88
|
-
| `gh` | GitHub PRs, issues | `winget install GitHub.cli` |
|
|
89
|
-
|
|
90
|
-
If a critical CLI shows `✗`, use `AskUserQuestion` to ask the user:
|
|
91
|
-
- **Install now** — provide the install command
|
|
92
|
-
- **Continue without it** — use fallback (e.g., WebSearch instead of `az`)
|
|
93
|
-
- **Stop implementation** — user must fix and re-run
|
|
94
|
-
|
|
95
|
-
**2. Check MCPs (from session context `MCPs:` line):**
|
|
96
|
-
|
|
97
|
-
For each MCP showing `✗ (recommended)`:
|
|
98
|
-
|
|
99
|
-
| MCP | Fallback |
|
|
100
|
-
|-----|----------|
|
|
101
|
-
| **Context7** | WebSearch + WebFetch |
|
|
102
|
-
| **Playwright** | `curl` / WebFetch (limited — no JS rendering) |
|
|
103
|
-
| **GitHub** | `gh` CLI |
|
|
104
|
-
| **Vercel** | `vercel` CLI |
|
|
105
|
-
|
|
106
|
-
> **Design:** This check is fail-open — consistent with morph-spec philosophy. Missing tools are warnings, not blockers (except `docker` for container-dependent projects).
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Scaffold & Code Templates (MANDATORY before first task)
|
|
111
|
-
|
|
112
|
-
Before writing any implementation code, scaffold the feature structure using the CLI.
|
|
113
|
-
|
|
114
|
-
### For .NET backend tasks (VSA):
|
|
115
|
-
|
|
116
|
-
**Scaffold all CRUD slices for the feature:**
|
|
117
|
-
```bash
|
|
118
|
-
morph-spec scaffold dotnet $ENTITY create-$ENTITY
|
|
119
|
-
morph-spec scaffold dotnet $ENTITY get-${ENTITY}-by-id
|
|
120
|
-
morph-spec scaffold dotnet $ENTITY get-all-${ENTITY}s
|
|
121
|
-
morph-spec scaffold dotnet $ENTITY update-$ENTITY
|
|
122
|
-
morph-spec scaffold dotnet $ENTITY delete-$ENTITY
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
> Entity and errors are generated with the first slice and auto-skipped on subsequent ones.
|
|
126
|
-
> After scaffolding, customize: fill in request/response properties, validation rules, and handler logic per contracts.cs.
|
|
127
|
-
|
|
128
|
-
### For Next.js frontend tasks:
|
|
129
|
-
|
|
130
|
-
**Scaffold the feature page:**
|
|
131
|
-
```bash
|
|
132
|
-
morph-spec scaffold nextjs $FEATURE
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
> After scaffolding, customize: add columns to DataTable, form fields, and Zod schema.
|
|
136
|
-
|
|
137
|
-
### Template reference (for manual adjustments):
|
|
138
|
-
```bash
|
|
139
|
-
cat .morph/framework/templates/code/dotnet/feature/endpoint.cs.hbs
|
|
140
|
-
cat .morph/framework/templates/frontend/nextjs/page.tsx.hbs
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
> **Rule:** All code MUST follow the patterns in these templates. Scaffold guarantees this. Do not invent different patterns.
|
|
144
|
-
|
|
145
|
-
See `.morph/framework/templates/` for the full template index (abstractions, extensions, pipelines, jobs, tests).
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Recommended Tools
|
|
150
|
-
|
|
151
|
-
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
|
|
152
|
-
> **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
|
|
153
|
-
> **Example:** `references/recap-example.md` — filled-in recap.md showing expected output quality.
|
|
154
|
-
|
|
155
|
-
| Action | Tool | Alternative |
|
|
156
|
-
|--------|------|-------------|
|
|
157
|
-
| Get dispatch recommendation | **Bash** `morph-spec dispatch-agents $ARGUMENTS implement` | Agent recommendations + task routing |
|
|
158
|
-
| **Dispatch implementers by domain** | **Agent** `subagent_type=<recommended[group][0]>` — agent .md file provides the prompt | Backend + frontend + infra in parallel |
|
|
159
|
-
| Read task details | **Read** tasks.md, spec.md, contracts.cs/.ts | — |
|
|
160
|
-
| Create new files | **Write** source files | — |
|
|
161
|
-
| Modify existing files | **Edit** source files | — |
|
|
162
|
-
| Look up library API | **Context7 MCP** `query_docs()` | **WebSearch** + **WebFetch** |
|
|
163
|
-
| Run migrations | **Bash** `dotnet ef database update` | `psql <DB_URL>` for verification |
|
|
164
|
-
| Build project | **Bash** `dotnet build` or `npm run build` | — |
|
|
165
|
-
| Run tests | **Bash** `dotnet test` or `npm test` | — |
|
|
166
|
-
| Checkpoint validation | **Bash** `morph-spec validate-feature ...` | — |
|
|
167
|
-
| Mark task complete | **Bash** `morph-spec task done $ARGUMENTS T001` | — |
|
|
168
|
-
| Smoke test in browser | **Playwright MCP** `browser_navigate()` + `browser_snapshot()` | Manual |
|
|
169
|
-
| Check console errors | **Playwright MCP** `browser_console_messages()` | — |
|
|
170
|
-
| Screenshot for recap | **Playwright MCP** `browser_take_screenshot()` | — |
|
|
171
|
-
| Deploy and logs Vercel | **Vercel MCP** `list_projects()`, `get_deployments()`, `manage_env_vars()` | **Bash** `vercel deploy` |
|
|
172
|
-
| Create PR | **Bash** `gh pr create ...` | **GitHub MCP** `create_pull_request()` |
|
|
173
|
-
| Update state | **Bash** `morph-spec state set ...` | — |
|
|
174
|
-
|
|
175
|
-
**Phase tools:** Docker CLI (container health, logs), Neon CLI (`neonctl`) (database management), EF Core CLI (migrations), Context7 (API lookup), Playwright (smoke test), GitHub (PRs), Vercel (deploy, logs, env vars).
|
|
176
|
-
|
|
177
|
-
> **Database Migrations:** When creating or running database migrations, use `dotnet ef migrations add <name>` to create, then `dotnet ef database update` to apply. Verify with `pg_dump $(neonctl connection-string) --schema public` or `psql` against the Neon database (get DB URL from `neonctl connection-string`).
|
|
178
|
-
|
|
179
|
-
**Anti-patterns:**
|
|
180
|
-
- Task agent for editing a single file (use Edit directly)
|
|
181
|
-
- Subagents for single-domain features (sequential suffices)
|
|
182
|
-
- `Bash cat` to create files (use Write tool)
|
|
183
|
-
- `Bash sed` to modify code (use Edit tool)
|
|
184
|
-
- Implementing without reading contracts.cs/.ts first (contracts are the source of truth!)
|
|
185
|
-
- Running backend and frontend tasks sequentially when they are independent
|
|
186
|
-
- **(VSA)** Creating Application Service layer — handler accesses IRepository directly
|
|
187
|
-
- **(VSA)** Manually registering handlers/endpoints in Program.cs — use auto-discovery via reflection
|
|
188
|
-
- **(VSA)** Placing Request/Response in separate files from Handler
|
|
189
|
-
- **(VSA)** Using `Guid.NewGuid()` — use `Guid.CreateVersion7()`
|
|
190
|
-
- Trying to fix a bug without invoking `systematic-debugging` first
|
|
191
|
-
|
|
192
|
-
> **Docker CLI:** If a build or test fails with connection errors to local services (Redis, etc.), check container health first: `docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"`. For debugging: `docker logs <container> --tail 50` to see recent logs. To restart a stuck container: `docker restart <container>`.
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## Context Loading
|
|
197
|
-
|
|
198
|
-
### 1. Read full context in PARALLEL
|
|
199
|
-
|
|
200
|
-
```
|
|
201
|
-
# Single parallel call, not sequential:
|
|
202
|
-
Read: .morph/features/{feature}/4-tasks/tasks.md
|
|
203
|
-
+ Read: .morph/features/{feature}/2-design/spec.md
|
|
204
|
-
+ Read: .morph/features/{feature}/2-design/contracts.cs (or contracts.ts for TypeScript projects)
|
|
205
|
-
+ Read: .morph/config/config.json (→ architecture.style)
|
|
206
|
-
+ Read: .morph/features/{feature}/3-plan/plan.md
|
|
207
|
-
+ Read: .morph/features/{feature}/1-ui/assets.md (if exists — image asset specs)
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### 2. Detect architecture style
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
cat .morph/config/config.json | grep architecture
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
If `config.architecture.style === "vertical-slice"` → follow **Step 1.5** before implementing.
|
|
217
|
-
Otherwise → go directly to the task loop.
|
|
218
|
-
|
|
219
|
-
### Step 1.5: VSA Implementation Guide (only if `style: "vertical-slice"`)
|
|
220
|
-
|
|
221
|
-
> For the complete slice structure and VSA rules, see `references/vsa-implementation-guide.md`
|
|
222
|
-
|
|
223
|
-
Structure: `Features/{Entity}Feature/{Op}/` with Handler (+ Request/Response records) + Validator + Endpoint per slice. Everything `sealed`. `Guid.CreateVersion7()`. `result.Match()` in endpoints. No Application Service layer — handler accesses IRepository directly. Auto-discovery via reflection: do not manually register in Program.cs.
|
|
224
|
-
|
|
225
|
-
### 3. UI Reference Loading (Stitch HTML)
|
|
226
|
-
|
|
227
|
-
> **Skip if:** `.morph/features/{feature}/1-ui/stitch-screen-map.json` does not exist.
|
|
228
|
-
> This section is OPTIONAL — only applies when the UI/UX phase used Stitch MCP.
|
|
229
|
-
|
|
230
|
-
If `stitch-screen-map.json` exists, this feature has Stitch HTML exports for visual fidelity:
|
|
231
|
-
|
|
232
|
-
1. **Read the screen map and CSS mapping in parallel:**
|
|
233
|
-
```
|
|
234
|
-
Read: .morph/features/{feature}/1-ui/stitch-screen-map.json
|
|
235
|
-
Read: .morph/features/{feature}/1-ui/stitch-html/stitch-css-map.json
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
2. **For each task that modifies a page/route:**
|
|
239
|
-
- Parse the task description for route references (e.g., `/dashboard`, `/settings`)
|
|
240
|
-
- Find the matching screen in `stitch-screen-map.json` by route
|
|
241
|
-
- Read the corresponding HTML file:
|
|
242
|
-
```
|
|
243
|
-
Read: .morph/features/{feature}/1-ui/stitch-html/{screenId}.html
|
|
244
|
-
```
|
|
245
|
-
- Include the HTML in the agent's context along with the CSS mapping
|
|
246
|
-
|
|
247
|
-
3. **Translation rules for agents:**
|
|
248
|
-
When implementing from Stitch HTML, agents MUST:
|
|
249
|
-
- Replace Stitch inline color values with project CSS custom properties using `stitch-css-map.json`
|
|
250
|
-
- Preserve the **layout structure** (flex/grid hierarchy, element nesting) from Stitch HTML
|
|
251
|
-
- Preserve **typography hierarchy** (heading levels, font sizes, weights)
|
|
252
|
-
- Map Stitch HTML elements to the chosen UI library components (e.g., `<div class="card">` → shadcn `<Card>`)
|
|
253
|
-
- Respect the Stitch spacing proportions, mapping to project spacing tokens
|
|
254
|
-
- For unmapped values in `stitch-css-map.json`, add them as new tokens to `design-system.md`
|
|
255
|
-
|
|
256
|
-
> **Source of truth hierarchy:** The Stitch HTML is the visual source of truth. `mockups.md` describes
|
|
257
|
-
> behavior and states; the HTML describes exact visual structure. When they conflict, the HTML wins for
|
|
258
|
-
> layout/visual, mockups.md wins for behavior/states.
|
|
259
|
-
|
|
260
|
-
### 4. Image Asset Generation (Gemini Image MCP)
|
|
261
|
-
|
|
262
|
-
> **Skip if:** `.morph/features/{feature}/1-ui/assets.md` does not exist.
|
|
263
|
-
> **Skip if:** Gemini Image MCP is not available.
|
|
264
|
-
> This section is OPTIONAL — only applies when the UI/UX phase created an assets.md spec.
|
|
265
|
-
|
|
266
|
-
If `assets.md` exists, this feature has image assets to generate during implementation:
|
|
267
|
-
|
|
268
|
-
1. **Read the assets spec:**
|
|
269
|
-
```
|
|
270
|
-
Read: .morph/features/{feature}/1-ui/assets.md
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
2. **When a task involves a component listed in assets.md:**
|
|
274
|
-
- Find the matching IMG-NNN entry by component name or route
|
|
275
|
-
- Invoke `/morph-gemini-image` with the asset spec:
|
|
276
|
-
- Pass the `Prompt` field as the generation prompt
|
|
277
|
-
- Pass the `Aspect Ratio` field
|
|
278
|
-
- Pass the `Output Path` field
|
|
279
|
-
- If the image needs refinement, use `edit_image` or `continue_editing`
|
|
280
|
-
|
|
281
|
-
3. **Integrate the generated image into the component:**
|
|
282
|
-
```tsx
|
|
283
|
-
import Image from 'next/image';
|
|
284
|
-
|
|
285
|
-
<Image
|
|
286
|
-
src="/images/{feature}/{name}.png"
|
|
287
|
-
alt="{descriptive alt text}"
|
|
288
|
-
width={width}
|
|
289
|
-
height={height}
|
|
290
|
-
priority // if above-the-fold
|
|
291
|
-
/>
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
4. **Verify build compiles** after adding the image reference.
|
|
295
|
-
|
|
296
|
-
> **Important:** Generate images DURING the task that builds the component, not as a separate step.
|
|
297
|
-
> This keeps the image contextually linked to the component code.
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
## Workflow
|
|
302
|
-
|
|
303
|
-
### Step 0.5: Dispatch Recommendation
|
|
304
|
-
|
|
305
|
-
Get agent dispatch recommendation:
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
morph-spec dispatch-agents $ARGUMENTS implement
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
The output is a JSON advisor — it recommends which agents to use and which tasks they handle:
|
|
312
|
-
- `recommended`: `{ [group]: subagentType[] }` — maps groups to agent file names
|
|
313
|
-
- `tasks`: `{ [group]: taskId[] }` — maps groups to task IDs from tasks.md
|
|
314
|
-
- `shouldDispatch`: true if 2+ agents available (parallel dispatch beneficial)
|
|
315
|
-
|
|
316
|
-
**If `shouldDispatch` is true:**
|
|
317
|
-
|
|
318
|
-
1. Read `recommended` — maps groups (backend, frontend, etc.) to agent subagentTypes
|
|
319
|
-
2. Read `tasks` — maps groups to task IDs
|
|
320
|
-
3. For each agent, verify `.claude/agents/{subagentType}.md` exists. If missing → **STOP** with: `"Agent file not found. Run: morph-spec setup-infra"`. Do NOT fall back to general-purpose agents.
|
|
321
|
-
4. Dispatch each group in **parallel** using native Agent tool:
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
Agent(subagent_type="morph-dotnet-senior", prompt="Implement tasks T001, T002 for feature {feature}. Read .morph/features/{feature}/4-tasks/tasks.md for task details and .morph/features/{feature}/2-design/ for contracts and spec. Follow the task loop: start → implement → verify → done. Checkpoint every 3 tasks. Domain isolation: modify ONLY files in your domain.")
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
> **MANDATORY:** Use the exact `subagentType` value from `recommended`. Do NOT use `general-purpose` agents when a `subagentType` is available.
|
|
328
|
-
>
|
|
329
|
-
> The agent `.md` file contains the full expertise prompt, task routing, and key standards. No additional prompt injection needed — just provide the task assignment.
|
|
330
|
-
>
|
|
331
|
-
> **If Stitch HTML exists:** When dispatching frontend agents, read `stitch-screen-map.json` and include
|
|
332
|
-
> the relevant screen HTML for each agent's assigned tasks. Populate the `{{STITCH_CONTEXT}}` placeholder
|
|
333
|
-
> in `implementer-prompt.md` with the screen HTML and CSS mapping for the routes that agent is implementing.
|
|
334
|
-
>
|
|
335
|
-
> **If assets.md exists:** When dispatching frontend agents, read `assets.md` and include
|
|
336
|
-
> the relevant IMG-NNN entries for each agent's assigned routes. Populate the `{{ASSETS_CONTEXT}}`
|
|
337
|
-
> placeholder in `implementer-prompt.md` with the image specs for the routes that agent is implementing.
|
|
338
|
-
|
|
339
|
-
5. After all subagents complete, validate integration: `morph-spec validate-feature $ARGUMENTS --phase implement`
|
|
340
|
-
|
|
341
|
-
**If `shouldDispatch` is false** → continue to sequential task loop (Step 2).
|
|
342
|
-
|
|
343
|
-
**Fallback:** If `dispatch-agents` fails (non-zero exit or invalid JSON), log a warning and fall back to sequential single-agent mode (Step 2).
|
|
344
|
-
|
|
345
|
-
---
|
|
346
|
-
|
|
347
|
-
### Step 2: Task Loop
|
|
348
|
-
|
|
349
|
-
For each task (T001 → T00N):
|
|
350
|
-
|
|
351
|
-
1. **Start task:**
|
|
352
|
-
```bash
|
|
353
|
-
morph-spec task start $ARGUMENTS T001
|
|
354
|
-
```
|
|
355
|
-
2. **Read FR context** (MANDATORY — NON-NEGOTIABLE):
|
|
356
|
-
- Parse task's `[FR references]` from tasks.md (e.g., `### T001: Create user endpoint [FR001, FR003]`)
|
|
357
|
-
- **Read spec.md** → the sections for those specific FRs (functional requirements, acceptance criteria)
|
|
358
|
-
- **Read contracts.cs/.ts** → the DTOs/interfaces referenced by those FRs
|
|
359
|
-
- The spec is the source of truth. Code that doesn't match the spec is a bug.
|
|
360
|
-
> **MCP:** Before implementing, use **Context7 MCP** (`resolve-library-id` → `query-docs`) to verify the correct API of the libraries being used. If Context7 is not available, use **WebSearch** + **WebFetch** to check official docs.
|
|
361
|
-
3. **Implement** using Write (new) or Edit (existing)
|
|
362
|
-
4. **Verify** — build, lint, tests
|
|
363
|
-
5. **MANDATORY — Verification before `task done`:**
|
|
364
|
-
Run `validate-feature` before marking ANY task as done. This is non-negotiable — it catches broken code, missing files, and spec violations before they compound across tasks.
|
|
365
|
-
```bash
|
|
366
|
-
morph-spec validate-feature $ARGUMENTS --phase implement
|
|
367
|
-
```
|
|
368
|
-
Only proceed to step 6 if verification passes. If it fails → fix before marking `task done`.
|
|
369
|
-
6. **Mark as done via CLI:**
|
|
370
|
-
```bash
|
|
371
|
-
morph-spec task done $ARGUMENTS T001
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### Step 2.5: Scope Escalation (when task is too complex)
|
|
375
|
-
|
|
376
|
-
If during implementation a task reveals significantly more complexity than estimated:
|
|
377
|
-
|
|
378
|
-
- **Low impact (1-3 subtasks):** Expand the task directly:
|
|
379
|
-
```bash
|
|
380
|
-
morph-spec task expand $ARGUMENTS T001 --into "T001a: First sub" "T001b: Second sub"
|
|
381
|
-
```
|
|
382
|
-
Then implement each subtask following the same loop above.
|
|
383
|
-
|
|
384
|
-
- **Medium/High impact (4+ tasks or spec is wrong):** Run the scope escalation workflow:
|
|
385
|
-
```bash
|
|
386
|
-
/morph-scope-escalation $ARGUMENTS
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
**Rule:** Never implement extra functionality within a task without registering it. If a task takes more than expected, expand it into subtasks — this ensures validation gates run for each piece and progress is tracked accurately.
|
|
390
|
-
|
|
391
|
-
### Step 3: Checkpoint Every 3 Tasks
|
|
392
|
-
|
|
393
|
-
**After every 3 completed tasks:**
|
|
394
|
-
|
|
395
|
-
```bash
|
|
396
|
-
# Save checkpoint
|
|
397
|
-
morph-spec checkpoint-save $ARGUMENTS
|
|
398
|
-
|
|
399
|
-
# Run validation
|
|
400
|
-
morph-spec validate-feature $ARGUMENTS --phase implement
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
**If validation fails:**
|
|
404
|
-
1. Do NOT advance to the next task
|
|
405
|
-
2. Fix reported issues
|
|
406
|
-
3. Re-run validation
|
|
407
|
-
4. Only then proceed
|
|
408
|
-
|
|
409
|
-
### Step 4: Test-Driven Development (Recommended)
|
|
410
|
-
|
|
411
|
-
For each implementation task:
|
|
412
|
-
|
|
413
|
-
1. **Write test first** (unit test for service/domain)
|
|
414
|
-
2. **Run test** — should fail (RED)
|
|
415
|
-
3. **Implement** the minimum to pass
|
|
416
|
-
4. **Run test** — should pass (GREEN)
|
|
417
|
-
5. **Refactor** if needed (REFACTOR)
|
|
418
|
-
|
|
419
|
-
```bash
|
|
420
|
-
# .NET
|
|
421
|
-
dotnet test --filter "FullyQualifiedName~{TestClass}"
|
|
422
|
-
|
|
423
|
-
# Node.js
|
|
424
|
-
npm test -- test/path/to/test.js
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Step 5: Smoke Test with Playwright (if UI)
|
|
428
|
-
|
|
429
|
-
> **MCP:** After implementing an API endpoint or page, if **Playwright MCP** is available, immediately do a quick smoke test: navigate to the endpoint/page URL, call `browser_snapshot()` to verify it loads, and check `browser_console_messages({ level: 'error' })` for errors. Catch issues while context is fresh rather than waiting for post-implementation. If Playwright is not available, verify manually via `curl` or browser.
|
|
430
|
-
|
|
431
|
-
After implementing visual components:
|
|
432
|
-
|
|
433
|
-
```javascript
|
|
434
|
-
// Navigate to the page
|
|
435
|
-
await mcp__playwright__browser_navigate({ url: 'http://localhost:5000/feature-page' });
|
|
436
|
-
|
|
437
|
-
// Capture page state
|
|
438
|
-
await mcp__playwright__browser_snapshot();
|
|
439
|
-
|
|
440
|
-
// Check console errors
|
|
441
|
-
await mcp__playwright__browser_console_messages({ level: 'error' });
|
|
442
|
-
|
|
443
|
-
// Screenshot for recap
|
|
444
|
-
await mcp__playwright__browser_take_screenshot({ type: 'png' });
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
### Step 5.5: Visual Verification against Stitch (Optional)
|
|
448
|
-
|
|
449
|
-
> **Skip if:** `.morph/features/$ARGUMENTS/1-ui/stitch-screen-map.json` does not exist.
|
|
450
|
-
> **Skip if:** Playwright MCP is not available.
|
|
451
|
-
> **Skip if:** Dev server is not running.
|
|
452
|
-
> This step is strongly recommended but not blocking — consistent with fail-open philosophy.
|
|
453
|
-
|
|
454
|
-
After implementing visual components, compare against the Stitch reference:
|
|
455
|
-
|
|
456
|
-
1. **Load screen map:**
|
|
457
|
-
```
|
|
458
|
-
Read: .morph/features/$ARGUMENTS/1-ui/stitch-screen-map.json
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
2. **For each screen that was implemented in the current task batch:**
|
|
462
|
-
|
|
463
|
-
a. **Screenshot the implemented page:**
|
|
464
|
-
```
|
|
465
|
-
mcp__plugin_playwright_playwright__browser_navigate({ url: '{devServerUrl}{route}' })
|
|
466
|
-
mcp__plugin_playwright_playwright__browser_resize({ width: 1440, height: 900 })
|
|
467
|
-
mcp__plugin_playwright_playwright__browser_take_screenshot({})
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
b. **Read the original Stitch screenshot:**
|
|
471
|
-
```
|
|
472
|
-
Read: .morph/features/$ARGUMENTS/1-ui/stitch-screen-{index}.png
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
c. **Compare visually** (multimodal comparison of both images):
|
|
476
|
-
- **Layout:** Grid/flex structure matching? Sections in correct positions?
|
|
477
|
-
- **Typography:** Heading sizes, weights, font families consistent?
|
|
478
|
-
- **Colors:** Mapped CSS tokens producing visually similar colors?
|
|
479
|
-
- **Spacing:** Margins and paddings proportionally similar?
|
|
480
|
-
- **Interactive elements:** Buttons, inputs, cards styled similarly?
|
|
481
|
-
|
|
482
|
-
d. **Document results** in `.morph/features/$ARGUMENTS/5-implement/visual-verification.md`:
|
|
483
|
-
```markdown
|
|
484
|
-
# Visual Verification — {feature}
|
|
485
|
-
|
|
486
|
-
## Screen: {title} ({route})
|
|
487
|
-
|
|
488
|
-
| Aspect | Match | Notes |
|
|
489
|
-
|--------|-------|-------|
|
|
490
|
-
| Layout | ✓/✗ | {notes} |
|
|
491
|
-
| Typography | ✓/✗ | {notes} |
|
|
492
|
-
| Colors | ✓/✗ | {notes} |
|
|
493
|
-
| Spacing | ✓/✗ | {notes} |
|
|
494
|
-
| Interactive | ✓/✗ | {notes} |
|
|
495
|
-
|
|
496
|
-
**Overall:** {PASS/NEEDS_WORK}
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
e. **If NEEDS_WORK:** Fix the most impactful discrepancies (layout first, then colors,
|
|
500
|
-
then typography). Re-screenshot and re-compare. Maximum 2 iteration rounds to avoid
|
|
501
|
-
infinite loops.
|
|
502
|
-
|
|
503
|
-
3. **Skip gracefully** if any prerequisite is missing (log warning, continue to Step 6).
|
|
504
|
-
|
|
505
|
-
### Step 6: Generate `recap.md`
|
|
506
|
-
|
|
507
|
-
After ALL tasks completed:
|
|
508
|
-
|
|
509
|
-
```bash
|
|
510
|
-
morph-spec generate recap $ARGUMENTS
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
> For the full recap format, see `references/recap-example.md`
|
|
514
|
-
|
|
515
|
-
### Step 7: Update State
|
|
516
|
-
|
|
517
|
-
```bash
|
|
518
|
-
morph-spec state set $ARGUMENTS status done
|
|
519
|
-
morph-spec state mark-output $ARGUMENTS recap
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
### Step 8: Post-Implementation Review (mandatory before PR)
|
|
523
|
-
|
|
524
|
-
```bash
|
|
525
|
-
/post-implementation $ARGUMENTS
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
Run the `post-implementation` skill before creating the PR. It orchestrates:
|
|
529
|
-
- Automated scans (CRITICAL findings block PR)
|
|
530
|
-
- Full test suite
|
|
531
|
-
- Final `validate-feature`
|
|
532
|
-
- Smoke test via Playwright (mandatory if dev server active)
|
|
533
|
-
- Code review checklist (CRITICAL + HIGH)
|
|
534
|
-
- **`morph-checklist`** — compliance (security, SEO, performance, accessibility, LGPD)
|
|
535
|
-
- Checkpoint + final recap
|
|
536
|
-
|
|
537
|
-
### Step 9: Frontend Review (NEXTJS/FULLSTACK)
|
|
538
|
-
|
|
539
|
-
If stack is NEXTJS or FULLSTACK:
|
|
540
|
-
|
|
541
|
-
```bash
|
|
542
|
-
/frontend-review $ARGUMENTS
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
Complements `post-implementation` with: accessibility scan (static + axe-core runtime),
|
|
546
|
-
responsive screenshots (mobile/tablet/desktop), and SEO metadata verification.
|
|
547
|
-
|
|
548
|
-
---
|
|
549
|
-
|
|
550
|
-
## Morph-Native Dispatch
|
|
551
|
-
|
|
552
|
-
morph-spec uses its own agents and validators for implementation, dispatch, and review.
|
|
553
|
-
|
|
554
|
-
### Implementation
|
|
555
|
-
|
|
556
|
-
Get dispatch recommendation and use native Agent tool:
|
|
557
|
-
```bash
|
|
558
|
-
morph-spec dispatch-agents $ARGUMENTS implement
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
Use `recommended[group]` subagentTypes directly:
|
|
562
|
-
```
|
|
563
|
-
Agent(subagent_type="morph-dotnet-senior", prompt="Implement tasks T001, T002 for feature X...")
|
|
564
|
-
```
|
|
565
|
-
|
|
566
|
-
> Agent `.md` files are self-contained — they include the expertise prompt, task routing, and key standards. The `subagentType` maps to `.claude/agents/` filenames:
|
|
567
|
-
> - Tier 1-3: `morph-{id}` (e.g., `morph-dotnet-senior`)
|
|
568
|
-
> - Tier 4: `morph-validator-{id}` (e.g., `morph-validator-architecture-expert`)
|
|
569
|
-
|
|
570
|
-
### Review (Two-Stage)
|
|
571
|
-
|
|
572
|
-
**Stage 1 — Spec Compliance (mandatory):**
|
|
573
|
-
```
|
|
574
|
-
Agent(subagent_type=<validator subagentType>, prompt=<filled prompts/spec-reviewer-prompt.md>)
|
|
575
|
-
```
|
|
576
|
-
Use validators from `dispatch-agents --mode validate`. Spec compliance MUST pass before proceeding.
|
|
577
|
-
|
|
578
|
-
**Stage 2 — Code Quality (mandatory):**
|
|
579
|
-
```
|
|
580
|
-
Agent(subagent_type=morph-standards-architect, prompt=<filled prompts/code-quality-reviewer-prompt.md>)
|
|
581
|
-
```
|
|
582
|
-
`critical` issues block. `important` issues must be fixed. `suggestion` is optional.
|
|
583
|
-
|
|
584
|
-
### Prompt Templates
|
|
585
|
-
|
|
586
|
-
| Template | Usage |
|
|
587
|
-
|----------|-------|
|
|
588
|
-
| `prompts/implementer-prompt.md` | Dispatch to implementer agents |
|
|
589
|
-
| `prompts/spec-reviewer-prompt.md` | Spec compliance review |
|
|
590
|
-
| `prompts/code-quality-reviewer-prompt.md` | Code quality review |
|
|
591
|
-
|
|
592
|
-
---
|
|
593
|
-
|
|
594
|
-
## Outputs
|
|
595
|
-
|
|
596
|
-
- Implemented source code (various files)
|
|
597
|
-
- Unit and integration tests
|
|
598
|
-
- `.morph/features/$ARGUMENTS/5-implement/recap.md` — Implementation summary
|
|
599
|
-
|
|
600
|
-
## Completion Criteria
|
|
601
|
-
|
|
602
|
-
- [x] All tasks completed
|
|
603
|
-
- [x] Build compiles without errors
|
|
604
|
-
- [x] Tests passing
|
|
605
|
-
- [x] Validation pipeline passes
|
|
606
|
-
- [x] `recap.md` generated
|
|
607
|
-
- [x] State updated to `status: done`
|
|
608
|
-
- [x] Checkpoints saved every 3 tasks
|
|
609
|
-
- [x] `/post-implementation` executed without BLOCKs
|
|
610
|
-
|
|
611
|
-
---
|
|
612
|
-
|
|
613
|
-
## Phase Outputs
|
|
614
|
-
|
|
615
|
-
<!-- morph-outputs:implement -->
|
|
616
|
-
| Output | Caminho |
|
|
617
|
-
|--------|---------|
|
|
618
|
-
| `recap` | `.morph/features/{feature}/5-implement/recap.md` |
|
|
619
|
-
<!-- /morph-outputs -->
|
|
620
|
-
|
|
621
|
-
---
|
|
622
|
-
|
|
623
|
-
## Relevant Standards
|
|
624
|
-
|
|
625
|
-
During implementation, standards auto-load via rules when editing relevant file types.
|
|
626
|
-
For proactive reference:
|
|
627
|
-
- Architecture: `.morph/framework/standards/architecture/` — structural compliance
|
|
628
|
-
- Backend/Frontend: `.morph/framework/standards/backend/` or `.morph/framework/standards/frontend/`
|
|
629
|
-
- Security: `.morph/framework/standards/security/` — authentication, authorization patterns
|
|
630
|
-
- Testing: follow the project's existing test patterns (check `test/` or `tests/` directory)
|
|
631
|
-
|
|
632
|
-
---
|
|
633
|
-
|
|
634
|
-
Feature complete! Consider creating a PR and running `morph-spec generate recap $ARGUMENTS`.
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Morph-Spec Code Quality Review
|
|
2
|
-
|
|
3
|
-
You are the standards-architect reviewer for feature '{{FEATURE_NAME}}'.
|
|
4
|
-
|
|
5
|
-
## Review Scope
|
|
6
|
-
|
|
7
|
-
Review the implementation for code quality, architecture compliance, and adherence to project standards.
|
|
8
|
-
|
|
9
|
-
## Reference Documents
|
|
10
|
-
|
|
11
|
-
Read these before reviewing:
|
|
12
|
-
- `.morph/context/standards.md` — Project coding standards
|
|
13
|
-
- `.morph/context/README.md` — Project architecture overview
|
|
14
|
-
- `framework/standards/` — Framework-level standards (reference as needed)
|
|
15
|
-
|
|
16
|
-
## Review Checklist
|
|
17
|
-
|
|
18
|
-
1. **Naming Conventions** — PascalCase for types, camelCase for variables, kebab-case for files (or as defined in standards)
|
|
19
|
-
2. **Architecture Compliance** — Code follows the project's VSA architecture pattern (Handler + Validator + Endpoint per feature folder)
|
|
20
|
-
3. **Async Patterns** — CancellationToken propagated, no fire-and-forget, proper await
|
|
21
|
-
4. **Error Handling** — Appropriate exceptions, no swallowed errors, consistent patterns
|
|
22
|
-
5. **Security** — No hardcoded secrets, SQL injection, XSS vectors, or OWASP top 10 issues
|
|
23
|
-
6. **DI Lifetimes** — Correct service registration (Scoped for DB, Singleton for config, etc.)
|
|
24
|
-
7. **Test Quality** — Tests follow Arrange-Act-Assert, meaningful assertions, no test duplication
|
|
25
|
-
|
|
26
|
-
## Output Format
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{
|
|
30
|
-
"passed": true/false,
|
|
31
|
-
"issues": [
|
|
32
|
-
{
|
|
33
|
-
"severity": "critical|important|suggestion",
|
|
34
|
-
"file": "path/to/file",
|
|
35
|
-
"line": 42,
|
|
36
|
-
"description": "What the issue is",
|
|
37
|
-
"fix": "How to fix it"
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Rules
|
|
44
|
-
|
|
45
|
-
- `critical` issues MUST be fixed before merge
|
|
46
|
-
- `important` issues SHOULD be fixed
|
|
47
|
-
- `suggestion` issues are optional improvements
|
|
48
|
-
- Only `critical` issues cause `passed: false`
|
|
49
|
-
- Be specific — always include file path and line number
|
|
50
|
-
- Prefer minimal fixes over refactoring
|