@jamie-tam/forge 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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/agents/architect.md +92 -0
  4. package/agents/builder.md +122 -0
  5. package/agents/code-reviewer.md +107 -0
  6. package/agents/concept-designer.md +207 -0
  7. package/agents/craft-reviewer.md +132 -0
  8. package/agents/critic.md +130 -0
  9. package/agents/doc-writer.md +85 -0
  10. package/agents/dreamer.md +129 -0
  11. package/agents/e2e-runner.md +89 -0
  12. package/agents/gotcha-hunter.md +127 -0
  13. package/agents/prototype-builder.md +193 -0
  14. package/agents/prototype-codifier.md +204 -0
  15. package/agents/prototype-reviewer.md +163 -0
  16. package/agents/security-reviewer.md +108 -0
  17. package/agents/spec-reviewer.md +94 -0
  18. package/agents/tracer.md +98 -0
  19. package/agents/wireframer.md +109 -0
  20. package/commands/abort.md +25 -0
  21. package/commands/bugfix.md +151 -0
  22. package/commands/evolve.md +118 -0
  23. package/commands/feature.md +236 -0
  24. package/commands/forge.md +100 -0
  25. package/commands/greenfield.md +185 -0
  26. package/commands/hotfix.md +98 -0
  27. package/commands/refactor.md +147 -0
  28. package/commands/resume.md +25 -0
  29. package/commands/setup.md +201 -0
  30. package/commands/status.md +27 -0
  31. package/commands/task-force.md +110 -0
  32. package/commands/validate.md +12 -0
  33. package/dist/__tests__/active-manifest.test.js +272 -0
  34. package/dist/__tests__/copy.test.js +96 -0
  35. package/dist/__tests__/gate-check.test.js +384 -0
  36. package/dist/__tests__/wiki.test.js +472 -0
  37. package/dist/__tests__/work-manifest.test.js +304 -0
  38. package/dist/active-manifest.js +229 -0
  39. package/dist/cli.js +158 -0
  40. package/dist/copy.js +124 -0
  41. package/dist/gate-check.js +326 -0
  42. package/dist/hooks.js +60 -0
  43. package/dist/init.js +140 -0
  44. package/dist/manifest.js +90 -0
  45. package/dist/merge.js +77 -0
  46. package/dist/paths.js +36 -0
  47. package/dist/uninstall.js +216 -0
  48. package/dist/update.js +158 -0
  49. package/dist/verify-manifest.js +65 -0
  50. package/dist/verify.js +98 -0
  51. package/dist/wiki-ui.js +310 -0
  52. package/dist/wiki.js +364 -0
  53. package/dist/work-manifest.js +798 -0
  54. package/hooks/config/gate-requirements.json +79 -0
  55. package/hooks/hooks.json +143 -0
  56. package/hooks/scripts/analyze-telemetry.sh +114 -0
  57. package/hooks/scripts/gate-enforcer.sh +164 -0
  58. package/hooks/scripts/pre-compact.sh +90 -0
  59. package/hooks/scripts/session-start.sh +81 -0
  60. package/hooks/scripts/telemetry.sh +41 -0
  61. package/hooks/scripts/wiki-lint.sh +87 -0
  62. package/hooks/templates/AGENTS.md.template +48 -0
  63. package/hooks/templates/CLAUDE.md.template +45 -0
  64. package/package.json +55 -0
  65. package/protocols/README.md +40 -0
  66. package/protocols/codex.md +151 -0
  67. package/protocols/graphify.md +156 -0
  68. package/references/common/agent-coordination.md +65 -0
  69. package/references/common/coding-standards.md +54 -0
  70. package/references/common/feature-tracking.md +21 -0
  71. package/references/common/io-protocol.md +36 -0
  72. package/references/common/phases.md +57 -0
  73. package/references/common/quality-gates.md +130 -0
  74. package/references/common/skill-authoring.md +154 -0
  75. package/references/common/skill-compliance.md +30 -0
  76. package/references/python/standards.md +44 -0
  77. package/references/react/standards.md +61 -0
  78. package/references/typescript/standards.md +42 -0
  79. package/rules/common/forge-system.md +59 -0
  80. package/rules/common/git-workflow.md +40 -0
  81. package/rules/common/guardrails.md +37 -0
  82. package/rules/common/quality-gates.md +18 -0
  83. package/rules/common/security.md +50 -0
  84. package/rules/common/skill-selection.md +78 -0
  85. package/rules/common/testing.md +58 -0
  86. package/rules/common/verification.md +39 -0
  87. package/skills/build-pr-workflow/SKILL.md +301 -0
  88. package/skills/build-pr-workflow/references/pr-template.md +62 -0
  89. package/skills/build-pr-workflow/references/subagent-merge.md +47 -0
  90. package/skills/build-pr-workflow/references/worktree-setup.md +125 -0
  91. package/skills/build-prototype/SKILL.md +264 -0
  92. package/skills/build-scaffold/SKILL.md +340 -0
  93. package/skills/build-tdd/SKILL.md +89 -0
  94. package/skills/build-wireframe/SKILL.md +110 -0
  95. package/skills/build-wireframe/assets/baseline-template.html +486 -0
  96. package/skills/build-wireframe/references/demo-walkthroughs.md +170 -0
  97. package/skills/build-wireframe/references/gotchas.md +188 -0
  98. package/skills/build-wireframe/references/legend-lines.md +141 -0
  99. package/skills/concept-slides/SKILL.md +192 -0
  100. package/skills/deliver-db-migration/SKILL.md +466 -0
  101. package/skills/deliver-deploy/SKILL.md +407 -0
  102. package/skills/deliver-onboarding/SKILL.md +198 -0
  103. package/skills/deliver-onboarding/references/document-templates.md +393 -0
  104. package/skills/deliver-onboarding/templates/getting-started.md +122 -0
  105. package/skills/discover-codebase-analysis/SKILL.md +448 -0
  106. package/skills/discover-requirements/SKILL.md +418 -0
  107. package/skills/discover-requirements/templates/prd.md +99 -0
  108. package/skills/discover-requirements/templates/technical-spec.md +123 -0
  109. package/skills/discover-requirements/templates/user-stories.md +76 -0
  110. package/skills/harden/SKILL.md +214 -0
  111. package/skills/iterate-prototype/SKILL.md +241 -0
  112. package/skills/plan-architecture/SKILL.md +457 -0
  113. package/skills/plan-architecture/templates/adr-template.md +52 -0
  114. package/skills/plan-architecture/templates/api-contract.md +99 -0
  115. package/skills/plan-architecture/templates/db-schema.md +81 -0
  116. package/skills/plan-architecture/templates/system-design.md +111 -0
  117. package/skills/plan-brainstorm/SKILL.md +433 -0
  118. package/skills/plan-design-system/SKILL.md +279 -0
  119. package/skills/plan-task-decompose/SKILL.md +454 -0
  120. package/skills/quality-code-review/SKILL.md +286 -0
  121. package/skills/quality-security-audit/SKILL.md +292 -0
  122. package/skills/quality-security-audit/references/audit-report-template.md +89 -0
  123. package/skills/quality-security-audit/references/owasp-checks.md +178 -0
  124. package/skills/quality-test-execution/SKILL.md +435 -0
  125. package/skills/quality-test-plan/SKILL.md +297 -0
  126. package/skills/quality-test-plan/references/test-type-guide.md +263 -0
  127. package/skills/quality-test-plan/templates/e2e-test-plan.md +72 -0
  128. package/skills/quality-test-plan/templates/integration-test-plan.md +74 -0
  129. package/skills/quality-test-plan/templates/load-test-plan.md +111 -0
  130. package/skills/quality-test-plan/templates/smoke-test-plan.md +68 -0
  131. package/skills/quality-test-plan/templates/unit-test-plan.md +56 -0
  132. package/skills/quality-uiux/SKILL.md +481 -0
  133. package/skills/support-debug/SKILL.md +464 -0
  134. package/skills/support-dream/SKILL.md +213 -0
  135. package/skills/support-gotcha/SKILL.md +249 -0
  136. package/skills/support-runtime-reachability/SKILL.md +190 -0
  137. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/app.ts +7 -0
  138. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/handlers/cases.ts +7 -0
  139. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/app.ts +8 -0
  140. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/handlers/cases.ts +7 -0
  141. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/App.tsx +5 -0
  142. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/components/RingingBanner.tsx +7 -0
  143. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/hooks/useTwilio.ts +6 -0
  144. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/App.tsx +5 -0
  145. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/components/MyComp.tsx +3 -0
  146. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/App.tsx +3 -0
  147. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/components/Orphan.tsx +3 -0
  148. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/lib/Service.ts +6 -0
  149. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/main.ts +4 -0
  150. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/lib/Lonely.ts +5 -0
  151. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/main.ts +2 -0
  152. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/handler.ts +3 -0
  153. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/main.ts +3 -0
  154. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/handler.ts +3 -0
  155. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/main.ts +2 -0
  156. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/lib.ts +5 -0
  157. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/main.ts +3 -0
  158. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/index.ts +1 -0
  159. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/internal.ts +3 -0
  160. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/main.ts +3 -0
  161. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.test.ts +5 -0
  162. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.ts +3 -0
  163. package/skills/support-runtime-reachability/scripts/__fixtures__/case-13-gated-pending-annotation/src/future.ts +4 -0
  164. package/skills/support-runtime-reachability/scripts/__fixtures__/case-14-untraceable-annotation/src/decorated.ts +4 -0
  165. package/skills/support-runtime-reachability/scripts/__fixtures__/case-15-untraceable-empty/src/lazy.ts +4 -0
  166. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/lib.py +15 -0
  167. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/main.py +5 -0
  168. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/parent.ts +5 -0
  169. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/routes/cases.ts +5 -0
  170. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/lib/foo.ts +3 -0
  171. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/other.ts +8 -0
  172. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/cases.ts +4 -0
  173. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/users.ts +4 -0
  174. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/main.ts +5 -0
  175. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/handlers/cases.ts +3 -0
  176. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/main.ts +4 -0
  177. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/lib.ts +5 -0
  178. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/main.ts +5 -0
  179. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/lib.ts +3 -0
  180. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/main.ts +8 -0
  181. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/lib.ts +3 -0
  182. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/main.ts +7 -0
  183. package/skills/support-runtime-reachability/scripts/check.mjs +638 -0
  184. package/skills/support-runtime-reachability/scripts/check.test.mjs +244 -0
  185. package/skills/support-skill-validator/SKILL.md +194 -0
  186. package/skills/support-skill-validator/references/false-positives.md +59 -0
  187. package/skills/support-skill-validator/references/validation-checks.md +280 -0
  188. package/skills/support-system-guide/SKILL.md +311 -0
  189. package/skills/support-task-force/SKILL.md +265 -0
  190. package/skills/support-task-force/references/dispatch-pattern.md +178 -0
  191. package/skills/support-task-force/references/synthesis-template.md +126 -0
  192. package/skills/support-wiki-bootstrap/SKILL.md +37 -0
  193. package/skills/support-wiki-lint/SKILL.md +196 -0
  194. package/skills/support-wiki-lint/scripts/lint.mjs +488 -0
  195. package/skills/support-wiki-lint/scripts/lint.test.mjs +196 -0
  196. package/templates/README.md +23 -0
  197. package/templates/aiwiki/CLAUDE.md.template +78 -0
  198. package/templates/aiwiki/schemas/architecture.md +118 -0
  199. package/templates/aiwiki/schemas/convention.md +112 -0
  200. package/templates/aiwiki/schemas/decision.md +144 -0
  201. package/templates/aiwiki/schemas/gotcha.md +118 -0
  202. package/templates/aiwiki/schemas/oracle.md +105 -0
  203. package/templates/aiwiki/schemas/session.md +125 -0
  204. package/templates/manifests/bugfix.yaml +41 -0
  205. package/templates/manifests/feature.yaml +69 -0
  206. package/templates/manifests/greenfield.yaml +61 -0
  207. package/templates/manifests/hotfix.yaml +45 -0
  208. package/templates/manifests/refactor.yaml +44 -0
  209. package/templates/manifests/v5/SCHEMA.md +327 -0
  210. package/templates/manifests/v5/feature.yaml +77 -0
  211. package/templates/manifests/v6/SCHEMA.md +199 -0
  212. package/templates/wiki-html/dream-detail.html +378 -0
  213. package/templates/wiki-html/dreams-list.html +155 -0
