@polymorphism-tech/morph-spec 4.22.0 → 6.0.0

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 (211) hide show
  1. package/CLAUDE.md +57 -71
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +224 -491
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +55 -38
  8. package/framework/MORPH.md +244 -0
  9. package/framework/agents.json +127 -1198
  10. package/framework/commands/morph-apply.md +56 -240
  11. package/framework/commands/morph-archive.md +48 -85
  12. package/framework/commands/morph-preflight.md +7 -7
  13. package/framework/commands/morph-proposal.md +35 -191
  14. package/framework/commands/morph-status.md +19 -50
  15. package/framework/commands/morph-troubleshoot.md +2 -2
  16. package/framework/evals/rubrics/README.md +44 -0
  17. package/framework/evals/rubrics/architecture.md +46 -0
  18. package/framework/evals/rubrics/code-quality.md +50 -0
  19. package/framework/evals/rubrics/contracts.md +47 -0
  20. package/framework/evals/rubrics/test-coverage.md +50 -0
  21. package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
  22. package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
  23. package/framework/evals/suites/standard.yaml +5 -0
  24. package/framework/evals/trace-schema.md +67 -0
  25. package/framework/hooks/claude-code/core/README.md +3 -0
  26. package/framework/hooks/claude-code/core/denylist.json +14 -0
  27. package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
  28. package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
  29. package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
  30. package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
  31. package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
  32. package/framework/hooks/shared/phase-utils.js +20 -31
  33. package/framework/hooks/shared/state-reader.js +4 -5
  34. package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -243
  35. package/framework/phases.json +41 -115
  36. package/framework/rubrics/eval-rubric.json +66 -0
  37. package/framework/skills/README.md +39 -64
  38. package/framework/skills/core/README.md +3 -0
  39. package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
  40. package/framework/skills/core/morph-eval/SKILL.md +57 -0
  41. package/framework/skills/core/morph-implement/SKILL.md +83 -0
  42. package/framework/skills/core/morph-plan/SKILL.md +64 -0
  43. package/framework/skills/core/morph-review/SKILL.md +62 -0
  44. package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
  45. package/framework/skills/core/morph-standards/SKILL.md +49 -0
  46. package/framework/templates/CLAUDE.md.core.guide.md +29 -0
  47. package/framework/templates/CLAUDE.md.core.template +22 -0
  48. package/framework/templates/REGISTRY.json +4 -4
  49. package/framework/workflows/configs/fast-track.json +5 -10
  50. package/framework/workflows/configs/full.json +4 -8
  51. package/framework/workflows/configs/quick.json +32 -0
  52. package/framework/workflows/configs/standard.json +57 -64
  53. package/package.json +7 -6
  54. package/src/commands/mcp/mcp-setup.js +58 -31
  55. package/src/commands/project/doctor.js +69 -70
  56. package/src/commands/project/init.js +26 -5
  57. package/src/commands/project/status.js +18 -19
  58. package/src/commands/state/approve.js +1 -1
  59. package/src/commands/validation/validate-feature.js +18 -112
  60. package/src/core/paths/output-schema.js +133 -152
  61. package/src/core/state/phase-state-machine.js +10 -24
  62. package/src/core/state/state-manager.js +17 -17
  63. package/src/core/workflows/workflow-detector.js +214 -31
  64. package/src/core/workflows/workflow-router.js +204 -0
  65. package/src/dashboard/app/pages/AgentMap.jsx +32 -33
  66. package/src/dashboard/app/pages/LiveState.jsx +1 -1
  67. package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
  68. package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
  69. package/src/dashboard/app/pages/Workflows.jsx +2 -2
  70. package/src/dashboard/scanner/agents-scanner.js +30 -35
  71. package/src/lib/agents/metrics-aggregator.js +1 -1
  72. package/src/lib/agents/output-collector.js +7 -9
  73. package/src/lib/context/context-builder.js +289 -0
  74. package/src/lib/detectors/claude-config-detector.js +19 -3
  75. package/src/lib/generators/context-generator.js +20 -42
  76. package/src/lib/generators/index.js +1 -0
  77. package/src/lib/generators/mandate-generator.js +512 -0
  78. package/src/lib/generators/metadata-extractor.js +1 -1
  79. package/src/lib/generators/recap-generator.js +3 -4
  80. package/src/lib/installers/mcp-installer.js +300 -92
  81. package/src/lib/phase-chain/phase-validator.js +36 -40
  82. package/src/lib/stack/stack-profile.js +74 -91
  83. package/src/lib/tasks/task-parser.js +1 -1
  84. package/src/lib/tasks/wave-resolver.js +353 -0
  85. package/src/lib/validators/checkpoint-persistence.js +2 -2
  86. package/src/lib/validators/content/cross-phase-validator.js +281 -0
  87. package/src/lib/validators/content/index.js +1 -0
  88. package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
  89. package/src/scripts/global-install.js +2 -27
  90. package/src/utils/agents-installer.js +224 -447
  91. package/src/utils/claude-settings-manager.js +57 -15
  92. package/src/utils/file-copier.js +1 -0
  93. package/src/utils/hooks-installer.js +15 -117
  94. package/src/utils/skills-installer.js +12 -18
  95. package/bin/detect-agents.js +0 -226
  96. package/bin/task-manager.js +0 -1036
  97. package/framework/agents/README.md +0 -13
  98. package/framework/agents/ai-agents/ai-system-architect.md +0 -194
  99. package/framework/agents/ai-agents/vector-search-expert.md +0 -247
  100. package/framework/agents/architecture/architecture-expert.md +0 -98
  101. package/framework/agents/architecture/morph-spec-architect.md +0 -66
  102. package/framework/agents/architecture/packages-validator.md +0 -89
  103. package/framework/agents/architecture/security-expert.md +0 -79
  104. package/framework/agents/architecture/seo-growth-hacker.md +0 -168
  105. package/framework/agents/architecture/standards-architect.md +0 -153
  106. package/framework/agents/backend/dotnet-senior.md +0 -163
  107. package/framework/agents/backend/ef-modeler.md +0 -119
  108. package/framework/agents/backend/hangfire-orchestrator.md +0 -133
  109. package/framework/agents/backend/ms-agent-expert.md +0 -55
  110. package/framework/agents/backend/neon-expert.md +0 -379
  111. package/framework/agents/frontend/css-specialist.md +0 -89
  112. package/framework/agents/frontend/design-system-validator.md +0 -100
  113. package/framework/agents/frontend/gsap-animator.md +0 -131
  114. package/framework/agents/frontend/nextjs-component-validator.md +0 -97
  115. package/framework/agents/frontend/nextjs-expert.md +0 -201
  116. package/framework/agents/frontend/ui-designer.md +0 -259
  117. package/framework/agents/infrastructure/infra-architect.md +0 -215
  118. package/framework/agents/integrations/asaas-financial.md +0 -138
  119. package/framework/agents/integrations/neon-auth.md +0 -151
  120. package/framework/agents/integrations/resend-email.md +0 -127
  121. package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
  122. package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
  123. package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
  124. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
  125. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
  126. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
  127. package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
  128. package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
  129. package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
  130. package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
  131. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
  132. package/framework/hooks/shared/compact-restore.js +0 -123
  133. package/framework/hooks/shared/dispatch-helpers.js +0 -147
  134. package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
  135. package/framework/hooks/shared/stale-task-reset.js +0 -57
  136. package/framework/hooks/shared/worktree-helpers.js +0 -75
  137. package/framework/skills/level-0-meta/README.md +0 -7
  138. package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
  139. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
  140. package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
  141. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
  142. package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
  143. package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
  144. package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
  145. package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
  146. package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
  147. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
  148. package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
  149. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
  150. package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
  151. package/framework/skills/level-0-meta/morph-gemini-image/SKILL.md +0 -290
  152. package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
  153. package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
  154. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -401
  155. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
  156. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
  157. package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
  158. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
  159. package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
  160. package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
  161. package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
  162. package/framework/skills/level-1-workflows/README.md +0 -7
  163. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
  164. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
  165. package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
  166. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
  167. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
  168. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  169. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -634
  170. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
  171. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -54
  172. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
  173. package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
  174. package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
  175. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
  176. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  177. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
  178. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
  179. package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
  180. package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
  181. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -995
  182. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
  183. package/framework/squad-templates/backend-only.json +0 -47
  184. package/framework/squad-templates/frontend-only.json +0 -56
  185. package/framework/squad-templates/full-stack.json +0 -74
  186. package/src/commands/agents/agent-metrics.js +0 -174
  187. package/src/commands/agents/audit-dispatch.js +0 -82
  188. package/src/commands/agents/detect-agents.js +0 -275
  189. package/src/commands/agents/dispatch-agents.js +0 -461
  190. package/src/commands/agents/index.js +0 -13
  191. package/src/commands/agents/manage-agents.js +0 -352
  192. package/src/commands/agents/project-metrics.js +0 -74
  193. package/src/commands/phase/phase-reset.js +0 -74
  194. package/src/commands/scope/escalate.js +0 -217
  195. package/src/commands/state/advance-phase.js +0 -600
  196. package/src/commands/state/phase-runner.js +0 -215
  197. package/src/commands/state/state.js +0 -444
  198. package/src/commands/task/expand.js +0 -100
  199. package/src/commands/tasks/index.js +0 -4
  200. package/src/commands/tasks/task.js +0 -105
  201. package/src/commands/templates/index.js +0 -5
  202. package/src/commands/templates/template-render.js +0 -93
  203. package/src/commands/trust/trust.js +0 -118
  204. package/src/lib/agents/agents-manager.js +0 -349
  205. package/src/lib/build/build-runner.js +0 -99
  206. package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
  207. package/src/lib/contracts/sprint-contract-generator.js +0 -137
  208. package/src/lib/scope/impact-analyzer.js +0 -106
  209. package/src/lib/trust/trust-manager.js +0 -157
  210. package/src/utils/tier-helpers.js +0 -24
  211. /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
