@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,453 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: morph-phase-design
|
|
3
|
-
description: MORPH-SPEC Phase 2 (Design). Schema-first interactive design: reads EF models/Neon PostgreSQL/DB, validates findings with user, then generates VSA Blueprint based on config.architecture.style, producing spec.md, contracts.cs, schema-analysis.md, and decisions.md through a unified quality + clarification loop (score 0-100). Use after proposal phase to create technical specifications grounded in the real database schema.
|
|
4
|
-
argument-hint: "[feature-name]"
|
|
5
|
-
user-invocable: false
|
|
6
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
|
|
7
|
-
cliVersion: "4.22.0"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# MORPH Design — Phase 2
|
|
11
|
-
|
|
12
|
-
> INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
|
|
13
|
-
|
|
14
|
-
Schema-first interactive design: read the real schema, validate with user, generate blueprint, produce artifacts through a quality loop.
|
|
15
|
-
|
|
16
|
-
## Prerequisites
|
|
17
|
-
|
|
18
|
-
- [ ] Proposal approved by the user
|
|
19
|
-
- [ ] Phase 2 (UI/UX) completed OR skipped
|
|
20
|
-
|
|
21
|
-
## Recommended Tools
|
|
22
|
-
|
|
23
|
-
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for full guide.
|
|
24
|
-
> **Ref:** `references/spec-example.md` — filled-in spec.md showing expected output quality.
|
|
25
|
-
> **Ref:** `references/spec-authoring-guide.md` — section structure for spec.md.
|
|
26
|
-
|
|
27
|
-
| Action | Tool | Alternative |
|
|
28
|
-
|--------|------|-------------|
|
|
29
|
-
| Read proposal + UI specs | **Read** output files | — |
|
|
30
|
-
| **Detect architecture** | **Read** `.morph/config/config.json` → check `architecture.style` | **Bash** `grep` |
|
|
31
|
-
| **Schema: Neon PostgreSQL** | **Bash** `neonctl connection-string` → `pg_dump $(neonctl connection-string)` / `psql <DB_URL>` | **Grep** `.from(` in code |
|
|
32
|
-
| **Schema: EF Core** | **Glob** `**/Entities/**/*.cs` + **Glob** `**/*Context.cs` → **Read** | **Grep** `DbSet<` |
|
|
33
|
-
| **Schema: Next.js/TS** | **Glob** `src/**/types/**/*.ts` + **Grep** `interface\|type.*=` | — |
|
|
34
|
-
| Schema: RLS policies | **Bash** `psql <DB_URL> -c "SELECT ... FROM pg_policies"` | **Read** policy files |
|
|
35
|
-
| Dispatch dotnet-senior | **Agent** `subagent_type="morph-dotnet-senior"` — agent .md file provides the prompt | — |
|
|
36
|
-
| Dispatch tech leads | **Agent** for each active agent from dispatch config | — |
|
|
37
|
-
| Research library | **Context7 MCP** `query_docs()` | **WebSearch** + **WebFetch** |
|
|
38
|
-
| Render contracts VSA | **Bash** `morph-spec template render dotnet-contracts-vsa ...` | — |
|
|
39
|
-
| Render spec.md | **Bash** `morph-spec template render docs/spec ...` | — |
|
|
40
|
-
| Render decisions.md | **Bash** `morph-spec template render docs/decisions ...` | — |
|
|
41
|
-
| Update state | **Bash** `morph-spec state mark-output $ARGUMENTS <type>` | — |
|
|
42
|
-
|
|
43
|
-
**Anti-patterns:**
|
|
44
|
-
- Do not generate contracts before reading the real schema — guessed field names corrupt the entire design
|
|
45
|
-
- Do not present a Blueprint without validating with the user first
|
|
46
|
-
- Do not ask questions as plain text — always use `AskUserQuestion`
|
|
47
|
-
- Do not ignore `config.architecture.style` — always detect it before CHECKPOINT 2
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## PRE-FLIGHT
|
|
52
|
-
|
|
53
|
-
## Pre-flight — Tool Availability
|
|
54
|
-
|
|
55
|
-
Check session context lines for tool readiness:
|
|
56
|
-
- `neonctl ✓` → Neon CLI method for schema analysis
|
|
57
|
-
- `neonctl ✗` → Static code analysis fallback (Grep/Read)
|
|
58
|
-
- `context7 ✓` → Use for library docs when writing spec.md
|
|
59
|
-
- `context7 ✗` → WebSearch + WebFetch fallback
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## MANDATORY: Session Tasks
|
|
64
|
-
|
|
65
|
-
> **BEFORE starting any design work**, analyze the workflow below and create session tasks.
|
|
66
|
-
>
|
|
67
|
-
> **Rules:** Minimum 3 tasks, typically 5-7. Mark `in_progress` before starting, `completed` after.
|
|
68
|
-
>
|
|
69
|
-
> **Typical tasks:** pre-flight validation, schema analysis, architecture blueprint, spec generation, contracts generation, decisions documentation, design approval
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
**STEP 0 (BEFORE any reads or writes) — Ensure phase is design:**
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
morph-spec state get $ARGUMENTS
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Check the `"phase"` field in the output:
|
|
80
|
-
|
|
81
|
-
**If `"phase": "design"`** → phase is correct, proceed.
|
|
82
|
-
|
|
83
|
-
**If `"phase": "proposal"`** → execute in sequence:
|
|
84
|
-
1. `morph-spec state mark-output $ARGUMENTS proposal`
|
|
85
|
-
2. `morph-spec phase advance $ARGUMENTS` (→ design)
|
|
86
|
-
|
|
87
|
-
**Any other value** → do not proceed — inconsistent state, report to user.
|
|
88
|
-
|
|
89
|
-
> **Rule:** Never write to `2-design/` while the phase is not `design`. The hook will block and the sequence will be corrupted.
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
Read in parallel:
|
|
94
|
-
```
|
|
95
|
-
Read: .morph/features/$ARGUMENTS/0-proposal/proposal.md
|
|
96
|
-
+ Read: .morph/config/config.json ← detect architecture.style
|
|
97
|
-
+ Read: .morph/context/README.md
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Detect architecture style:**
|
|
101
|
-
|
|
102
|
-
| Value of `config.architecture.style` | Path |
|
|
103
|
-
|--------------------------------------|------|
|
|
104
|
-
| `"vertical-slice"` | → **VSA** (CHECKPOINT 2-VSA + VSA contracts) |
|
|
105
|
-
| any other value or absent | → **Standard** design flow (no architecture-specific blueprint) |
|
|
106
|
-
|
|
107
|
-
If scope ≥ 20 tasks or refactor touches ≥ 5 domain files → **EnterPlanMode** before continuing.
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## CHECKPOINT 1 — Real Schema (MANDATORY before any generation)
|
|
112
|
-
|
|
113
|
-
> **Rule:** Never assume field names. Every generated DTO must have a traceable origin in the schema.
|
|
114
|
-
|
|
115
|
-
### 1.1 Read real schema
|
|
116
|
-
|
|
117
|
-
Execute in parallel according to the stack detected in `config.json`:
|
|
118
|
-
|
|
119
|
-
**Neon PostgreSQL (via Neon CLI):**
|
|
120
|
-
|
|
121
|
-
> **Neon CLI (`neonctl`):** Run `neonctl connection-string` to get the DB URL.
|
|
122
|
-
> Then use `pg_dump $(neonctl connection-string)` for full schema export, or `psql <DB_URL>` for targeted queries.
|
|
123
|
-
> Cross-reference existing schema with the proposal to avoid duplicating tables or missing foreign keys to existing data.
|
|
124
|
-
> If Neon database is not accessible, rely on EF Core/TypeScript entity scanning as described below.
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
Bash: neonctl connection-string → extract DB URL
|
|
128
|
-
+ pg_dump $(neonctl connection-string) | grep -A20 "CREATE TABLE relevant_table"
|
|
129
|
-
+ psql <DB_URL> -c "SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = 'X'"
|
|
130
|
-
+ psql <DB_URL> -c "SELECT tablename, policyname, cmd, qual FROM pg_policies WHERE schemaname = 'public'"
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**EF Core (.NET):**
|
|
134
|
-
```
|
|
135
|
-
Glob: **/Entities/**/*.cs → Read each entity file
|
|
136
|
-
Glob: **/*DbContext.cs → Read to see DbSet<> and relations
|
|
137
|
-
Grep: "DbSet<" → confirm mapped entities
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**TypeScript/Next.js:**
|
|
141
|
-
```
|
|
142
|
-
Glob: src/**/types/**/*.ts, src/**/models/**/*.ts
|
|
143
|
-
Grep: "export interface|export type" → Read found files
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### 1.2 Generate schema-analysis.md
|
|
147
|
-
|
|
148
|
-
Write `.morph/features/$ARGUMENTS/2-design/schema-analysis.md` with:
|
|
149
|
-
|
|
150
|
-
```markdown
|
|
151
|
-
# Schema Analysis — {Feature}
|
|
152
|
-
|
|
153
|
-
## Relevant Entities
|
|
154
|
-
|
|
155
|
-
### {EntityName}
|
|
156
|
-
| Field | DB Type | C#/TS Type | Nullable | Notes |
|
|
157
|
-
|-------|---------|-----------|----------|-------|
|
|
158
|
-
| id | uuid | Guid | No | PK |
|
|
159
|
-
| ... | ... | ... | ... | ... |
|
|
160
|
-
|
|
161
|
-
## Relationships
|
|
162
|
-
- {Entity A} 1—N {Entity B} via {FK field}
|
|
163
|
-
|
|
164
|
-
## JSONB / Complex Fields
|
|
165
|
-
- {field}: internal structure {known keys}
|
|
166
|
-
|
|
167
|
-
## Fields Not Referenced in Proposal
|
|
168
|
-
- {field}: present in schema but no reference in the proposal
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 1.3 Validate with user
|
|
172
|
-
|
|
173
|
-
Use `AskUserQuestion`:
|
|
174
|
-
|
|
175
|
-
```json
|
|
176
|
-
{
|
|
177
|
-
"questions": [{
|
|
178
|
-
"header": "Schema OK?",
|
|
179
|
-
"question": "Found these entities and fields in the schema. Are they correct before generating contracts?",
|
|
180
|
-
"multiSelect": false,
|
|
181
|
-
"options": [
|
|
182
|
-
{ "label": "Confirm and continue", "description": "Schema mapped correctly" },
|
|
183
|
-
{ "label": "I have corrections", "description": "Use Other to describe what's wrong" }
|
|
184
|
-
]
|
|
185
|
-
}]
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
- **"Confirm"** → proceed to Checkpoint 2
|
|
190
|
-
- **"I have corrections" / Other** → apply corrections to schema-analysis.md and repeat 1.3
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## CHECKPOINT 2 — Architecture Blueprint (MANDATORY before generating contracts)
|
|
195
|
-
|
|
196
|
-
> Use the path corresponding to the style detected in PRE-FLIGHT.
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
### CHECKPOINT 2-VSA — Vertical Slice Architecture
|
|
201
|
-
|
|
202
|
-
#### 2-VSA.1 Dispatch dotnet-senior (VSA mode)
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
morph-spec dispatch-agents $ARGUMENTS design
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Use the `recommended` field to find the dotnet-senior agent. The agent `.md` file is self-contained. Call:
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
Agent(subagent_type="morph-dotnet-senior", prompt="Design VSA blueprint for feature {feature}. Read .morph/features/{feature}/0-proposal/proposal.md and schema-analysis.md for context.")
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
The agent produces a VSA Blueprint with:
|
|
215
|
-
- Entity fields (based on the schema validated in Checkpoint 1)
|
|
216
|
-
- Operations (GetAll, GetById, Create, Update, Delete + custom)
|
|
217
|
-
- Routes (`GET /api/{feature}s`, `POST /api/{feature}s`, etc.)
|
|
218
|
-
- Error types (`{Entity}Errors.NotFound`, `{Entity}Errors.AlreadyExists`, etc.)
|
|
219
|
-
- Validation rules per field
|
|
220
|
-
|
|
221
|
-
**Parallelize** with other active agents from the dispatch config.
|
|
222
|
-
|
|
223
|
-
#### 2-VSA.2 Validate Blueprint with user
|
|
224
|
-
|
|
225
|
-
Present the generated blueprint in a readable format and use `AskUserQuestion`:
|
|
226
|
-
|
|
227
|
-
```json
|
|
228
|
-
{
|
|
229
|
-
"questions": [{
|
|
230
|
-
"header": "Blueprint OK?",
|
|
231
|
-
"question": "Planned these slices and operations for the feature. Confirm before generating spec and contracts?",
|
|
232
|
-
"multiSelect": false,
|
|
233
|
-
"options": [
|
|
234
|
-
{ "label": "Confirm blueprint", "description": "Generate spec.md and contracts with this blueprint" },
|
|
235
|
-
{ "label": "Need adjustments", "description": "Use Other to describe what to change" }
|
|
236
|
-
]
|
|
237
|
-
}]
|
|
238
|
-
}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
- **"Confirm"** → proceed to VSA generation
|
|
242
|
-
- **"Need adjustments" / Other** → update blueprint and repeat 2-VSA.2
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## Artifact Generation
|
|
249
|
-
|
|
250
|
-
With schema validated (Checkpoint 1) and blueprint confirmed (Checkpoint 2):
|
|
251
|
-
|
|
252
|
-
### Generate spec.md
|
|
253
|
-
|
|
254
|
-
> Detailed structure: `references/spec-authoring-guide.md`
|
|
255
|
-
|
|
256
|
-
> **MCP:** Before writing spec.md, use **Context7 MCP** (`resolve-library-id` → `query-docs`) to fetch current API docs for libraries referenced in the proposal (e.g., FluentValidation, MediatR, TanStack Query). This ensures spec references correct method signatures and patterns. If Context7 is not available, use **WebSearch** + **WebFetch** to look up the official documentation.
|
|
257
|
-
|
|
258
|
-
Read the spec-authoring-guide first, then create `.morph/features/$ARGUMENTS/2-design/spec.md` with:
|
|
259
|
-
- Overview, Functional Requirements (FR001...) with measurable acceptance criteria
|
|
260
|
-
- Non-Functional Requirements, Data Model
|
|
261
|
-
- **VSA:** section `## Architecture Style: Vertical Slice` with slices and operations
|
|
262
|
-
- Infrastructure Requirements (if applicable)
|
|
263
|
-
|
|
264
|
-
### Generate contracts — VSA
|
|
265
|
-
|
|
266
|
-
**Mandatory source:** fields from `schema-analysis.md` + operations from the VSA Blueprint.
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
morph-spec template render \
|
|
270
|
-
dotnet-contracts-vsa \
|
|
271
|
-
.morph/features/$ARGUMENTS/2-design/contracts.cs \
|
|
272
|
-
'{
|
|
273
|
-
"FEATURE_NAME": "$ARGUMENTS",
|
|
274
|
-
"NAMESPACE": "{ProjectNamespace}",
|
|
275
|
-
"ROUTE": "/api/{kebabCase FEATURE_NAME}s",
|
|
276
|
-
"DATE": "{{TODAY}}"
|
|
277
|
-
}'
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
After rendering, fill in the `// placeholder:` sections with real fields from schema-analysis.md.
|
|
281
|
-
|
|
282
|
-
**Mandatory VSA patterns:**
|
|
283
|
-
- `sealed` on handlers, endpoints, validators, records
|
|
284
|
-
- `Guid.CreateVersion7()` for IDs
|
|
285
|
-
- `result.Match()` in endpoints
|
|
286
|
-
- `{Entity}Errors` static shared across all slices
|
|
287
|
-
- CancellationToken in all async methods
|
|
288
|
-
|
|
289
|
-
### Stack adaptation for contracts
|
|
290
|
-
|
|
291
|
-
For TypeScript/Next.js projects, generate `contracts.ts` instead of `contracts.cs`. Use TypeScript interfaces with the same VSA patterns adapted to the language (e.g., `readonly` fields, union types for status enums, typed event interfaces).
|
|
292
|
-
|
|
293
|
-
### Generate decisions.md
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
morph-spec template render docs/decisions \
|
|
297
|
-
.morph/features/$ARGUMENTS/2-design/decisions.md \
|
|
298
|
-
'{"FEATURE_NAME": "$ARGUMENTS", "DATE": "{{TODAY}}", "decisions": []}'
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
Mandatory ADRs: architecture choice (VSA + justification), UI library (if UI/UX phase ran), external integrations, Azure resources with cost estimates.
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## Quality Scoring System
|
|
306
|
-
|
|
307
|
-
After generating artifacts, evaluate the design with the **Quality Score (0–100)**:
|
|
308
|
-
|
|
309
|
-
| Dimension | Pts | Maximum score criteria |
|
|
310
|
-
|-----------|-----|----------------------|
|
|
311
|
-
| **Schema fidelity** | 25 | All fields in contracts have traceable origin in schema-analysis.md — zero guessed |
|
|
312
|
-
| **Functional coverage** | 20 | All FRs from the proposal are in spec with measurable acceptance criteria |
|
|
313
|
-
| **Blueprint complete** | 20 | **VSA:** all slices have handler, validator (except GetAll), endpoint and errors |
|
|
314
|
-
| **External integrations** | 20 | APIs/services with payload, error format and retry policy documented |
|
|
315
|
-
| **Infra / costs** | 15 | Azure resources estimated with cost, or "N/A" explicitly documented |
|
|
316
|
-
|
|
317
|
-
**Thresholds:**
|
|
318
|
-
|
|
319
|
-
| Score | Action |
|
|
320
|
-
|-------|--------|
|
|
321
|
-
| ≥ 85 | Design satisfactory. Offer to close or optionally refine |
|
|
322
|
-
| 70–84 | Continue. Focus on the weakest dimensions |
|
|
323
|
-
| < 70 | Continue. Open technical questions block implementation |
|
|
324
|
-
|
|
325
|
-
---
|
|
326
|
-
|
|
327
|
-
## Quality Loop
|
|
328
|
-
|
|
329
|
-
**Repeat until: score ≥ 85 OR user approves.**
|
|
330
|
-
|
|
331
|
-
### A. Calculate score
|
|
332
|
-
|
|
333
|
-
Score each dimension based on the generated artifacts. Identify the most impactful gaps.
|
|
334
|
-
|
|
335
|
-
### B. Identify open questions
|
|
336
|
-
|
|
337
|
-
Typical questions by dimension:
|
|
338
|
-
|
|
339
|
-
| Weak dimension | Example questions |
|
|
340
|
-
|----------------|-------------------|
|
|
341
|
-
| Schema fidelity | "The `metadata` field (JSONB) — what is its structure? Which keys?" |
|
|
342
|
-
| Functional coverage | "FR003 says 'notify user' — by email, push, or both?" |
|
|
343
|
-
| Blueprint VSA | "Should the CreateOrder slice trigger an email job or is it synchronous?" |
|
|
344
|
-
| Integrations | "Does the payment API use webhook or polling to confirm?" |
|
|
345
|
-
| Infra/costs | "Does this feature need Azure storage? Which tier?" |
|
|
346
|
-
|
|
347
|
-
### C. Ask via AskUserQuestion
|
|
348
|
-
|
|
349
|
-
Maximum 3 technical questions per call. In the last call of each round, always include:
|
|
350
|
-
|
|
351
|
-
```json
|
|
352
|
-
{
|
|
353
|
-
"header": "Continue?",
|
|
354
|
-
"question": "Continue refining or finalize the design?",
|
|
355
|
-
"multiSelect": false,
|
|
356
|
-
"options": [
|
|
357
|
-
{ "label": "Continue refining", "description": "More open questions identified" },
|
|
358
|
-
{ "label": "Finalize design", "description": "Proceed to Plan phase with current design" }
|
|
359
|
-
]
|
|
360
|
-
}
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
> If score ≥ 85, adjust: `"Continue (optional)"` with description `"Score {N}/100 — design is satisfactory"`
|
|
364
|
-
|
|
365
|
-
### D. Incorporate answers
|
|
366
|
-
|
|
367
|
-
Update spec.md, contracts, and decisions.md with the answers received. Recalculate the score.
|
|
368
|
-
|
|
369
|
-
### E. Exit condition
|
|
370
|
-
|
|
371
|
-
- User chose **"Finalize design"** → exit loop
|
|
372
|
-
- Score ≥ 85 AND no new questions → exit loop
|
|
373
|
-
|
|
374
|
-
---
|
|
375
|
-
|
|
376
|
-
## Post-Loop: Update State
|
|
377
|
-
|
|
378
|
-
```bash
|
|
379
|
-
morph-spec state mark-output $ARGUMENTS schema-analysis
|
|
380
|
-
morph-spec state mark-output $ARGUMENTS spec
|
|
381
|
-
morph-spec state mark-output $ARGUMENTS contracts
|
|
382
|
-
morph-spec state mark-output $ARGUMENTS decisions
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
If Azure costs were estimated:
|
|
386
|
-
```bash
|
|
387
|
-
morph-spec state set $ARGUMENTS costs.estimated {X.XX}
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
## MANDATORY PAUSE
|
|
391
|
-
|
|
392
|
-
```json
|
|
393
|
-
{
|
|
394
|
-
"questions": [{
|
|
395
|
-
"header": "Approval",
|
|
396
|
-
"question": "Design generated. Approve to continue to Plan?",
|
|
397
|
-
"multiSelect": false,
|
|
398
|
-
"options": [
|
|
399
|
-
{ "label": "Approve and continue", "description": "Advance to Plan phase" },
|
|
400
|
-
{ "label": "I have feedback", "description": "Describe what to change (Other)" }
|
|
401
|
-
]
|
|
402
|
-
}]
|
|
403
|
-
}
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
- **"Approve and continue"** →
|
|
407
|
-
```bash
|
|
408
|
-
morph-spec approve $ARGUMENTS design
|
|
409
|
-
morph-spec phase advance $ARGUMENTS
|
|
410
|
-
```
|
|
411
|
-
- **"I have feedback" / Other** → apply feedback and repeat PAUSE
|
|
412
|
-
|
|
413
|
-
## Generated Outputs
|
|
414
|
-
|
|
415
|
-
- `.morph/features/$ARGUMENTS/2-design/schema-analysis.md` — Real schema mapped and validated
|
|
416
|
-
- `.morph/features/$ARGUMENTS/2-design/spec.md` — Complete technical specification
|
|
417
|
-
- `.morph/features/$ARGUMENTS/2-design/contracts.cs` (or `.ts` for TypeScript projects) — Contracts based on real schema (VSA)
|
|
418
|
-
- `.morph/features/$ARGUMENTS/2-design/decisions.md` — Documented ADRs
|
|
419
|
-
|
|
420
|
-
## Advancement Criteria
|
|
421
|
-
|
|
422
|
-
- [x] Architecture style detected from `config.architecture.style`
|
|
423
|
-
- [x] Schema validated by user (Checkpoint 1)
|
|
424
|
-
- [x] Blueprint confirmed by user (Checkpoint 2-VSA)
|
|
425
|
-
- [x] Quality score ≥ 85 OR user finalized
|
|
426
|
-
- [x] All field names in contracts traceable to schema-analysis.md
|
|
427
|
-
- [x] State updated
|
|
428
|
-
- [x] User approved at MANDATORY PAUSE
|
|
429
|
-
|
|
430
|
-
---
|
|
431
|
-
|
|
432
|
-
<!-- morph-outputs:design -->
|
|
433
|
-
| Output | Caminho |
|
|
434
|
-
|--------|---------|
|
|
435
|
-
| `schemaAnalysis` | `.morph/features/{feature}/2-design/schema-analysis.md` |
|
|
436
|
-
| `spec` | `.morph/features/{feature}/2-design/spec.md` |
|
|
437
|
-
| `contracts` | `.morph/features/{feature}/2-design/contracts.cs` |
|
|
438
|
-
| `contractsTs` | `.morph/features/{feature}/2-design/contracts.ts` |
|
|
439
|
-
| `contractsVsa` | `.morph/features/{feature}/2-design/contracts-vsa.cs` |
|
|
440
|
-
| `decisions` | `.morph/features/{feature}/2-design/decisions.md` |
|
|
441
|
-
<!-- /morph-outputs -->
|
|
442
|
-
|
|
443
|
-
## Relevant Standards
|
|
444
|
-
|
|
445
|
-
Before starting the design phase, proactively read standards relevant to the project's stack:
|
|
446
|
-
- Architecture standards: `.morph/framework/standards/architecture/` — especially vertical-slice patterns
|
|
447
|
-
- Backend standards: `.morph/framework/standards/backend/` — for API contracts and patterns
|
|
448
|
-
- Data standards: `.morph/framework/standards/data/` — for database schema and access patterns
|
|
449
|
-
- These standards are also available as rules that auto-load when editing matching file types.
|
|
450
|
-
|
|
451
|
-
---
|
|
452
|
-
|
|
453
|
-
Continue automatically to Plan phase after approval.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Architecture Analysis Guide — Prompts de Dispatch
|
|
2
|
-
|
|
3
|
-
> Prompts completos para os agentes de análise de arquitetura dispatch via Task tool.
|
|
4
|
-
> Referenciado pelo Passo 1.5 de `phase-design/SKILL.md`.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Caminho: `dotnet-senior` (VSA)
|
|
9
|
-
|
|
10
|
-
**Quando usar:** Default architecture style (Vertical Slice Architecture).
|
|
11
|
-
|
|
12
|
-
**Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
|
|
13
|
-
|
|
14
|
-
**Use o Agent tool com o subagentType do dispatch recommendation:**
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
Agent(subagent_type="morph-dotnet-senior", prompt="...")
|
|
18
|
-
Prompt (enriquecido com conteúdo da proposta):
|
|
19
|
-
|
|
20
|
-
Você é o VSA Specialist da feature '$ARGUMENTS'.
|
|
21
|
-
|
|
22
|
-
Proposta da feature:
|
|
23
|
-
[conteúdo de .morph/features/$ARGUMENTS/0-proposal/proposal.md]
|
|
24
|
-
|
|
25
|
-
Standards de referência:
|
|
26
|
-
[.morph/framework/standards/architecture/vertical-slice/vertical-slice.md]
|
|
27
|
-
|
|
28
|
-
Produza um VSA Blueprint:
|
|
29
|
-
1. ENTITY FIELDS: todos os campos com tipos C# corretos (sem AggregateRoot, sem Value Objects)
|
|
30
|
-
2. OPERATIONS: slices necessários (Create, GetAll, GetById, Update, Delete + operações customizadas)
|
|
31
|
-
3. ROUTES: HTTP method + rota por operação (ex: POST /api/products, GET /api/products/{id:guid})
|
|
32
|
-
4. ERROR TYPES: Error factory methods para {Entity}Errors
|
|
33
|
-
5. VALIDATION RULES: regras FluentValidation por campo por operação
|
|
34
|
-
|
|
35
|
-
Não use AggregateRoot, DomainEvent, CQRS formal, MediatR, Application Service layer.
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Após receber o resultado:** Documente no spec.md (seção `## Architecture Style: Vertical Slice`).
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Nota sobre Paralelização
|
|
43
|
-
|
|
44
|
-
Este Task dispatch pode iniciar **simultaneamente** com o Passo 2 (schema analysis), pois ambos são independentes. Use dois Task calls em paralelo quando o schema analysis também for necessário.
|
package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Spec Authoring Guide — Seções do spec.md
|
|
2
|
-
|
|
3
|
-
> Guia de referência para estrutura e conteúdo de cada seção do `spec.md`.
|
|
4
|
-
> Referenciado pelo Passo 3 de `phase-design/SKILL.md`.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 3.1. Overview
|
|
9
|
-
|
|
10
|
-
- **Objetivo:** Resumo de 1-2 parágrafos
|
|
11
|
-
- **Usuários afetados:** Quem vai usar?
|
|
12
|
-
- **Problema resolvido:** Qual dor/necessidade?
|
|
13
|
-
|
|
14
|
-
## 3.2. Functional Requirements
|
|
15
|
-
|
|
16
|
-
Lista detalhada de requisitos funcionais:
|
|
17
|
-
|
|
18
|
-
```markdown
|
|
19
|
-
### FR001: {Requisito}
|
|
20
|
-
**Description:** {O que deve fazer}
|
|
21
|
-
**Acceptance Criteria:**
|
|
22
|
-
- [ ] Critério 1
|
|
23
|
-
- [ ] Critério 2
|
|
24
|
-
**Priority:** High/Medium/Low
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## 3.3. Non-Functional Requirements
|
|
28
|
-
|
|
29
|
-
- Performance (tempos de resposta esperados)
|
|
30
|
-
- Segurança (autenticação, autorização)
|
|
31
|
-
- Escalabilidade (volume de dados/usuários)
|
|
32
|
-
- Disponibilidade (uptime esperado)
|
|
33
|
-
|
|
34
|
-
## 3.4. Technical Architecture
|
|
35
|
-
|
|
36
|
-
- **Camadas:** (Presentation, Application, Domain, Infrastructure)
|
|
37
|
-
- **Patterns:** (Repository, CQRS, DI, etc.)
|
|
38
|
-
- **Dependências:** Bibliotecas/serviços externos necessários
|
|
39
|
-
|
|
40
|
-
## 3.5. Data Model
|
|
41
|
-
|
|
42
|
-
- Entities principais
|
|
43
|
-
- Relacionamentos (1:1, 1:N, N:N)
|
|
44
|
-
- Campos obrigatórios vs opcionais
|
|
45
|
-
- Validações de negócio
|
|
46
|
-
|
|
47
|
-
## 3.6. Infrastructure Requirements
|
|
48
|
-
|
|
49
|
-
Se houver recursos Azure:
|
|
50
|
-
- Banco de dados (Azure SQL, Cosmos DB)
|
|
51
|
-
- Storage (Blob Storage)
|
|
52
|
-
- Compute (Container Apps, App Service)
|
|
53
|
-
- Monitoring (App Insights)
|
|
54
|
-
|
|
55
|
-
> **SEMPRE usar Bicep para infra!**
|