@@ -0,0 +1,454 @@
1
+ ---
2
+ name: plan-task-decompose
3
+ description: "Use when architecture artifacts exist and the user asks to 'break this down', 'plan the tasks', 'order the work', 'create a task list', 'decompose into slices'. Outputs ordered, testable tasks with file paths. For prototype-driven /feature and /greenfield, harden produces the slice graph — use this skill only when harden doesn't apply (library, internal tool, refactor)."
4
+ ---
5
+
6
+ # Plan Task Decompose
7
+
8
+ Break architecture artifacts into bite-sized, implementable tasks. Each task takes 2-5 minutes, references exact file paths, includes complete code examples, and maps dependencies so tasks can be executed in the correct order — by humans or subagents.
9
+
10
+ **When this skill is the wrong fit:** v6 prototype-driven flow produces the production task graph (slice graph) from the `harden` skill at Phase 5 (codify), with dependencies and acceptance criteria derived from the locked prototype. This skill is the non-prototype fallback that decomposes architecture artifacts upfront; use it only when prototype/wireframe phases were skipped.
11
+
12
+ **Announce at start:** "I'm using the plan-task-decompose skill to create the implementation plan."
13
+
14
+ <HARD-GATE>
15
+ When this skill is invoked: do NOT begin implementation until the task plan has been reviewed by the spec-reviewer subagent and approved by the user. Once this skill is on the path, the gate applies. In v6 prototype-driven flow, this skill is not on the path — `harden` produces the slice graph and runs adversarial review on each ADR.
16
+ </HARD-GATE>
17
+
18
+ ---
19
+
20
+ ## I/O Contract
21
+
22
+ | Field | Value |
23
+ |---|---|
24
+ | **Requires** | Architecture artifacts: `api-contract.md`, `db-schema.md`, `system-diagram.md`. Brainstorm: `brainstorm-approved.md`. Codebase analysis: `codebase-analysis.md` (if existing project). |
25
+ | **Produces** | `.forge/work/{type}/{name}/tasks.md` |
26
+ | **Feeds into** | `build-tdd`, `build-pr-workflow`, subagent dispatch |
27
+ | **Updates manifest** | `artifacts.tasks` |
28
+
29
+ ---
30
+
31
+ ## Checklist
32
+
33
+ Complete these steps in order:
34
+
35
+ 1. **Read all input artifacts** -- architecture, brainstorm, codebase analysis
36
+ 2. **Map file structure** -- which files will be created or modified
37
+ 3. **Define tasks** -- 2-5 minute units with exact paths and code
38
+ 4. **Map dependencies** -- which tasks block others, which can parallelize
39
+ 5. **Flag subagent coordination points** -- tasks that share interfaces
40
+ 6. **Write plan header** -- goal, architecture summary, tech stack
41
+ 7. **Write complete task plan** -- save to `.forge/work/{type}/{name}/tasks.md`
42
+ 8. **Plan review loop** -- dispatch spec-reviewer subagent (max 3 iterations)
43
+ 9. **User reviews plan** -- present for approval
44
+ 10. **Update feature manifest** -- record artifact path
45
+ 11. **Execution handoff** -- offer execution options
46
+
47
+ ---
48
+
49
+ ## Scope Check
50
+
51
+ Before decomposing, verify the scope is appropriate for a single plan:
52
+
53
+ - If the architecture covers multiple independent subsystems, it should have been broken into sub-projects during brainstorming
54
+ - If it was not, suggest breaking into separate plans: one per subsystem
55
+ - Each plan should produce working, testable software on its own
56
+
57
+ > "The architecture covers {N} independent subsystems. I recommend separate task plans for each. Which should we start with?"
58
+
59
+ ---
60
+
61
+ ## Process
62
+
63
+ ### Step 1: Read All Input Artifacts
64
+
65
+ Read and internalize every input:
66
+
67
+ **Architecture artifacts:**
68
+ - `api-contract.md` -- every endpoint, type, and error code
69
+ - `db-schema.md` -- every table, column, index, and constraint
70
+ - `system-diagram.md` -- component relationships and data flow
71
+
72
+ **Design context:**
73
+ - `brainstorm-approved.md` -- the approved approach and rationale
74
+ - `codebase-analysis.md` -- existing patterns, conventions, risks
75
+
76
+ **Decision log:**
77
+ - `aiwiki/decisions/` -- ADRs that affect implementation choices
78
+
79
+ Cross-reference: verify that task decomposition will implement everything defined in the API contract and DB schema. Nothing should be lost between architecture and tasks.
80
+
81
+ ### Step 1.5: Codex Mode Check
82
+
83
+ Now that input artifacts are read, run the Codex consent flow from `protocols/codex.md`. The selected mode applies for the rest of this skill's invocation.
84
+
85
+ - **Takeover:** Dispatch Codex with the artifacts to decompose into tasks, dependencies, and code examples. Claude reviews ordering and parallelization.
86
+ - **Verify** or **Skip / Codex unavailable:** Proceed with the steps below. Step 7.5 will dispatch Codex to review Claude's task plan (Verify only).
87
+
88
+ ### Step 2: Map File Structure
89
+
90
+ Before defining tasks, map out every file that will be created or modified. This is where decomposition decisions get locked in.
91
+
92
+ ```markdown
93
+ ## File Structure
94
+
95
+ ### New Files
96
+ - `src/api/routes/payments.ts` -- Payment API routes
97
+ - `src/services/payment-service.ts` -- Payment business logic
98
+ - `src/models/payment.ts` -- Payment database model
99
+ - `src/validators/payment-validator.ts` -- Request validation schemas
100
+ - `src/types/payment.ts` -- TypeScript type definitions
101
+ - `tests/unit/services/payment-service.test.ts` -- Unit tests
102
+ - `tests/integration/api/payments.test.ts` -- Integration tests
103
+ - `migrations/YYYYMMDD_create_payments.ts` -- Database migration
104
+
105
+ ### Modified Files
106
+ - `src/api/routes/index.ts:15-20` -- Register payment routes
107
+ - `src/types/index.ts:8-12` -- Export payment types
108
+ - `src/config/database.ts:25-30` -- Add payment table config
109
+ ```
110
+
111
+ Rules for file structure:
112
+
113
+ - **Design units with clear boundaries.** Each file has one clear responsibility.
114
+ - **Prefer smaller, focused files.** You reason better about code you can hold in context. Your edits are more reliable when files are focused.
115
+ - **Files that change together should live together.** Split by responsibility, not by technical layer.
116
+ - **In existing codebases, follow established patterns.** If the codebase uses large files, do not unilaterally restructure. But if a file you are modifying has grown unwieldy, including a split in the plan is reasonable.
117
+ - **Exact paths required.** No "somewhere in the api directory." Exact file path for every file.
118
+
119
+ ### Step 3: Define Tasks
120
+
121
+ Each task is a small, self-contained unit of work taking 2-5 minutes. Follow strict TDD task structure.
122
+
123
+ **Frontend tasks MUST include visual specs.** If a `DESIGN.md` exists at the project root (from the `plan-design-system` skill), every task that creates or modifies a frontend component must include:
124
+ - Layout structure (flexbox/grid, spacing, sizing)
125
+ - Colors and typography referencing the design tokens from `DESIGN.md`
126
+ - Interactive states (hover, focus, active, disabled)
127
+ - Responsive behavior at key breakpoints
128
+
129
+ Also check for feature-scoped overrides in `.forge/work/{type}/{name}/design-overrides.md` — if present, those tokens take precedence over root `DESIGN.md` for this feature's tasks.
130
+
131
+ Without visual specs, agents will implement behavior-only components and skip styling entirely (TDD tests verify behavior, not appearance). If no `DESIGN.md` exists (e.g., bugfix command, or user skipped the step), note in the task that visual styling should follow existing patterns in the codebase.
132
+
133
+ **Task granularity -- each step is ONE action:**
134
+
135
+ - "Write the failing test" -- one step
136
+ - "Run it to verify it fails" -- one step
137
+ - "Implement minimal code to pass" -- one step
138
+ - "Run tests to verify they pass" -- one step
139
+ - "Commit" -- one step
140
+
141
+ **Task structure:**
142
+
143
+ ```markdown
144
+ ### Task {N}: {Name}
145
+ **Time:** 2-5 min | **Dependencies:** Task {X} | **Parallelizable:** Yes/No
146
+ **Files:** Create: `path/to/file.ts` | Modify: `path/to/existing.ts:L1-L20` | Test: `tests/path/test.ts`
147
+ **API contract ref:** `POST /resource` (if applicable)
148
+
149
+ - [ ] Write failing test — include complete test code
150
+ - [ ] Run: `{test command} {file}` | Expected: FAIL ("Cannot find module...")
151
+ - [ ] Write minimal implementation — include complete implementation code
152
+ - [ ] Run: `{test command} {file}` | Expected: PASS
153
+ - [ ] `git commit -m "feat(scope): description"`
154
+ ```
155
+
156
+ Rules for task content:
157
+
158
+ - **Complete code in every step.** Never write "add validation logic here" or "implement the handler." Provide the actual code.
159
+ - **Exact file paths.** Not "the test file" -- the specific path.
160
+ - **Exact commands.** Not "run the tests" -- the specific command with arguments.
161
+ - **Expected output.** What should the developer see after running the command?
162
+ - **One behavior per test.** Each test tests one thing.
163
+ - **Reference API contracts.** When a task implements an API endpoint, reference the exact contract section.
164
+
165
+ ### Step 4: Map Dependencies
166
+
167
+ Create a dependency map showing task execution order:
168
+
169
+ ```markdown
170
+ ## Execution Order
171
+
172
+ | Phase | Tasks | Parallel? |
173
+ |---|---|---|
174
+ | Phase 1: Foundation | Task 1, Task 2 | Yes |
175
+ | Phase 2: Data Layer | Task 3, Task 4 | Yes (after Phase 1) |
176
+ | Phase 3: Logic | Task 5 (needs 3+4), Task 6 (independent) | Partial |
177
+ | Phase 4: API | Task 7 (needs Phase 3) | No |
178
+ | Phase 5: Verification | Task 8 (needs Phase 4) | No |
179
+ ```
180
+
181
+ Rules for dependency mapping:
182
+
183
+ - **Explicit blocking relationships.** "Task 5 cannot start until Tasks 3 and 4 are complete because it imports types from both."
184
+ - **Parallel opportunities.** Identify tasks that have no dependency on each other and can run simultaneously by different subagents.
185
+ - **Phase grouping.** Group tasks into phases. All tasks in a phase can run in parallel. Phases execute sequentially.
186
+ - **File-overlap validation.** After grouping tasks into phases, verify: no two tasks in the same phase create or modify the same file. If overlap is found, move one task to a later phase. Parallel tasks must have zero file overlap — merge conflicts are decomposition errors, not expected outcomes.
187
+ - **Critical path.** Identify the longest dependency chain -- this determines minimum total time.
188
+
189
+ ### Step 5: Flag Subagent Coordination Points
190
+
191
+ When multiple subagents will work on related tasks, flag the coordination requirements:
192
+
193
+ ```markdown
194
+ ## Subagent Coordination Points
195
+
196
+ ### Shared Interface: PaymentService <-> PaymentRoutes
197
+ - **Contract:** POST /api/payments from api-contract.md
198
+ - **Tasks affected:** Task 5 (Service), Task 7 (Routes)
199
+ - **Agreement:** PaymentService.createPayment() accepts CreatePaymentInput, returns Payment
200
+ - **Type definition:** Task 1 defines the shared types -- MUST be complete before Tasks 5 and 7 start
201
+
202
+ ### Shared Interface: PaymentModel <-> PaymentService
203
+ - **Contract:** db-schema.md payments table
204
+ - **Tasks affected:** Task 3 (Model), Task 5 (Service)
205
+ - **Agreement:** Model exposes insert(), findById(), update() with types from Task 1
206
+ ```
207
+
208
+ Rules:
209
+
210
+ - **API contracts are the source of truth.** Subagents implement what the contract specifies, not what they think is best.
211
+ - **Shared types must be defined first.** Flag any task that defines types consumed by other tasks as a hard prerequisite.
212
+ - **Interface mismatches are the #1 cause of subagent bugs.** Make interfaces explicit and unambiguous.
213
+
214
+ ### Step 6: Write Plan Header
215
+
216
+ Every plan starts with this header:
217
+
218
+ ```markdown
219
+ # {Feature Name} Implementation Plan
220
+
221
+ > **For agentic workers:** Use build-tdd skill to implement each task. Steps use checkbox (`- [ ]`) syntax for tracking.
222
+
223
+ **Goal:** {One sentence describing what this builds}
224
+
225
+ **Architecture:** {2-3 sentences about the approach, referencing brainstorm-approved.md}
226
+
227
+ **Tech Stack:** {Key technologies and libraries}
228
+
229
+ **Estimated tasks:** {N} tasks in {N} execution waves
230
+
231
+ **Critical path:** {Tasks on the longest dependency chain}
232
+
233
+ ---
234
+ ```
235
+
236
+ ### Step 7: Write Complete Task Plan
237
+
238
+ Assemble the full plan and save to `.forge/work/{type}/{name}/tasks.md`:
239
+
240
+ 1. Plan header (Step 6)
241
+ 2. File structure map (Step 2)
242
+ 3. Task dependency graph (Step 4)
243
+ 4. Subagent coordination points (Step 5)
244
+ 5. All tasks in execution order (Step 3)
245
+
246
+ The plan must be self-contained. A developer or subagent with ZERO context about the project should be able to pick up the plan and execute it by following the tasks in order.
247
+
248
+ ### Step 7.5: Codex Verify
249
+ After writing the task plan, check the mode recorded at Step 1.5. If **Verify** was selected, dispatch Codex to review for missing dependencies, oversized tasks, and parallelization opportunities. Merge findings into the task plan before user review. If **Takeover** was selected, skip this step (Codex already decomposed). If **Skip**, do nothing. Do NOT re-run the consent flow. See **Codex Integration** section below for full details.
250
+
251
+ ### Step 8: Plan Review Loop
252
+
253
+ After writing the complete plan, dispatch a spec-reviewer subagent:
254
+
255
+ 1. **Dispatch spec-reviewer** with precisely crafted review context -- provide the path to the plan document, the path to the architecture artifacts, and the path to the spec document. Never send your session history. This keeps the reviewer focused on the plan.
256
+ 2. **If issues found:** Fix the issues, re-dispatch reviewer for the whole plan.
257
+ 3. **If approved:** Proceed to user review.
258
+ 4. **Max 3 iterations.** If the loop exceeds 3 iterations without convergence, surface remaining issues to the user for guidance.
259
+
260
+ The reviewer checks for:
261
+
262
+ - **Completeness** -- does the plan implement everything in the architecture artifacts?
263
+ - **Task granularity** -- is every task 2-5 minutes? Are any too large?
264
+ - **Code quality** -- is the code in examples correct? Does it follow conventions?
265
+ - **Dependencies** -- are all blocking relationships identified? Are parallel opportunities noted?
266
+ - **Testability** -- does every task include tests? Do tests run?
267
+ - **API contract alignment** -- do implementations match the contract exactly?
268
+
269
+ Reviewer feedback is advisory. If you disagree with feedback, explain your reasoning. But fix legitimate issues.
270
+
271
+ ### Step 9: User Reviews Plan
272
+
273
+ After the plan review loop passes:
274
+
275
+ > "Implementation plan written to `.forge/work/{type}/{name}/tasks.md`. Summary:
276
+ >
277
+ > - **{N} tasks** across **{N} phases**
278
+ > - **Critical path:** {tasks on longest chain}
279
+ > - **Parallelizable tasks:** {N} tasks can run concurrently
280
+ > - **Subagent coordination points:** {N}
281
+ >
282
+ > Please review the plan. Let me know if you want changes before we start implementation."
283
+
284
+ Wait for user approval. If changes are requested, make them and re-run the plan review loop.
285
+
286
+ ### Step 10: Update Feature Manifest
287
+
288
+ After approval, update `.forge/work/{type}/{name}/manifest.yaml`:
289
+
290
+ ```yaml
291
+ artifacts:
292
+ tasks:
293
+ path: tasks.md
294
+ status: approved
295
+ approved_at: YYYY-MM-DD
296
+ task_count: N
297
+ phase_count: N
298
+ review_iterations: N
299
+ critical_path_length: N
300
+ ```
301
+
302
+ ### Step 11: Execution Handoff
303
+
304
+ After saving and approving the plan, offer execution options:
305
+
306
+ > "Plan complete and approved. Two execution options:
307
+ >
308
+ > **1. Subagent-Driven (recommended for multi-task plans)** -- `build-tdd` dispatches a builder subagent per task, review between tasks, fast iteration. Best when tasks can run in parallel.
309
+ >
310
+ > **2. Inline Execution** -- `build-tdd` executes directly in this session. Best for small plans (< 5 tasks) or when you want close oversight.
311
+ >
312
+ > Which approach?"
313
+
314
+ **After the user chooses, persist the decision in the manifest immediately:**
315
+
316
+ ```yaml
317
+ execution:
318
+ mode: subagent # or: inline
319
+ decided_at: YYYY-MM-DD
320
+ ```
321
+
322
+ This field is read by `build-tdd` to determine execution mode. It persists across resume so the mode does not change mid-feature.
323
+
324
+ **Both modes follow the same skill flow:**
325
+ - For each task (respecting dependency order): invoke `build-tdd` skill, then `quality-code-review` skill.
326
+ - `build-tdd` reads `execution.mode` from the manifest and dispatches the builder subagent (subagent mode) or executes inline (inline mode).
327
+ - Review each task output before proceeding.
328
+ - Fix Critical/Important findings before the next task.
329
+
330
+ ---
331
+
332
+ ## Key Rules
333
+
334
+ 1. **2-5 minutes per task.** If a task takes longer, it is too big. Split it.
335
+ 2. **Exact file paths.** Every file mentioned has a complete, exact path.
336
+ 3. **Complete code examples.** Every step includes the actual code. No placeholders, no "implement here."
337
+ 4. **Exact commands with expected output.** "Run: `npm test` Expected: PASS" not "run the tests."
338
+ 5. **Reference API contracts.** When a task implements an endpoint, cite the contract section.
339
+ 6. **Map file structure first.** Before writing tasks, decide which files exist. This is where decomposition gets locked in.
340
+ 7. **Dependencies are explicit.** Every task states what it depends on and what depends on it.
341
+ 8. **Subagent coordination is flagged.** Tasks that share interfaces are marked with the shared contract.
342
+ 9. **Plan is self-contained.** A developer with zero project context can execute it.
343
+ 10. **DRY, YAGNI, TDD.** Do not duplicate logic, do not add features not in the architecture, and every task starts with a failing test.
344
+
345
+ ---
346
+
347
+ ## Anti-Patterns
348
+
349
+ | Anti-Pattern | Why It Is Wrong | What To Do Instead |
350
+ |---|---|---|
351
+ | **Tasks larger than 5 minutes** | Large tasks have hidden complexity and fail unpredictably | Split until each task is one clear action |
352
+ | **"Add validation" without code** | Implementor will guess wrong | Provide the exact validation code |
353
+ | **Missing test steps** | TDD requires test-first | Every task starts with a failing test |
354
+ | **No dependency mapping** | Tasks run out of order, imports break | Map every blocking relationship |
355
+ | **Skipping plan review** | Unreviewed plans have gaps and inconsistencies | Always dispatch spec-reviewer |
356
+ | **Monolithic "Phase 1" tasks** | "Set up the database layer" is not a task | Break into: create migration, create model, create types |
357
+ | **Copy-paste from architecture** | Architecture defines WHAT, tasks define HOW step by step | Translate contracts into implementation steps |
358
+ | **Forgetting commit steps** | Work is lost, history is unclear | Every task ends with a commit |
359
+ | **Ignoring parallel opportunities** | Sequential execution of independent tasks wastes time | Identify and document parallelizable tasks |
360
+
361
+ ---
362
+
363
+ ## Task Size Guidelines
364
+
365
+ | Too Small | Just Right | Too Large |
366
+ |---|---|---|
367
+ | "Add import statement" | "Write failing test for createPayment" | "Implement the payment service" |
368
+ | "Create empty file" | "Implement createPayment to pass test" | "Set up the entire API layer" |
369
+ | "Add comma to config" | "Add payment routes with error handling" | "Write all tests" |
370
+
371
+ A good task has:
372
+ - One clear objective
373
+ - One test (or a small group of related tests)
374
+ - One commit at the end
375
+ - A verifiable outcome (test passes, command succeeds)
376
+
377
+ ---
378
+
379
+ ## Handling Special Cases
380
+
381
+ ### Refactoring Tasks
382
+
383
+ When the plan includes refactoring (splitting a large file, renaming, restructuring):
384
+ 1. Refactoring tasks come BEFORE feature tasks
385
+ 2. Each refactoring task has tests proving behavior is preserved
386
+ 3. Commit refactoring separately from feature work
387
+
388
+ ### Database Migration Tasks
389
+
390
+ Migration tasks have a specific structure:
391
+ 1. Write migration file (forward)
392
+ 2. Write rollback migration
393
+ 3. Test: apply migration on clean DB
394
+ 4. Test: apply migration on seeded DB
395
+ 5. Test: rollback and re-apply
396
+ 6. Commit migration files
397
+
398
+ ### Third-Party Integration Tasks
399
+
400
+ When a task involves external APIs or services:
401
+ 1. Define the integration interface first (types, client shape)
402
+ 2. Write tests with the interface mocked
403
+ 3. Implement the real client
404
+ 4. Write integration tests that hit the real service (flagged as slow/external)
405
+
406
+ ---
407
+
408
+ ## Graphify Context (Static-only)
409
+
410
+ **Protocol:** `protocols/graphify.md` | **Mode:** Static-only — read `graphify-out/graph.json` if it exists, skip if absent. No guard, no build prompts, no CLI queries.
411
+
412
+ **How graph data maps to this skill:**
413
+ - **Tasks touching the same community** → likely share files or state, serialize them
414
+ - **Tasks in different communities** → likely independent, candidates for parallel phases
415
+ - **God nodes** → tasks modifying god nodes should be in early phases (downstream tasks depend on them)
416
+
417
+ ---
418
+
419
+ ## Codex Integration
420
+ **Modes:** Verify or Takeover | **Protocol:** `protocols/codex.md`
421
+
422
+ - **Verify:** Claude decomposes tasks, Codex reviews for gaps.
423
+ - **Takeover:** Codex decomposes tasks, Claude reviews dependencies and ordering.
424
+
425
+ **When:** After Claude has produced the task decomposition with phases, dependencies, and code examples.
426
+
427
+ **Context to pass:**
428
+ - Path to `.forge/work/{type}/{name}/tasks.md`
429
+ - Path to `.forge/work/{type}/{name}/architecture/` artifacts
430
+ - Path to `.forge/work/{type}/{name}/codebase-analysis.md` (if available)
431
+
432
+ **What Codex reviews:**
433
+ - Missing dependencies between tasks (task B needs task A's output but isn't blocked by it)
434
+ - Tasks that are too large (should be split further)
435
+ - Code examples that contradict the architecture artifacts
436
+ - Parallelization opportunities missed
437
+
438
+ **Prompt focus:** "Review this task decomposition for missing dependencies, oversized tasks, and parallelization opportunities. Check that code examples match the architecture artifacts."
439
+
440
+ **Presentation:** Merge Codex findings into the task plan. Fix dependency gaps before handoff to execution.
441
+
442
+ ---
443
+
444
+ ## Transition
445
+
446
+ The terminal state is execution handoff. After execution begins, the plan is consumed by `build-tdd` and `build-pr-workflow` skills. Updates flow back into the manifest as tasks are completed:
447
+
448
+ ```yaml
449
+ tasks:
450
+ completed: N
451
+ total: N
452
+ current_phase: N
453
+ blocked: []
454
+ ```