@@ -1,243 +0,0 @@
1
- ---
2
- name: morph-tool-usage-guide
3
- description: Decision flowchart and per-phase reference for selecting the right Claude Code tool (Read, Grep, Glob, Bash, Task) or MCP tool in MORPH-SPEC workflows. Use when unsure which tool to use for a given action, when choosing between native tools and MCPs, or when deciding whether to use a subagent vs direct tools.
4
- user-invocable: true
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
- ---
7
-
8
- # Tool Usage Guide for MORPH Workflows
9
-
10
- > Operational guide for selecting the correct Claude Code tools and MCP tools at each morph-spec phase. Each phase uses a distinct set of tools optimized for its goals.
11
- >
12
- > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for detailed MCP examples.
13
-
14
- ---
15
-
16
- ## Decision Flowchart
17
-
18
- ```
19
- ┌──────────────────────────────┐
20
- │ I need to complete an action │
21
- └──────────────┬───────────────┘
22
- │
23
- ▼
24
- ┌───────────────────────────────────────┐
25
- │ Is it a SEARCH for a specific file, │
26
- │ keyword, or function? │
27
- └──────┬──────────────────┬─────────────┘
28
- │ YES │ NO
29
- ▼ ▼
30
- Use Glob/Grep ┌─────────────────────────┐
31
- or Read │ Does it need STRUCTURED │
32
- │ external data (schema, │
33
- │ API docs, design tokens)?│
34
- └──┬──────────────┬────────┘
35
- │ YES │ NO
36
- ▼ ▼
37
- Use MCP tool ┌──────────────────────────────┐
38
- (+ fallback) │ Does it involve MULTIPLE │
39
- │ independent specialist tasks │
40
- │ (domain analysis + schema, │
41
- │ backend + frontend tasks)? │
42
- └──┬───────────────┬───────────┘
43
- │ YES │ NO
44
- ▼ ▼
45
- Dispatch parallel ┌──────────────────┐
46
- Task subagents │ Does it require │
47
- (see below) │ MULTI-STEP │
48
- │ exploration of │
49
- │ many files? │
50
- └──┬──────────┬─────┘
51
- │ YES │ NO
52
- ▼ ▼
53
- Use Task Do it
54
- (subagent) directly
55
- ```
56
-
57
- ### When to use Task subagents for agent dispatch
58
-
59
- Dispatch specialist agents as **Task subagents** when ALL conditions are met:
60
- - Phase is `design`, `tasks`, or `implement`
61
- - Feature has **2+ active specialist agents** (check `activeAgents` in state.json)
62
- - Work can be divided into **independent parallel tasks** with clear outputs
63
-
64
- ```
65
- Feature with multiple active agents?
66
- │
67
- ├─ design phase → Dispatch architect (complexity analysis)
68
- │ + tech leads (spec validation) — in PARALLEL
69
- │
70
- ├─ tasks phase → Dispatch per-domain task planners (if spec has 50+ reqs
71
- │ OR 3+ independent domains detected)
72
- │
73
- └─ implement phase → Dispatch per-domain implementers when tasks.total ≥ 6
74
- AND feature spans multiple domains (backend + frontend,
75
- or backend + infra, etc.)
76
- ```
77
-
78
- **Key principle (from real-world usage):** Define subagents by **TASK**, not by **ROLE**.
79
- - ✅ "Analyze this proposal for complexity and return level + blueprint" (task)
80
- - ✅ "Implement backend tasks T001-T005 for feature X" (task)
81
- - ❌ "Be an architect" (vague role assignment — poor results)
82
-
83
- ---
84
-
85
- ## User Communication
86
-
87
- ### AskUserQuestion vs. Plain Text
88
-
89
- | Situation | Tool |
90
- |---|---|
91
- | ≥2 mutually exclusive options | `AskUserQuestion` (options[]) |
92
- | Binary yes/no choice | `AskUserQuestion` (2 options) |
93
- | Plan approval | `ExitPlanMode` |
94
- | Explanation, progress, confirmation | Direct text |
95
-
96
- **Rule:** NEVER present multiple options as plain text. Use `AskUserQuestion` with `options[]` to ensure structured, unambiguous choices.
97
-
98
- ### EnterPlanMode
99
-
100
- Use **BEFORE** starting implementation when:
101
- - Refactor touches ≥5 files or changes architecture
102
- - Estimated tasks ≥20
103
- - Choosing between ≥2 significantly different design approaches
104
-
105
- Do NOT use for:
106
- - Point fix of 1-3 files
107
- - User already specified detailed approach
108
- - Implement phase with tasks.md already approved
109
-
110
- ---
111
-
112
- ### Parallel Read Rule (CRITICAL)
113
-
114
- Independent files = a single message with multiple Read calls.
115
-
116
- ```
117
- # WRONG (sequential)
118
- Read: state.json → Read: spec.md → Read: tasks.md # 3 round-trips
119
-
120
- # CORRECT (parallel, 1 round-trip)
121
- Read: state.json + Read: spec.md + Read: tasks.md
122
- ```
123
-
124
- Criterion: if reading file B does not depend on the CONTENT of file A, read both together.
125
-
126
- **Independence examples:** spec.md ↔ decisions.md ↔ contracts.cs ↔ tasks.md (all read together when investigating a phase).
127
-
128
- ---
129
-
130
- ## Tools Per Phase
131
-
132
- > For detailed per-phase tool tables, see `references/tools-per-phase.md`
133
-
134
- **Quick summary by phase:**
135
-
136
- | Phase | Primary MCPs | Dispatch subagents? |
137
- |-------|-------------|---------------------|
138
- | Proposal | GitHub (optional) | No |
139
- | UI/UX | Playwright, Context7 | No |
140
- | Design | Neon CLI, Context7, GitHub | Yes (architect + schema in parallel) |
141
- | Plan | Context7, GitHub | No |
142
- | Tasks | Context7, GitHub | Yes (when spec has 20+ reqs or 3+ domains) |
143
- | Implement | Neon CLI, Context7, Playwright, GitHub | Yes (when tasks.total ≥ 6 and 2+ domains) |
144
-
145
- ---
146
-
147
- ## Tool Selection Rules
148
-
149
- ### Claude Code Native Tools
150
-
151
- | Tool | When to Use | When NOT to Use |
152
- |------|-------------|-----------------|
153
- | **Read** | Read 1-3 specific known files | Don't use for searching |
154
- | **Glob** | Find files by name pattern | Don't use Bash `find` |
155
- | **Grep** | Search content across files | Don't use Bash `grep` or `rg` |
156
- | **Edit** | Modify existing files | Don't use Bash `sed` or `awk` |
157
- | **Write** | Create new files | Don't use Bash `echo >` or heredoc |
158
- | **Bash** | CLI commands, build, test, git | Don't use for file read/write/search |
159
- | **WebSearch** | Current external information | Don't use for local codebase info |
160
- | **WebFetch** | Specific URL content | Don't use for authenticated services |
161
- | **Task** (subagent) | Multi-file exploration, complex analysis | Don't use for single-file operations |
162
-
163
- ### MCP Tools
164
-
165
- | MCP | When to Use | Fallback |
166
- |-----|-------------|----------|
167
- | **Neon CLI (`neonctl`) + `psql`** | Schema analysis, migrations, RLS | Grep + Read code files |
168
- | **GitHub** | Issues, PRs, repo metadata, code search | Bash `gh` CLI |
169
- | **Context7** | Library documentation lookups | WebSearch + WebFetch |
170
- | **Playwright** | Browser automation, screenshots, page inspection, smoke tests | WebFetch (read-only), Manual testing |
171
- | **Azure** | Cloud resource management | Bash `az` CLI |
172
- | **Docker** | Container management | Bash `docker` CLI |
173
-
174
- ### The 3-Question Test
175
-
176
- Before choosing a tool, ask:
177
-
178
- 1. **Is the data local or external?**
179
- - Local → Read/Grep/Glob
180
- - External structured → MCP
181
- - External unstructured → WebSearch/WebFetch
182
-
183
- 2. **Am I reading or writing?**
184
- - Reading → Read/Grep/Glob/MCP
185
- - Writing → Write/Edit/Bash (for CLI)
186
-
187
- 3. **How many files are involved?**
188
- - 1-3 files → Direct tools (Read, Edit, Write)
189
- - 4+ files of known names → Parallel Read calls
190
- - Unknown files needing exploration → Glob/Grep, then Read
191
- - Complex multi-step analysis → Task subagent
192
-
193
- ### Global Anti-Patterns
194
-
195
- - ❌ **WebFetch for GitHub URLs** → Use `gh api` or `gh` CLI
196
- - Correct: `gh api repos/owner/repo/git/trees/main --field recursive=1`
197
- - Correct: `gh pr view 123`, `gh issue view 456`
198
- - WebFetch for GitHub returns HTML/redirect; `gh` uses the authenticated API
199
- - ❌ **Multi-option questions as plain text** → Use `AskUserQuestion` with `options[]`
200
- - Correct: `AskUserQuestion({ question: "Which approach?", options: [{label: "A"}, {label: "B"}] })`
201
- - Plain text creates ambiguity and requires manual response parsing
202
-
203
- ---
204
-
205
- ## MCP Registry
206
-
207
- For the canonical list of MCPs, their tools, phase relevance, and fallbacks, see:
208
-
209
- **`framework/skills/level-0-meta/mcp-registry.json`**
210
-
211
- ### Phase → MCP Quick Reference
212
-
213
- | Phase | Primary MCPs | Fallback |
214
- |-------|-------------|----------|
215
- | Proposal | Context7 | WebSearch |
216
- | Setup | GitHub | `gh` CLI |
217
- | UI/UX | Playwright, Context7 | WebFetch, Read CSS |
218
- | Design | Neon CLI, Context7, GitHub | Grep + Read code |
219
- | Tasks | Context7, GitHub | WebSearch, `gh` CLI |
220
- | Implement | Neon CLI, Context7, Playwright, GitHub | CLI tools |
221
-
222
- ### Detected Plugins & MCPs
223
-
224
- If `morph-spec init` was run with Claude Code environment detection, check `.morph/config/integrations.json` for the detected plugins and MCPs available in this project.
225
-
226
- ---
227
-
228
- ## Superpowers Integration
229
-
230
- When the `superpowers` plugin is installed, additional skills enhance each phase:
231
-
232
- | Phase | Superpowers Skill | Purpose |
233
- |-------|------------------|---------|
234
- | Setup | `using-git-worktrees` | Isolate feature work |
235
- | Design | `writing-plans`, `brainstorming` | Structure approach, explore alternatives |
236
- | Tasks | `writing-plans`, `executing-plans` | Plan and execute implementation |
237
- | Implement | `test-driven-development`, `systematic-debugging`, `requesting-code-review` | TDD, debug failures, review |
238
-
239
- See each phase skill for detailed integration instructions.
240
-
241
- ---
242
-
243
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,169 +0,0 @@
1
- # Tools Per Phase — Detailed Reference
2
-
3
- > Detailed tool selection tables for each MORPH-SPEC phase.
4
- > For the decision flowchart and selection rules, see the main `SKILL.md`.
5
-
6
- ---
7
-
8
- ## Phase 0 — Proposal
9
-
10
- **Goal:** Understand the feature request and create proposal.md
11
-
12
- | Action | Tool | Why |
13
- |--------|------|-----|
14
- | Read project context | **Read** `.morph/context/README.md` | Single known file |
15
- | Read config | **Read** `.morph/config.json` | Single known file |
16
- | Find existing features | **Glob** `.morph/features/*/0-proposal/proposal.md` | Pattern search |
17
- | Detect project stack | **Read** `.morph/framework/agents.json` → match keywords → **Bash** `morph-spec state add-agent` | agents.json is the source of truth |
18
- | Research external requirement | **WebSearch** | Current information needed |
19
- | Render proposal template | **Bash** `morph-spec template render docs/proposal ...` | CLI command |
20
- | Update state | **Bash** `morph-spec state mark-output {feature} proposal` | CLI command |
21
-
22
- **MCPs used:** None typically. GitHub MCP if feature comes from an issue.
23
-
24
- **Anti-patterns:**
25
- - ❌ Task agent to read proposal template (just use Read)
26
- - ❌ Bash `cat` to read files (use Read tool)
27
- - ❌ Bash `find` to locate files (use Glob tool)
28
-
29
- ---
30
-
31
- ---
32
-
33
- ## Phase 2 — UI/UX Design
34
-
35
- **Goal:** Create UI mockups, design system, component specs, user flows
36
-
37
- | Action | Tool | Why |
38
- |--------|------|-----|
39
- | Check existing design system | **Read** `.morph/context/design-system.md` | Single file |
40
- | Read user-provided screenshots | **Read** (image files) | Claude Code reads images natively |
41
- | Search for existing CSS variables | **Grep** `--root:` or `--color-` in `*.css,*.scss` | Find existing design tokens |
42
- | Find existing UI components | **Glob** `**/Components/**/*.razor` or `**/components/**/*.tsx` | Existing patterns |
43
- | Look up component library API | **Context7 MCP** `query_docs({ libraryId, query })` | Accurate component props/events |
44
- | Preview de página existente | **Playwright MCP** `browser_navigate()` + `browser_take_screenshot()` | **WebFetch** URL |
45
- | Inspecionar estrutura da página | **Playwright MCP** `browser_snapshot()` | **WebFetch** + parse manual |
46
- | Testar layout responsivo | **Playwright MCP** `browser_resize()` + `browser_take_screenshot()` | Manual testing |
47
- | Search for design references | **WebSearch** + **WebFetch** | External inspiration |
48
- | Render UI templates | **Bash** `morph-spec template render docs/ui-mockups ...` | CLI command |
49
- | Generate design system from CSS | **Bash** `morph-spec generate design-system --scan` | CLI command |
50
- | Update state | **Bash** `morph-spec state mark-output {feature} uiDesignSystem && morph-spec state mark-output {feature} uiMockups && morph-spec state mark-output {feature} uiComponents && morph-spec state mark-output {feature} uiFlows` | CLI command |
51
-
52
- **MCPs used:** Playwright (live preview, page inspection), Context7 (component docs).
53
-
54
- **Anti-patterns:**
55
- - ❌ WebSearch for MudBlazor docs (use Context7 MCP — more accurate)
56
- - ❌ Task agent to read a single screenshot (just use Read tool on the image)
57
- - ❌ Manually guessing component props (use Context7 to get real API)
58
-
59
- ---
60
-
61
- ## Phase 3 — Design (Technical Spec)
62
-
63
- **Goal:** Analyze schema, create spec.md, contracts-level{N}.cs, decisions.md
64
-
65
- | Action | Tool | Why |
66
- |--------|------|-----|
67
- | Read proposal + UI specs | **Read** output files | Single known files |
68
- | **Get dispatch config** | **Bash** `morph-spec dispatch-agents {feature} design` | Which agents to spawn + their task prompts |
69
- | **Dispatch architecture analyst** (parallel) | **Task** subagent with prompt from dispatch config | Analyze architecture complexity independently |
70
- | **Dispatch tech leads** (parallel) | **Task** subagents (dotnet-senior, nextjs-expert, etc.) | Validate architecture independently |
71
- | Get database schema | **Bash** `pg_dump $(neonctl connection-string)` or `psql <DB_URL>` | **PREFERRED** — real schema |
72
- | Get table relationships | **Bash** `psql <DB_URL>` FK queries | Real FK/constraint data |
73
- | Get RLS policies | **Bash** `psql <DB_URL>` pg_policies query | Security analysis |
74
- | **Fallback:** Find query files | **Grep** `\.from\(` or `\.select\(` in `*.ts,*.tsx,*.js,*.cs` | When no DB MCP available |
75
- | **Fallback:** Find type definitions | **Glob** `src/**/types/**/*.ts` or `**/Entities/**/*.cs` | When no DB MCP available |
76
- | **Fallback:** Read query/type files | **Read** each matched file | Extract field names manually |
77
- | Look up library for ADR | **Context7 MCP** `query_docs()` | Compare library capabilities |
78
- | Check existing code patterns | **GitHub MCP** `search_code()` | Find patterns in large repos |
79
- | **Fallback:** Search codebase | **Grep** patterns across project | When no GitHub MCP |
80
- | Render contracts template (detected level) | **Bash** `morph-spec template render code/dotnet/contracts/contracts-level{N}.cs ...` where N = level detected | CLI command |
81
- | Render spec template | **Bash** `morph-spec template render docs/spec ...` | CLI command |
82
- | Render decisions template | **Bash** `morph-spec template render docs/decisions ...` | CLI command |
83
- | Create schema-analysis.md | **Write** to output directory | Document findings |
84
- | Update state | **Bash** `morph-spec state mark-output {feature} schemaAnalysis && morph-spec state mark-output {feature} spec && morph-spec state mark-output {feature} contracts && morph-spec state mark-output {feature} decisions` | CLI command |
85
-
86
- **Tools used:** Neon CLI (`neonctl`) / psql (schema analysis), Context7 (library research), GitHub (code search).
87
-
88
- **Parallel dispatch opportunity:** Architecture complexity analysis and schema analysis (phase-codebase-analysis) are **independent** — run them as parallel Task subagents to cut design phase time.
89
-
90
- **Anti-patterns:**
91
- - ❌ Guessing field names without checking schema (use MCP or Grep first!)
92
- - ❌ Task agent to read a single spec file (use Read directly)
93
- - ❌ WebSearch for database schema (use Neon CLI/psql or code analysis)
94
- - ❌ Manually writing contracts-level{N}.cs from scratch (use template render)
95
- - ❌ Running domain analysis and schema analysis sequentially (they're independent — run in parallel)
96
-
97
- ---
98
-
99
- ---
100
-
101
- ## Phase 6 — Tasks
102
-
103
- **Goal:** Break spec into tasks, define dependencies, set checkpoints
104
-
105
- | Action | Tool | Why |
106
- |--------|------|-----|
107
- | Read spec + contracts + decisions | **Read** all output files | Full context needed |
108
- | **Get dispatch config** | **Bash** `morph-spec dispatch-agents {feature} tasks` | Which domain experts to consult |
109
- | Analyze implementation complexity | **Grep** patterns in existing code | Estimate effort from codebase size |
110
- | Count existing similar patterns | **Glob** `**/Services/**/*.cs` | Understand scope |
111
- | **Dispatch domain experts** (when spec is complex) | **Task** subagents per domain | Parallel per-domain task planning |
112
- | Look up implementation patterns | **Context7 MCP** `query_docs()` | Estimate task complexity accurately |
113
- | Create GitHub issues from tasks | **GitHub MCP** `create_issue()` | Sync tasks to project management |
114
- | **Fallback:** Create issues via CLI | **Bash** `gh issue create ...` | When no GitHub MCP |
115
- | Render tasks template | **Bash** `morph-spec template render docs/tasks ...` | CLI command |
116
- | Mark tasks output | **Bash** `morph-spec state mark-output {feature} tasks` | CLI command |
117
- | Update state with task count | **Bash** `morph-spec state set ... tasks.total N` | CLI command |
118
-
119
- **MCPs used:** Context7 (complexity estimation), GitHub (issue creation).
120
-
121
- **Anti-patterns:**
122
- - ❌ Task agent to break down a simple 1-domain spec (do it directly)
123
- - ✅ Task agent for complex multi-domain specs (backend + frontend + infra = 3 independent planners)
124
- - ✅ Task agent when spec has 20+ requirements across multiple bounded contexts
125
- - ❌ Manually writing tasks.json without reading all outputs first
126
-
127
- ---
128
-
129
- ## Phase 7 — Implement
130
-
131
- **Goal:** Implement tasks, checkpoint every 3, create recap
132
-
133
- | Action | Tool | Why |
134
- |--------|------|-----|
135
- | Read task details | **Read** tasks.json, spec.md, contracts.cs | Implementation reference |
136
- | **Check parallelization viability** | **Bash** `morph-spec dispatch-agents {feature} implement` | Whether to dispatch parallel implementers |
137
- | **Dispatch per-domain implementers** (when viable) | **Task** subagents — one per domain group | Backend tasks + frontend tasks run in parallel |
138
- | Create new files | **Write** new source files | New entities, services, pages |
139
- | Modify existing files | **Edit** existing source files | Add features to existing code |
140
- | Look up API during coding | **Context7 MCP** `query_docs()` | Accurate library usage |
141
- | Run database migrations | **Bash** `dotnet ef database update` | DDL via psql |
142
- | **Fallback:** Run migrations | **Bash** `dotnet ef ...` or `psql` | CLI tools |
143
- | Build project | **Bash** `dotnet build` or `npm run build` | Verify compilation |
144
- | Run tests | **Bash** `dotnet test` or `npm test` | Verify implementation |
145
- | Checkpoint validation | **Bash** `morph-spec checkpoint ...` | Every 3 tasks |
146
- | Create RLS policies | **Bash** write SQL migration + `dotnet ef database update` | Security policies |
147
- | Manage containers | **Bash** `docker ps`, `docker logs`, `docker compose` | Container health + debugging |
148
- | Create infrastructure | **Bash** `az bicep ...` or Bicep files via Write | IaC |
149
- | Create PR | **GitHub MCP** `create_pull_request()` or **Bash** `gh pr create` | Ship code |
150
- | Mark task done | **Bash** `morph-spec task done T001` | State tracking |
151
- | Smoke test feature no browser | **Playwright MCP** `browser_navigate()` + `browser_snapshot()` | Manual testing |
152
- | Verificar erros de console | **Playwright MCP** `browser_console_messages()` | Browser DevTools |
153
- | Screenshot para recap.md | **Playwright MCP** `browser_take_screenshot()` | Manual screenshot |
154
- | Mark recap output | **Bash** `morph-spec state mark-output {feature} recap` | CLI command |
155
-
156
- **Tools used:** Neon CLI (`neonctl`) / EF Core CLI (migrations), Context7 (API lookup), GitHub (PRs), Playwright (smoke test, verification).
157
-
158
- **Parallel dispatch threshold:**
159
- - `tasks.total ≥ 6` AND feature spans 2+ domains (e.g. `dotnet-senior` + `nextjs-expert`) → dispatch parallel implementers
160
- - Each subagent gets its own task group (backend T001-T005, frontend T006-T009) with isolated file scope
161
-
162
- **Anti-patterns:**
163
- - ❌ Task agent for a single file edit (use Edit directly)
164
- - ✅ Task agent for implementing a full service layer across 5+ files
165
- - ✅ Task agent for each domain group when feature has 6+ tasks across multiple domains
166
- - ❌ Bash `cat` to create files (use Write tool)
167
- - ❌ Bash `sed` to modify code (use Edit tool)
168
- - ❌ Implementing without reading contracts.cs first (contracts are the source of truth)
169
- - ❌ Implementing backend and frontend tasks sequentially when they have no cross-dependencies
@@ -1,148 +0,0 @@
1
- ---
2
- name: morph-verification-before-completion
3
- description: Phase-specific verification checklists and morph-spec validation commands for confirming MORPH-SPEC outputs are complete and correct. Use before marking any task done, before advancing to the next phase, before committing, or before creating PRs.
4
- user-invocable: true
5
- argument-hint: "[feature-name] [phase?]"
6
- allowed-tools: Read, Bash, Glob, Grep
7
- ---
8
-
9
- # Verification Before Completion — MORPH-SPEC Integrated
10
-
11
- > Never claim work is complete without running verification. Evidence before assertions.
12
- >
13
- > **Script:** Run `node .claude/skills/morph-verification-before-completion/scripts/check-phase-outputs.mjs <feature> [phase]` to check required output files exist.
14
-
15
- ## When to Use
16
-
17
- - Before marking any task as done (`morph-spec task done`)
18
- - Before advancing to the next phase
19
- - Before claiming a feature is complete
20
- - Before creating a PR or commit
21
-
22
- ---
23
-
24
- ## Phase-Specific Checklists
25
-
26
- ### Phase 0 — Proposal
27
-
28
- - [ ] `proposal.md` exists in `.morph/features/{feature}/0-proposal/`
29
- - [ ] Proposal contains: Goal, Scope, Constraints, Success Criteria
30
- - [ ] `morph-spec state get {feature}` shows `phase: proposal`
31
- - [ ] `morph-spec state mark-output {feature} proposal` was called
32
-
33
- ### Phase 1 — UI/UX (if applicable)
34
-
35
- - [ ] `design-system.md` exists with color tokens, typography, spacing
36
- - [ ] `mockups.md` exists with wireframes/ASCII mockups
37
- - [ ] `morph-spec validate-feature {feature} --phase uiux` passes
38
-
39
- ### Phase 2 — Design
40
-
41
- - [ ] `spec.md` contains: Overview, Functional Requirements, Technical Architecture, Data Model
42
- - [ ] `contracts.cs` exists with DTOs matching `schema-analysis.md`
43
- - [ ] `decisions.md` contains at least 1 ADR
44
- - [ ] Quality + satisfaction score ≥ 85 (or user finalized)
45
- - [ ] `morph-spec validate-feature {feature} --phase design` passes
46
-
47
- ### Phase 3 — Plan
48
-
49
- - [ ] `plan.md` exists in `.morph/features/{feature}/3-plan/`
50
- - [ ] Plan contains: Goal, Architecture, Execution Strategy, Task Groups
51
- - [ ] Each task has exact file paths and complete code
52
- - [ ] Execution strategy defined (single / subagents / agent-teams)
53
- - [ ] `morph-spec state mark-output {feature} plan` was called
54
- - [ ] User approved plan via `morph-spec approve {feature} plan`
55
-
56
- ### Phase 6 — Tasks
57
-
58
- - [ ] `tasks.md` exists
59
- - [ ] All tasks have: ID, title, description, dependencies
60
- - [ ] Checkpoints defined (every 3 tasks)
61
- - [ ] `morph-spec state set {feature} tasks.total N` called
62
-
63
- ### Phase 7 — Implement
64
-
65
- - [ ] All tasks marked as completed
66
- - [ ] Build succeeds (`npm run build` or `dotnet build`)
67
- - [ ] Tests pass (`npm test` or `dotnet test`)
68
- - [ ] `recap.md` generated with implementation summary
69
- - [ ] `morph-spec validate-feature {feature}` passes all checks
70
-
71
- ---
72
-
73
- ## Verification Commands
74
-
75
- ```bash
76
- # Run full feature validation
77
- morph-spec validate-feature {feature-name}
78
-
79
- # Check feature state and phase
80
- morph-spec state get {feature-name}
81
-
82
- # Check approval gates
83
- morph-spec approval-status {feature-name}
84
-
85
- # Check overall project status
86
- morph-spec status
87
- ```
88
-
89
- ---
90
-
91
- ## Integration with Task Done
92
-
93
- Before running `morph-spec task done`:
94
-
95
- 1. **Run the relevant test** for the task being completed
96
- 2. **Run `morph-spec validate-feature`** if completing a checkpoint task
97
- 3. **Read the task spec** and verify all acceptance criteria are met
98
- 4. **Check for build errors** — run build command
99
-
100
- ```bash
101
- # Verify before marking done
102
- morph-spec validate-feature {feature}
103
- morph-spec task done {feature} T001
104
- ```
105
-
106
- ---
107
-
108
- ## Integration with Checkpoints
109
-
110
- Every 3 tasks, run full checkpoint validation:
111
-
112
- ```bash
113
- morph-spec checkpoint-save {feature}
114
- morph-spec validate-feature {feature}
115
- ```
116
-
117
- If validation fails:
118
- 1. **Do NOT mark the task as done**
119
- 2. **Fix the issues** identified by validation
120
- 3. **Re-run validation** until it passes
121
- 4. **Then** mark the task as done
122
-
123
- ---
124
-
125
- ## Integration with Superpowers
126
-
127
- > Available when the `superpowers` plugin is installed.
128
-
129
- This skill replaces `superpowers:verification-before-completion` within morph-spec workflows. It adds:
130
- - Phase-specific checklists (not just generic verification)
131
- - `morph-spec validate-feature` integration
132
- - Checkpoint system integration
133
- - State tracking verification
134
-
135
- For verification **outside** morph-spec workflows, the original `superpowers:verification-before-completion` skill remains available.
136
-
137
- ---
138
-
139
- ## Anti-patterns
140
-
141
- - Never claim "tests pass" without actually running them
142
- - Never skip validation because "the change is small"
143
- - Never mark a task done if build is broken
144
- - Never advance phases without checking the phase checklist
145
-
146
- ---
147
-
148
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,110 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * check-phase-outputs.mjs
4
- *
5
- * Verifies that required MORPH-SPEC output files exist for a feature/phase.
6
- * Executed locally by Claude via Bash — output is returned to Claude.
7
- *
8
- * Usage:
9
- * node check-phase-outputs.mjs <feature> [phase]
10
- *
11
- * Examples:
12
- * node check-phase-outputs.mjs photo-processing design
13
- * node check-phase-outputs.mjs photo-processing # checks all phases
14
- *
15
- * Output: JSON array of { phase, file, exists, required }
16
- */
17
-
18
- import { existsSync } from 'fs';
19
- import { join } from 'path';
20
-
21
- const PHASE_OUTPUTS = {
22
- proposal: [
23
- { file: '0-proposal/proposal.md', required: true },
24
- ],
25
- design: [
26
- { file: '2-design/spec.md', required: true },
27
- { file: '2-design/contracts.cs', required: true },
28
- { file: '2-design/decisions.md', required: true },
29
- { file: '2-design/schema-analysis.md', required: false },
30
- ],
31
- uiux: [
32
- { file: '1-ui/design-system.md', required: true },
33
- { file: '1-ui/mockups.md', required: true },
34
- { file: '1-ui/components.md', required: true },
35
- { file: '1-ui/flows.md', required: false },
36
- ],
37
- tasks: [
38
- { file: '4-tasks/tasks.md', required: true },
39
- ],
40
- implement: [
41
- { file: '5-implement/recap.md', required: true },
42
- ],
43
- };
44
-
45
- const feature = process.argv[2];
46
- const targetPhase = process.argv[3];
47
-
48
- if (!feature) {
49
- console.error(JSON.stringify({ error: 'Usage: check-phase-outputs.mjs <feature> [phase]' }));
50
- process.exit(1);
51
- }
52
-
53
- // Walk up to find .morph/ directory
54
- let cwd = process.cwd();
55
- let morphDir = null;
56
- for (let i = 0; i < 5; i++) {
57
- const candidate = join(cwd, '.morph');
58
- if (existsSync(candidate)) {
59
- morphDir = candidate;
60
- break;
61
- }
62
- const parent = join(cwd, '..');
63
- if (parent === cwd) break;
64
- cwd = parent;
65
- }
66
-
67
- if (!morphDir) {
68
- console.error(JSON.stringify({ error: '.morph/ directory not found. Run from inside a MORPH-SPEC project.' }));
69
- process.exit(1);
70
- }
71
-
72
- const featureDir = join(morphDir, 'features', feature);
73
- if (!existsSync(featureDir)) {
74
- console.error(JSON.stringify({ error: `Feature directory not found: .morph/features/${feature}` }));
75
- process.exit(1);
76
- }
77
-
78
- const phases = targetPhase
79
- ? { [targetPhase]: PHASE_OUTPUTS[targetPhase] }
80
- : PHASE_OUTPUTS;
81
-
82
- if (targetPhase && !PHASE_OUTPUTS[targetPhase]) {
83
- console.error(JSON.stringify({ error: `Unknown phase: ${targetPhase}. Valid: ${Object.keys(PHASE_OUTPUTS).join(', ')}` }));
84
- process.exit(1);
85
- }
86
-
87
- const results = [];
88
- let missingRequired = 0;
89
-
90
- for (const [phase, outputs] of Object.entries(phases)) {
91
- for (const { file, required } of outputs) {
92
- const fullPath = join(featureDir, file);
93
- const exists = existsSync(fullPath);
94
- if (required && !exists) missingRequired++;
95
- results.push({ phase, file, exists, required });
96
- }
97
- }
98
-
99
- const summary = {
100
- feature,
101
- featureDir: featureDir.replace(/\\/g, '/'),
102
- checks: results.length,
103
- passed: results.filter(r => r.exists).length,
104
- missingRequired,
105
- ready: missingRequired === 0,
106
- results,
107
- };
108
-
109
- console.log(JSON.stringify(summary, null, 2));
110
- process.exit(missingRequired > 0 ? 1 : 0);
@@ -1,7 +0,0 @@
1
- # Level 1: Workflows
2
-
3
- Phase orchestration and workflow management.
4
-
5
- **Purpose:** Skills that implement MORPH workflow phases (FASE 0-6).
6
-
7
- **Examples:** phase-design, phase-uiux, phase-plan, phase-implement