@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 forge contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,389 @@
1
+ # forge
2
+
3
+ **A production-grade `.claude` harness for prototype-driven AI development**
4
+
5
+ <!-- Badges -->
6
+ <!-- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) -->
7
+ <!-- [![Claude Code](https://img.shields.io/badge/Claude%20Code-compatible-blue.svg)](#) -->
8
+
9
+ ---
10
+
11
+ ## What is this?
12
+
13
+ forge is a complete `.claude` folder that turns Claude Code into a structured development workflow engine. It covers the path from idea to production via a **prototype-driven SDLC** (concept slides → wireframe → working prototype → codify → production build → deliver), with quality gates that apply where they actually catch bugs — at the prototype-to-production transition. Drop it into any project and have an opinionated, battle-tested development process from day one.
14
+
15
+ Release history: see `CHANGELOG.md`.
16
+
17
+ ## What's new in v6
18
+
19
+ v6 is a substantial redesign driven by dogfood evidence. Two named pillars:
20
+
21
+ 1. **Prototype-driven SDLC** — replaces v4/v5's plan-driven pipeline. The artifact escalation (slides → wireframe → prototype → codify → production) puts iteration before code-perfection. Most phases are *softened*: trivial work skips them; the work manifest's `phase_plan` tracks deviations explicitly.
22
+ 2. **`aiwiki/` knowledge layer** — typed pages (decisions / gotchas / conventions / architecture / sessions) with real-time LINT on every write and async `dream` consolidation at phase-close. Dream proposals land in `aiwiki/proposed/` for user review (atomic swap on accept, discard on reject).
23
+
24
+ The v6 schema (`templates/manifests/v6/SCHEMA.md`) adds `phase_plan:` at the top of every work manifest — six plan-status values (`active`, `active-light`, `active-commit-only`, `skipped`, `as-discovered`, `complete-inline`) cover the patterns dogfood surfaced.
25
+
26
+ ## Key Features
27
+
28
+ - **30 skills** spanning the prototype-driven pipeline plus production-grade quality gates
29
+ - **13 commands** for discovery, setup, workflows, evolution, and validation
30
+ - **17 specialized agents** with explicit phase-context (prototype-builder for Phase 4, builder for Phase 6, plus architects, reviewers, hunters, dreamers)
31
+ - **8 common rules** tiered by phase (always-on safety floor + phase-conditional from codify onward) + **7 common references** for skill authoring, agent coordination, and workflow protocol
32
+ - **Work manifests** with `phase_plan` (preflight intent), `phases` (gate state), `slice_graph` (build decomposition), and `artifacts` (phase outputs + lock signals)
33
+ - **`aiwiki/` typed pages** with LINT on every write + async dream consolidation
34
+ - **Quality gates** at the prototype-to-production transition where they catch real bugs, not premature plan-phase gates
35
+ - **Self-learning** via the gotcha system that captures lessons and promotes them to rules when patterns repeat
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ npx @jamie-tam/forge init
43
+ ```
44
+
45
+ This installs everything into your project's `.claude/` directory:
46
+ - **Rules** — phase-tiered (always-on safety floor + phase-conditional standards from codify onward)
47
+ - **Skills** — 30 atomic skills covering the prototype-driven pipeline + production gates
48
+ - **Commands** — 8 slash commands for setup, workflows, evolution, and validation
49
+ - **Agents** — 17 specialized subagents with MCP server access (context7, playwright)
50
+ - **Hooks** — gate-enforcer, wiki-lint, telemetry, state preservation, session checkpoints
51
+ - **CLAUDE.md** — project configuration template
52
+ - **`aiwiki/` scaffold** — typed-page schemas, LINT config, usage rules (populated on first work item)
53
+
54
+ ### Update
55
+
56
+ ```bash
57
+ npx @jamie-tam/forge update # sync to latest version
58
+ npx @jamie-tam/forge update --dry-run # preview what would change
59
+ ```
60
+
61
+ Syncs forge assets to the latest version. Detects user-modified files and warns before overwriting. Cleans stale files from previous versions. CLAUDE.md is always preserved.
62
+
63
+ ### Uninstall
64
+
65
+ ```bash
66
+ npx @jamie-tam/forge uninstall # remove forge, keep user files + state
67
+ npx @jamie-tam/forge uninstall --force # also remove CLAUDE.md and AGENTS.md
68
+ npx @jamie-tam/forge uninstall --purge # also remove .forge/ state directory
69
+ npx @jamie-tam/forge uninstall --dry-run # preview what would be removed
70
+ ```
71
+
72
+ Only removes forge-managed files — your custom skills, agents, and rules are preserved. Uses the installed file manifest for precise removal.
73
+
74
+ ### After Installation
75
+
76
+ ```bash
77
+ # In Claude Code, run /setup to detect your stack and fill .claude/CLAUDE.md
78
+ /setup
79
+
80
+ # Then start building
81
+ /feature "add user authentication"
82
+ ```
83
+
84
+ ---
85
+
86
+ ## For AI Agents
87
+
88
+ If you are an LLM agent (Claude Code, Cursor, Windsurf, etc.) helping a user set up, update, or remove forge, follow these instructions.
89
+
90
+ ### Install
91
+
92
+ ```bash
93
+ npx @jamie-tam/forge init
94
+ ```
95
+
96
+ - Run from the root of the user's project directory.
97
+ - Requires Node.js 18+. Verify with `node --version` before running.
98
+ - After install, verify `.claude/` directory exists and contains `rules/`, `skills/`, `commands/`, `agents/`.
99
+ - Then run the `/setup` slash command to detect the project stack and fill `.claude/CLAUDE.md`.
100
+
101
+ ### Update
102
+
103
+ ```bash
104
+ npx @jamie-tam/forge update --dry-run # preview first
105
+ npx @jamie-tam/forge update # apply
106
+ ```
107
+
108
+ - Always run `--dry-run` first and show the user what will change.
109
+ - User-modified files are preserved automatically. If `--force` is passed, all files are overwritten.
110
+ - CLAUDE.md is never overwritten.
111
+
112
+ ### Uninstall
113
+
114
+ ```bash
115
+ npx @jamie-tam/forge uninstall --dry-run # preview first
116
+ npx @jamie-tam/forge uninstall # apply
117
+ ```
118
+
119
+ - Always run `--dry-run` first and confirm with the user before removing.
120
+ - Default uninstall only removes forge-managed files. User-created skills, agents, and rules are preserved.
121
+ - `--force` also removes CLAUDE.md and AGENTS.md. `--purge` also removes `.forge/` state. Only use these if the user explicitly asks.
122
+
123
+ ---
124
+
125
+ ## Prerequisites
126
+
127
+ - **Claude Code** — Required. [Get started](https://claude.ai/claude-code)
128
+ - **Node.js 18+** — Required for `npx @jamie-tam/forge init`
129
+
130
+ ## Recommended Tools (Optional)
131
+
132
+ Forge detects these tools automatically and offers integration when available. Without them, forge works exactly the same — they add capabilities, not requirements.
133
+
134
+ | Tool | What It Adds | Install |
135
+ |------|-------------|---------|
136
+ | **OpenAI Codex** | Second-opinion reviews across 10 skills (code review, security audit, architecture verification), alternative TDD builder | [Codex plugin for Claude Code](https://github.com/openai/codex-plugin-cc) |
137
+ | **Graphify** | Knowledge graph for codebase navigation across 5 skills, up to 283x token reduction on large repos, feeds into Codex for maximum gap detection | `pip install graphifyy` (open source) |
138
+
139
+ > **Codex:** When detected, forge offers a second opinion at quality gates and planning reviews. You choose per-feature whether to use it (`always`, `ask each time`, or `never`). Codex excels at gap detection — finding unused code, mismatched limits, and authorization inconsistencies. See `protocols/codex.md`.
140
+
141
+ > **Graphify:** When `graphify-out/graph.json` exists in your project, forge automatically enriches codebase analysis with community structure, god nodes, and dependency edges. If the graphify CLI is also installed, skills use targeted graph queries during security audits, code reviews, and debugging. Graph context feeds into Codex for the highest-impact combination. See `protocols/graphify.md`.
142
+
143
+ ---
144
+
145
+ ## Architecture
146
+
147
+ ```
148
+ Commands (workflows) Skills (prefix-grouped) Rules (phase-tiered)
149
+ --------------------- ----------------------- --------------------
150
+ /forge (discovery) concept-slides [Phase 1] Always-on (safety floor):
151
+ /setup build-wireframe [Phase 2] common/security
152
+ /feature build-prototype [Phase 3] common/guardrails
153
+ /greenfield iterate-prototype [Phase 4] common/verification
154
+ /bugfix harden [Phase 5] common/skill-selection
155
+ /refactor build-scaffold Phase-conditional (from codify):
156
+ /hotfix build-tdd [Phase 6] common/testing
157
+ /evolve build-pr-workflow common/quality-gates
158
+ /validate quality-code-review common/git-workflow
159
+ quality-test-plan
160
+ Work Manifests (v6) quality-test-execution References (load on demand)
161
+ ------------------- quality-security-audit ----------------------------
162
+ .forge/work/ quality-uiux common/
163
+ {type}/ deliver-deploy [Phase 7] agent-coordination
164
+ {name}/ deliver-db-migration io-protocol
165
+ manifest.yaml deliver-onboarding skill-authoring
166
+ schema_version: "6" discover-requirements skill-compliance
167
+ phase_plan: {…} discover-codebase-analysis phases (canonical vocab)
168
+ phases: {…} plan-brainstorm coding-standards
169
+ slice_graph: {…} plan-architecture typescript/ python/ react/
170
+ artifacts: {…} plan-design-system [extensible]
171
+ plan-task-decompose
172
+ aiwiki/ (knowledge layer) support-system-guide Protocols (read on demand)
173
+ ------------------------- support-debug --------------------------
174
+ decisions/ support-gotcha protocols/codex.md
175
+ gotchas/ support-wiki-lint protocols/graphify.md
176
+ conventions/ support-runtime-reachability
177
+ architecture/ support-dream Hooks
178
+ sessions/ support-skill-validator ------
179
+ raw/ gate-enforcer
180
+ proposed/ (dream queue) wiki-lint
181
+ schemas/ session-start / pre-compact
182
+ CLAUDE.md (usage rules) telemetry
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Commands Overview
188
+
189
+ | Command | Description | When to Use |
190
+ |---------|-------------|-------------|
191
+ | `/forge` | One-screen orientation -- installed capabilities, active work, suggested next | Run this first if you're new, or any time you want an overview |
192
+ | `/setup` | Detect project stack, install matching language rules, and fill the project profile | Right after `npx @jamie-tam/forge init` |
193
+ | `/feature` | Full feature workflow with quality gates at every transition | Adding a feature to an existing codebase |
194
+ | `/greenfield` | New project from zero -- includes scaffolding and onboarding docs | Starting a brand-new project |
195
+ | `/bugfix` | Systematic debug, TDD fix, code review, and PR | Something is broken and needs fixing |
196
+ | `/refactor` | Analyze, plan approach, restructure with tests, PR | Code needs cleanup without new functionality |
197
+ | `/hotfix` | Emergency compressed flow -- debug, minimal test, deploy | Production is down, need a fix now |
198
+ | `/evolve` | Review gotchas, improve skills, validate changes | Improving the system itself after a project cycle |
199
+ | `/validate` | Run 5 consistency checks across all skills, rules, and commands | After customizing skills or running `/evolve` |
200
+
201
+ ---
202
+
203
+ ## Skills Overview
204
+
205
+ ### Prototype-driven SDLC (Phases 1-5) — v6 new
206
+
207
+ | Skill | Phase | Description |
208
+ |-------|-------|-------------|
209
+ | `concept-slides` | 1 | Low-fidelity marp slide deck capturing the product idea (hook, sub-concepts, journey, deferrals) |
210
+ | `build-wireframe` | 2 | Single-HTML annotated wireframe with click-through demo and callouts; backend-heavy products get a verification-UI sketch |
211
+ | `build-prototype` | 3 | Vite + React + TS + Tailwind v4 + Zustand v5 scaffold with parallel partition builders |
212
+ | `iterate-prototype` | 4 | Polish loop with feedback file + 5-cycle drift checks; captures gotchas + conventions as side effects |
213
+ | `harden` | 5 | Codifies the locked prototype into architecture files + ADRs (with `/second-opinion` review) + slice graph + tasks |
214
+
215
+ ### Discover & Plan (fallback for non-prototype work)
216
+
217
+ | Skill | Description |
218
+ |-------|-------------|
219
+ | `discover-requirements` | Transform raw input (meetings, emails, screenshots) into structured requirements |
220
+ | `discover-codebase-analysis` | Map existing code patterns, dependencies, and conventions before making changes |
221
+ | `plan-brainstorm` | Explore 2-3 approaches with tradeoffs, reach user-approved decision (non-prototype fallback) |
222
+ | `plan-architecture` | Generate API contracts, DB schemas, system diagrams (non-prototype fallback) |
223
+ | `plan-task-decompose` | Break work into 2-5 minute implementable tasks with dependency mapping |
224
+ | `plan-design-system` | Establish visual direction (theme, colors, spacing, typography, component specs) — independent of prototype path |
225
+
226
+ ### Build (Phase 6 — production)
227
+
228
+ | Skill | Description |
229
+ |-------|-------------|
230
+ | `build-scaffold` | Set up new project structure, tooling, Docker, and initial tests |
231
+ | `build-tdd` | Strict RED-GREEN-REFACTOR cycle — no production code without a failing test. Dispatches `builder` agent or runs inline |
232
+ | `build-pr-workflow` | Git worktree management, atomic PR-per-function, manifest linking |
233
+
234
+ ### Quality (gates at the prototype-to-production transition)
235
+
236
+ | Skill | Description |
237
+ |-------|-------------|
238
+ | `quality-code-review` | Multi-stage review chain: safety → craft → runtime reachability → gotcha-hunter (→ optional Codex adversarial) |
239
+ | `quality-test-plan` | Generate comprehensive test strategy: unit, integration, E2E, smoke, load, contract |
240
+ | `quality-test-execution` | Execute ALL tests from the plan — no skipping any type or scenario |
241
+ | `quality-security-audit` | OWASP Top 10, secrets scanning, dependency vulnerabilities, Codex + graphify integration |
242
+ | `quality-uiux` | Accessibility, responsive design, component reuse, library recommendations |
243
+
244
+ ### Deliver (Phase 7)
245
+
246
+ | Skill | Description |
247
+ |-------|-------------|
248
+ | `deliver-deploy` | Pre-deploy verification, staging smoke tests, deploy, post-deploy verification |
249
+ | `deliver-db-migration` | Safe migration with rollback scripts and forward+rollback+forward testing |
250
+ | `deliver-onboarding` | Generate getting-started guide, architecture overview, testing guide, common tasks |
251
+
252
+ ### Support (cross-cutting)
253
+
254
+ | Skill | Description |
255
+ |-------|-------------|
256
+ | `support-system-guide` | Meta-skill: guides which command/skill to use, manages `.forge/` + `aiwiki/` directories |
257
+ | `support-debug` | Systematic 4-phase debugging with 3-fix threshold and fact-checking |
258
+ | `support-gotcha` | Self-learning from mistakes — captures lessons to `aiwiki/gotchas/`, auto-promotes after N=3 occurrences |
259
+ | `support-wiki-lint` | Validates `aiwiki/` page schemas + citations on every write (hook-driven); backfills `@<sha7>` citation hashes |
260
+ | `support-dream` | Async wiki consolidation (merge/promote/prune) at phase-close / pre-compact / manual. Writes to `aiwiki/proposed/` for user review |
261
+ | `support-runtime-reachability` | Detects orphaned exports (code with no production caller) — the gate that catches "tests pass but feature isn't wired up" |
262
+ | `support-skill-validator` | Validate skill consistency: conflicts, I/O gaps, overlaps, gate coverage, drift |
263
+
264
+ ---
265
+
266
+ ## How It Works
267
+
268
+ A standard-size `/feature "add auth"` on an existing prototype-driven codebase flows like this (preflight collapses phases based on scope):
269
+
270
+ ```
271
+ User: /feature "add auth"
272
+ |
273
+ +-- Step 0: Repo-state detection
274
+ | Prototype mode? → offer redirect to iterate-prototype
275
+ | Production mode? → proceed
276
+ +-- Step 0a: Preflight checks (git clean, tests pass)
277
+ +-- Step 0b: aiwiki/ scaffold if missing
278
+ +-- Step 1: phase_plan — preflight planner proposes per-phase
279
+ | active / active-light / skipped status; user confirms
280
+ +-- Create/resume manifest (.forge/work/feature/add-auth/manifest.yaml)
281
+ |
282
+ +-- Phase 2: [concept-slides] (if active)
283
+ | Low-fidelity deck — what is this feature, where it sits
284
+ | === GATE: concept locked → artifacts.concept.locked_at ===
285
+ |
286
+ +-- Phase 3: [build-wireframe] (if active)
287
+ | Single-HTML mini-wireframe for the feature's screens
288
+ | === GATE: wireframe locked → artifacts.wireframe.locked_at ===
289
+ |
290
+ +-- Phase 4: [build-prototype] + [iterate-prototype] (if active)
291
+ | Working prototype skin into existing app; iterate to satisfaction
292
+ | Side effects: capture gotchas + conventions to aiwiki/
293
+ | === GATE: prototype locked → artifacts.prototype.locked_at ===
294
+ |
295
+ +-- Phase 5: [harden] (if active)
296
+ | Codify prototype → aiwiki/architecture/, ADRs (with /second-opinion),
297
+ | slice graph in manifest. Dream consolidates phase 4 captures.
298
+ | === GATE: codify locked + user approves dream proposal ===
299
+ |
300
+ +-- Phase 6: [build-pr-workflow] worktree → per-slice:
301
+ | [build-tdd] strict RED-GREEN-REFACTOR
302
+ | [quality-code-review] safety → craft → runtime-reach → gotcha-hunter
303
+ | (→ optional Codex adversarial cross-check)
304
+ | [support-runtime-reachability] orphan-export gate (catches wiring gaps)
305
+ | Per-slice dream consolidates slice-scoped wiki updates
306
+ | === GATE: all slices terminal + code-review-final passes ===
307
+ |
308
+ +-- [quality-test-plan] + [quality-test-execution]
309
+ +-- [quality-uiux] (if frontend)
310
+ +-- [quality-code-review] final pass across full diff
311
+ | === GATE: zero failures, full traceability ===
312
+ |
313
+ +-- Phase 7: [build-pr-workflow] create PR(s)
314
+ +-- [deliver-deploy] (optional)
315
+ +-- [deliver-onboarding] (for major features)
316
+ +-- [support-gotcha] retrospective; final dream consolidates
317
+ ```
318
+
319
+ The manifest tracks plan, gate state, slice graph, and phase artifacts (with `locked_at` timestamps acting as lock signals). Wiki-lint fires on every `aiwiki/` write. Dream runs async at phase-close and pre-compact, writing proposals to `aiwiki/proposed/` for user review. If a session ends mid-feature, running `/feature "add auth"` again resumes from exactly where you left off — phases with `artifacts.{phase}.locked_at` set are skipped on resume.
320
+
321
+ **Trivial features collapse phases.** A small UI tweak might run only Phase 6 + deliver, with concept/wireframe/prototype/codify marked `skipped` in `phase_plan`. The preflight step decides per-feature.
322
+
323
+ ---
324
+
325
+ ## Comparison to Alternatives
326
+
327
+ forge synthesizes the best patterns from four leading Claude Code configuration repos. For a detailed feature-by-feature comparison, see **[docs/COMPARISON.md](docs/COMPARISON.md)**.
328
+
329
+ ---
330
+
331
+ ## Provenance
332
+
333
+ Every skill in forge has a documented origin -- what it was inspired by, what was adapted, and what is entirely new. See **[docs/PROVENANCE.md](docs/PROVENANCE.md)** for the full provenance table.
334
+
335
+ ---
336
+
337
+ ## Philosophy
338
+
339
+ **Process over tools.** Skills enforce workflows, not just provide advice. Every skill has a defined process with concrete steps, not vague guidance.
340
+
341
+ **Test-first discipline.** No production code without a failing test. RED-GREEN-REFACTOR is non-negotiable. Tests prove behavior, not just coverage numbers.
342
+
343
+ **Self-improving.** The gotcha system captures lessons from every feature, every bug, every debugging session. When patterns repeat three times, they promote to rules. The system gets better the more you use it.
344
+
345
+ **Quality over speed.** Quality gates enforce real criteria at every phase transition. You cannot skip from brainstorm to code without approved architecture. You cannot deploy with failing tests. The gates exist because cutting corners costs more time in the long run.
346
+
347
+ **Adaptive to project.** The project profile in CLAUDE.md controls how skills behave. A startup prototype gets lighter reviews and skips load testing. A mission-critical system gets full security audits and multi-pass reviews. One system, tuned to your context.
348
+
349
+ ---
350
+
351
+ ## Quick Reference
352
+
353
+ For a compact cheat sheet covering all commands, workflows, and skills, see **[docs/CHEATSHEET.md](docs/CHEATSHEET.md)**.
354
+
355
+ ---
356
+
357
+ ## Contributing
358
+
359
+ Contributions are welcome. To contribute:
360
+
361
+ 1. Fork the repository
362
+ 2. Create a feature branch (`feat/your-improvement`)
363
+ 3. Make your changes
364
+ 4. Run `/validate` to ensure skill consistency
365
+ 5. Submit a pull request with a clear description of what changed and why
366
+
367
+ If you are adding a new skill, follow the I/O protocol (skills with artifact handoffs should declare Requires and Produces; pure methodology skills may omit the I/O Contract) and ensure your skill does not conflict with existing ones.
368
+
369
+ ---
370
+
371
+ ## License
372
+
373
+ [MIT](LICENSE)
374
+
375
+ ---
376
+
377
+ ## Credits
378
+
379
+ forge stands on the shoulders of four excellent Claude Code configuration repositories:
380
+
381
+ - **[gstack](https://github.com/garrytan/gstack)** by Garry Tan -- The "Boil the Lake" philosophy. Role-based virtual team, security auditing (`/cso`), deployment pipeline (`/ship`), and the idea that completeness is cheap with AI. Inspired our guardrails, security audit, and deploy skills.
382
+
383
+ - **[superpowers](https://github.com/obra/superpowers)** by Jesse Vincent (obra) -- Test-first discipline and systematic process skills. The most rigorous TDD and debugging methodology available. Directly influenced our `build-tdd`, `support-debug`, `plan-brainstorm`, and code review approach.
384
+
385
+ - **[everything-claude-code](https://github.com/AffaanMustafa/everything-claude-code)** (ECC) by Affaan Mustafa -- Battle-tested over 10+ months with 125+ skills and 28 agents. Layered rules, continuous learning via instincts, and enterprise-grade coverage. Inspired our gotcha system, onboarding skill, and layered rule architecture.
386
+
387
+ - **[oh-my-claude-code](https://github.com/jcosta33/oh-my-claude-code)** by jcosta33 -- Slash command ergonomics and composable prompt engineering. Influenced our command routing, skill invocation patterns, and the overall developer experience of the slash command system.
388
+
389
+ forge combines superpowers' process discipline, gstack's safety guardrails, ECC's layered rules, and oh-my-claude-code's slash command ergonomics -- then adds feature manifests, quality gates, I/O protocol, self-learning, and skill validation to create a reusable foundation for all projects.
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: architect
3
+ color: blue
4
+ description: "Designs and evaluates system architecture — API contracts, DB schemas, component design, and trade-off analysis. Use for complex designs touching 3+ components or introducing new patterns."
5
+ tools: [Read, Glob, Grep, WebSearch, WebFetch]
6
+ mcpServers: [plugin:context7:context7]
7
+ model: opus
8
+ effort: max
9
+ ---
10
+
11
+ # Architect Agent
12
+
13
+ You are a senior software architect evaluating system design decisions. You think in terms of trade-offs, not absolutes. Every architecture decision has costs and benefits — your job is to make those trade-offs explicit.
14
+
15
+ ## Evaluation Areas
16
+
17
+ ### 1. System Design
18
+ - Is the component decomposition appropriate? (not too monolithic, not too fragmented)
19
+ - Are component boundaries well-defined? (clear responsibilities, minimal overlap)
20
+ - Is the communication pattern between components appropriate? (sync vs async, direct vs message bus)
21
+ - Are there single points of failure?
22
+ - Is the design testable? (can components be tested in isolation?)
23
+
24
+ ### 2. API Design
25
+ - Are endpoints RESTful and consistent? (naming, HTTP methods, status codes)
26
+ - Are request/response shapes well-typed and validated?
27
+ - Is versioning considered?
28
+ - Are error responses structured and informative?
29
+ - Is pagination, filtering, and sorting handled for list endpoints?
30
+ - Are rate limiting and authentication considered?
31
+
32
+ ### 3. Data Modeling
33
+ - Is the schema normalized appropriately? (not over-normalized, not under-normalized)
34
+ - Are indexes defined for common query patterns?
35
+ - Are foreign key relationships correct?
36
+ - Is data integrity enforced at the database level? (constraints, not just application logic)
37
+ - Are there migration concerns? (data migration, not just schema migration)
38
+
39
+ ### 4. Scalability
40
+ - Will this design handle 10x the current load?
41
+ - Are there bottlenecks? (database, network, computation)
42
+ - Can components scale independently?
43
+ - Is caching appropriate? (what, where, invalidation strategy)
44
+ - Are there stateful components that would complicate horizontal scaling?
45
+
46
+ ### 5. Maintainability
47
+ - Is the design documented somewhere a new developer can find it (architecture file, ADR, or README)?
48
+ - Are there implicit contracts that should be explicit?
49
+ - Is the design consistent with the existing codebase patterns?
50
+ - Will this design be easy to modify when requirements change?
51
+
52
+ ### 6. Security Architecture
53
+ - Are trust boundaries clearly defined?
54
+ - Is data encrypted at rest and in transit where needed?
55
+ - Are authentication and authorization patterns consistent?
56
+ - Are there data exposure risks in the API design?
57
+
58
+ ## Process
59
+
60
+ 1. **Read** all architecture artifacts and relevant code
61
+ 2. **Research** when uncertain — use WebSearch and WebFetch to verify architectural patterns, library choices, and best practices
62
+ 3. **Analyze** each area above
63
+ 4. **Present** findings with trade-off analysis, not just recommendations
64
+
65
+ ## Output Format
66
+
67
+ For each finding:
68
+ ```
69
+ AREA: {System Design / API Design / Data Modeling / Scalability / Maintainability / Security}
70
+ SEVERITY: {Critical / Important / Consideration}
71
+ FINDING: {What was observed}
72
+ TRADE-OFF: {What are the options and their costs/benefits}
73
+ RECOMMENDATION: {What I suggest and why}
74
+ ```
75
+
76
+ End with:
77
+ ```
78
+ ARCHITECTURE ASSESSMENT
79
+ =======================
80
+ Overall: SOUND / NEEDS REVISION / FUNDAMENTAL CONCERNS
81
+ Key strengths: {what is done well}
82
+ Key risks: {what needs attention}
83
+ Recommended changes: {prioritized list}
84
+ ```
85
+
86
+ ## Rules
87
+
88
+ - Think in trade-offs, not absolutes. "It depends" is a valid answer if you explain what it depends on.
89
+ - When recommending a pattern or library, verify it is current and well-maintained (use WebSearch).
90
+ - Reference existing codebase patterns. Do not recommend patterns that contradict the established architecture without strong justification.
91
+ - Every Critical finding must include a concrete alternative design.
92
+ - Do not over-engineer. A simple design that works is better than a complex design that might scale.
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: builder
3
+ color: green
4
+ description: "Implements features, fixes, and refactors using strict TDD. Use when a task needs production code + tests written."
5
+ tools: [Read, Edit, Write, Glob, Grep, Bash]
6
+ mcpServers: [plugin:context7:context7]
7
+ model: opus
8
+ effort: xhigh
9
+ ---
10
+
11
+ # Builder Agent
12
+
13
+ You are an implementation-focused developer. You receive a task with exact file paths, code examples, and expected outcomes. You execute using strict Test-Driven Development. The dispatch prompt carries task scope and artifacts only; the TDD methodology lives here.
14
+
15
+ Start immediately. No acknowledgments. Dense output over verbose.
16
+
17
+ ## Phase Context
18
+
19
+ This agent runs at **Phase 6 (production-build)** — after `harden` has codified the architecture and slice graph. The Iron Law below (no production code without a failing test) is unconditional within this phase.
20
+
21
+ **Phase 4 (prototype) is the exception** — `prototype-builder` is the prototype-phase implementation agent and intentionally does NOT enforce TDD. Prototype iteration uses manual click-through verification, not test coverage. If you find yourself dispatched against a prototype-phase task (`phase_plan.production-build: skipped` or work path under `pocs/`), surface the mismatch and stop — the caller should be invoking `prototype-builder`, not `builder`.
22
+
23
+ ## What You Receive
24
+
25
+ Each task includes:
26
+ - **Task description** with exact file paths and code
27
+ - **Architecture artifacts** (API contracts, DB schema) — provided inline in your prompt since `.forge/` is not in version control
28
+ - **Codebase conventions** from the codebase analysis
29
+ - **Dependencies** — which tasks must complete before yours
30
+ - **Test oracles** — assertions the slice must satisfy (file paths, error codes, state transitions), produced by `harden` Step 2.5 and stored at `aiwiki/oracles/{slug}.md` for the slice you are building
31
+
32
+ ## Oracles Are Load-Bearing
33
+
34
+ Before writing a RED test, load `aiwiki/oracles/{slug}.md` for the slice being built. Production code must satisfy every oracle assertion listed there. If oracles are missing for a slice that crosses a wiring boundary (CLI ↔ filesystem, process exec, manifest I/O, external services), halt and surface to the user — do not invent oracles or proceed against an empty oracle file. The harden phase owes you that artifact; missing oracles means harden has not closed, and silently filling the gap re-creates the wiring-blindness that mock-heavy TDD has historically caused.
35
+
36
+ ## Investigation (before coding)
37
+
38
+ Classify: **Trivial** (single file) | **Scoped** (2-5 files) | **Complex** (multi-system).
39
+
40
+ For non-trivial tasks, investigate first:
41
+ 1. Glob to map relevant files, Grep to find existing patterns, Read to understand context
42
+ 2. Answer: What patterns does this codebase use? What tests exist? What could break?
43
+
44
+ Skip investigation for trivial single-file tasks.
45
+
46
+ ## TDD Guardrails
47
+
48
+ The Iron Law:
49
+
50
+ ```
51
+ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
52
+ ```
53
+
54
+ If code for this behavior exists before RED, delete it and re-implement from the test.
55
+ Do not keep it as reference.
56
+ Do not adapt it incrementally while writing the test.
57
+
58
+ Verify RED before GREEN:
59
+ - The target test fails.
60
+ - It fails because the feature or fix is missing.
61
+ - It does not fail because of syntax errors, import errors, or broken test setup.
62
+ - If it fails for the wrong reason, fix the test/setup first and rerun RED.
63
+
64
+ Use architecture artifacts as constraints:
65
+ - API contracts define the shapes, status codes, and errors your unit tests should assert.
66
+ - DB schema artifacts define constraints and invariants your tests must respect.
67
+ - Integration tests are required at every module boundary where the slice crosses CLI, filesystem, process execution, manifest I/O, or external services. Mocks are permitted ONLY for nondeterministic, slow, paid, or unavailable dependencies; every mocked boundary requires at least one contract or integration test elsewhere that exercises real wiring.
68
+
69
+ ## Execution Protocol
70
+
71
+ For each task:
72
+
73
+ 1. **Read** the task and referenced files to understand context
74
+ 2. **Verify libraries** via context7 (MCP) before writing tests — never assume API signatures
75
+ 3. **RED** — write the failing test exactly as specified in the task
76
+ 4. **Verify RED** — run the test, confirm it fails because the behavior is missing, not because of syntax/import/setup errors
77
+ 5. **GREEN** — write minimal code to pass
78
+ 6. **Verify GREEN** — run the test, confirm all tests pass
79
+ 7. **REFACTOR** — clean up if needed, keep tests green
80
+ 8. **Commit** — one conventional commit per TDD cycle
81
+
82
+ ## Commit Discipline
83
+
84
+ One commit per completed TDD cycle. Format: `type(scope): description`
85
+
86
+ ```bash
87
+ # Stage specific files, never git add .
88
+ git add src/services/payment.ts tests/services/payment.test.ts
89
+ git commit -m "feat(payments): add createPayment with validation"
90
+ ```
91
+
92
+ The commit message describes the **behavior added**, not the test written.
93
+
94
+ ## Rules
95
+
96
+ - Follow the TDD protocol in this file exactly
97
+ - Do NOT write production code before a failing test
98
+ - Do NOT add features beyond what the task specifies
99
+ - Do NOT modify files outside the task's scope
100
+ - Do NOT skip test verification steps (RED and GREEN must both be confirmed by running tests)
101
+ - When uncertain about a library API, verify via context7 — never guess
102
+ - If the task references an architecture contract, use it to set unit-test expectations and validate your implementation matches it exactly
103
+ - If you encounter a blocker (missing dependency, unclear requirement), stop and report — do not guess
104
+ - Write minimal code to pass each test — no abstractions, helpers, or configurability beyond what the test requires
105
+ - Match the codebase's existing patterns (naming, error handling, import style) — discover them during investigation
106
+
107
+ ## Failure Modes to Avoid
108
+
109
+ - **Premature completion** — saying "done" before running verification
110
+ - **Test hacks** — modifying tests to pass instead of fixing production code
111
+ - **Scope creep** — fixing "while I'm here" issues in adjacent code
112
+ - **Silent failure** — looping on the same broken approach without progress
113
+
114
+ After 3 failed attempts on the same issue, stop and report with full context — do not keep guessing.
115
+
116
+ ## Output
117
+
118
+ When complete, report:
119
+ - Files created/modified
120
+ - Tests written and their status
121
+ - Commits made (hashes and messages)
122
+ - Any issues encountered