@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,264 @@
1
+ ---
2
+ name: build-prototype
3
+ description: "Use to scaffold a working POC from a locked wireframe. Produces a runnable Vite + React + TS app at pocs/{name}-prototype/ with seed data, in-memory state, and screens that mirror the wireframe states. The prototype is the verification surface for concept + UX before any production code is written."
4
+ ---
5
+
6
+ # Build Prototype
7
+
8
+ ## Overview
9
+
10
+ Once a wireframe is locked, the prototype turns it into something the user can run. Real React components, real state transitions, real seed data — but in-memory storage, mocked external calls, no auth, no production hardening. The prototype answers "does this actually work as an interaction model?" and surfaces gotchas that the wireframe couldn't.
11
+
12
+ **Core principle:** the prototype is the spec. Mocks and in-memory state are tolerated here and ONLY here. The shape this skill produces becomes the shape the production build (Phase 6) inherits.
13
+
14
+ **Announce at start:** "I'm using the build-prototype skill to scaffold a working POC from the locked wireframe."
15
+
16
+ ## When to Use
17
+
18
+ - Phase 4 of a prototype-driven flow (after wireframe is locked, before Phase 5 codification)
19
+ - For `/feature` on existing apps: scaffold a `pocs/{feature-name}-prototype/` mini-prototype branch of the existing app's tech stack — same skill, smaller scope
20
+ - Ad-hoc when a wireframe is mature enough to validate via running code
21
+
22
+ **Do NOT skip when:**
23
+ - The wireframe "looks complete" — wireframe completeness is necessary but not sufficient; running code surfaces interaction-model issues the wireframe can't
24
+ - The team is in a hurry to ship — skipping prototype is what produces "implementation exists but is not wired" in production
25
+
26
+ ## Stack (single, opinionated)
27
+
28
+ The prototype stack is fixed. No variants.
29
+
30
+ | Layer | Tool |
31
+ |---|---|
32
+ | Build / dev server | Vite (latest stable) |
33
+ | UI framework | React 18 |
34
+ | Type system | TypeScript strict |
35
+ | Styling | Tailwind v4 |
36
+ | State | Zustand v5 |
37
+ | Icons | lucide-react |
38
+ | Lint + format | Biome |
39
+ | E2E (later) | Playwright |
40
+
41
+ Backend-heavy products that don't ship a frontend in production STILL get a Vite + React prototype here — the frontend is the verification surface during development (admin panel, request inspector, fixture browser, integration playground). For pure backend products, the prototype's frontend is the dev tooling.
42
+
43
+ ## Inputs
44
+
45
+ | Source | Required | Purpose |
46
+ |---|---|---|
47
+ | Locked wireframe HTML | yes | Visual + interaction-model spec |
48
+ | Wireframe README | yes | View list, hash routes, design intent |
49
+ | Concept slides | yes | High-level intent + out-of-scope context |
50
+ | Existing prototype (if extending) | optional | Codebase to extend |
51
+ | Manifest at `.forge/work/{type}/{name}/manifest.yaml` | yes | Phase state target |
52
+
53
+ ## Outputs
54
+
55
+ A working Vite + React app at `pocs/{name}-prototype/`:
56
+
57
+ ```
58
+ pocs/{name}-prototype/
59
+ ├── package.json
60
+ ├── vite.config.ts
61
+ ├── tsconfig.json
62
+ ├── tailwind.config.ts
63
+ ├── biome.json
64
+ ├── index.html
65
+ ├── src/
66
+ │ ├── main.tsx # entry
67
+ │ ├── App.tsx # router shell
68
+ │ ├── routes/ # one file per top-level route
69
+ │ ├── components/ # reusable UI primitives
70
+ │ ├── features/ # feature-area folders, each owning its screens
71
+ │ ├── store/ # Zustand stores
72
+ │ ├── data/ # seed data (TS const arrays, NOT db)
73
+ │ ├── types/ # shared TS types
74
+ │ └── styles/
75
+ │ └── tokens.css # design tokens extracted from wireframe
76
+ ├── README.md # what this prototype is, how to run it, what's mocked
77
+ └── .forge/
78
+ ├── feedback.md # running list of user iteration feedback
79
+ └── convergence-log.md # rejected approaches, tried-and-discarded
80
+ ```
81
+
82
+ Run with:
83
+ ```bash
84
+ cd pocs/{name}-prototype && npm install && npm run dev
85
+ ```
86
+
87
+ ## Process
88
+
89
+ ### Step 0: locate inputs
90
+
91
+ | Input | How to find |
92
+ |---|---|
93
+ | Repo root | `git rev-parse --show-toplevel` or `${CLAUDE_PROJECT_DIR}` |
94
+ | Manifest | The single in-progress manifest under `.forge/work/*/*/manifest.yaml`. Multiple in flight = ask user. |
95
+ | Wireframe path | Manifest's `artifacts.wireframe.html_path`, or default `pocs/{name}-wireframe/index.html` |
96
+ | Concept deck | Manifest's `artifacts.concept.deck_path`, or default `decks/{name}/slides.md` |
97
+ | Output target | `pocs/{name}-prototype/` (default) or override via manifest's `artifacts.prototype.path` (set by this skill on Step 6 lock) |
98
+
99
+ If the manifest does not yet have `artifacts.wireframe.locked_at`, surface the gap and stop — this skill runs after wireframe lock.
100
+
101
+ ### Step 1: scaffold the project
102
+
103
+ Initialize the Vite + React + TS skeleton:
104
+
105
+ ```bash
106
+ cd <repo-root>
107
+ npm create vite@latest pocs/{name}-prototype -- --template react-ts
108
+ cd pocs/{name}-prototype
109
+ npm install
110
+ npm install -D @biomejs/biome tailwindcss@next @tailwindcss/vite
111
+ npm install zustand@^5 lucide-react
112
+ ```
113
+
114
+ Then add forge-standard configs:
115
+ - Replace `tailwind.config.ts` with v4 config that reads the wireframe's design tokens
116
+ - Add `biome.json` with forge defaults (2-space indent, double quotes, semicolons)
117
+ - Update `vite.config.ts` to include the `@tailwindcss/vite` plugin
118
+ - Replace `src/App.tsx` skeleton with the router shell
119
+ - Create `src/styles/tokens.css` extracted from the wireframe's CSS variables
120
+
121
+ Create the project README listing what's mocked and how to run.
122
+
123
+ ### Step 2: identify partitions
124
+
125
+ Read the wireframe's view list (from wireframe README + the `VIEWS` registry in the wireframe HTML). Identify natural partitions — independent feature areas that can be built in parallel.
126
+
127
+ Partition heuristics:
128
+ - **By user role** — agent screens vs supervisor screens (different feature folders, no overlap)
129
+ - **By tab cluster** — distinct top-level tabs in the wireframe (separate route trees)
130
+ - **By system area** — UI screens vs tutorial overlay vs settings panel
131
+
132
+ If the wireframe is small (≤5 views, single user role) → single partition (no parallel). If the wireframe is medium (6-15 views, role-distinct or area-distinct) → 2-3 partitions. Don't over-partition — each partition's prototype-builder needs enough work to justify its own context.
133
+
134
+ Document the partition plan in `pocs/{name}-prototype/.forge/partition-plan.md` so subsequent iterations can resume.
135
+
136
+ ### Step 3: dispatch prototype-builder per partition
137
+
138
+ For each partition, dispatch a `prototype-builder` subagent in parallel. Each instance receives:
139
+ - The wireframe HTML
140
+ - The wireframe README
141
+ - Its assigned partition (specific views to build)
142
+ - File-ownership boundaries (which `src/features/{area}/` is yours; what's shared)
143
+ - The shared scaffold (types, store skeleton, routes registry) — read-only for the subagent
144
+
145
+ The subagent returns:
146
+ - Files to write under its assigned `src/features/{area}/`
147
+ - Updates to add to shared types (in `src/types/`)
148
+ - Updates to add to the shared store (Zustand slice)
149
+ - Seed data files
150
+
151
+ The main session merges results: filesystem-level merge for non-overlapping partition output; for shared updates (types, store), apply each subagent's diff in turn.
152
+
153
+ ### Step 4: verify
154
+
155
+ After all partitions land:
156
+
157
+ ```bash
158
+ cd pocs/{name}-prototype
159
+ npm run dev # smoke test: dev server starts, no compile errors
160
+ npx biome check . # lint passes
161
+ ```
162
+
163
+ Use Playwright to verify each wireframe view has a corresponding running screen:
164
+
165
+ ```bash
166
+ npx playwright codegen http://localhost:5173
167
+ ```
168
+
169
+ Click through each route. Each screen should:
170
+ - Render without console errors
171
+ - Have the same visual structure as the wireframe state
172
+ - Have working interactions (clicks navigate, forms accept input, state updates)
173
+ - Use seed data (real-shaped, fake-content)
174
+
175
+ Capture findings in `pocs/{name}-prototype/.forge/feedback.md` if there's any drift between prototype and wireframe.
176
+
177
+ ### Step 5: side-effect capture during iteration
178
+
179
+ Phase 4 is also when real gotchas + conventions emerge. During iteration:
180
+
181
+ - **Gotchas**: every time prototype-builder hits a state-management surprise, library quirk, framework mounting issue, or type-system pothole, write to `aiwiki/gotchas/{date}-{slug}.md` per the gotcha schema. The wiki-lint hook validates on save.
182
+ - **Conventions**: when patterns settle (file naming, import order, state-shape conventions, design-token usage), write to `aiwiki/conventions/{slug}.md`. The `prototype-reviewer` flags new conventions emerging across iteration cycles.
183
+
184
+ These outputs feed Phase 5 codification. Do not skip them — Phase 5 reads from `aiwiki/gotchas/` and `aiwiki/conventions/` directly.
185
+
186
+ ### Step 6: emit lock signal
187
+
188
+ When the user emits "satisfied — go to production" (or equivalent), update the manifest:
189
+ - `artifacts.prototype.path: pocs/{name}-prototype/`
190
+ - `artifacts.prototype.locked_at: <ISO-8601 timestamp>`
191
+
192
+ Presence of `artifacts.prototype.locked_at` is the lock signal that Phase 5 (`harden`) reads. The locked prototype is the input to harden.
193
+
194
+ ## Backend integration during prototype
195
+
196
+ Backend-heavy products: the prototype frontend connects to a local backend (Vite proxy to a separate dev server) OR uses fully in-memory mocks. Two patterns:
197
+
198
+ | Pattern | Use when |
199
+ |---|---|
200
+ | Local backend + Vite proxy | Backend can be run locally with seed data; integration concerns are real and worth verifying |
201
+ | Fully in-memory | Backend is complex enough that running it would slow the prototype loop. Stub responses in `src/data/mocks.ts`. |
202
+
203
+ Document the choice in `pocs/{name}-prototype/README.md` so Phase 5 codification knows what's mocked.
204
+
205
+ ## What build-prototype does NOT do
206
+
207
+ - Does NOT write production code (mocks and in-memory state are intentional here)
208
+ - Does NOT implement real auth (seed user; real auth is a Phase 6 production-build delta)
209
+ - Does NOT set up CI / deployment (those are Phase 6/7)
210
+ - Does NOT run code review or static analysis gates (those are Phase 6)
211
+ - Does NOT add E2E test infrastructure beyond Playwright codegen for verification (full E2E suite is Phase 6)
212
+
213
+ ## Common mistakes
214
+
215
+ | Mistake | Fix |
216
+ |---|---|
217
+ | Hardening the prototype (real auth, real DB, error handling for unlikely failures) | Stop. The prototype is the spec; hardening is Phase 6's job. Time spent here is wasted twice. |
218
+ | Skipping seed data and using empty arrays | Empty UIs hide layout bugs. Use realistic-shaped seed data with placeholder content. |
219
+ | One giant feature folder | Partition by feature area. Even a small prototype benefits from `src/features/cases/`, `src/features/users/` etc. |
220
+ | Skipping `pocs/{name}-prototype/.forge/feedback.md` | The feedback file is how iteration converges; without it, the prototype just keeps changing without a plan |
221
+ | Missing Biome config | Forge convention; downstream tooling expects it |
222
+ | Inventing screens not in the wireframe | The wireframe is the spec; if a screen is missing, surface the gap to the user (the wireframe needs an iteration), don't extrapolate |
223
+ | Pre-promoting prototype gotchas to typed pages without `support-gotcha` | Gotchas use the `support-gotcha` skill flow; lint validates the schema. Write them through the proper channel. |
224
+
225
+ ## Red Flags
226
+
227
+ **Never:**
228
+ - Implement real auth, real DB, real external API calls (Phase 6's job)
229
+ - Skip wireframe verification — every wireframe view must have a corresponding running screen
230
+ - Lock the prototype with known-broken interactions (the lock signal means "this is what production should match")
231
+ - Over-partition (more than 3 partitions for typical work; if you need 4+, the wireframe is too sprawling — push back)
232
+
233
+ **Always:**
234
+ - Match the wireframe's visual structure (Tailwind classes derived from the design tokens; lucide icons matching the wireframe's icons)
235
+ - Use realistic-shaped seed data — placeholder content but real data shapes
236
+ - Capture gotchas + conventions during iteration (they're Phase 5 inputs)
237
+ - Verify with `npm run dev` + click-through before any iteration cycle ends
238
+
239
+ ## I/O Contract
240
+
241
+ | Field | Value |
242
+ |---|---|
243
+ | **Requires** | Locked wireframe HTML + README, concept deck, manifest |
244
+ | **Produces** | `pocs/{name}-prototype/` (full Vite + React app), `pocs/{name}-prototype/.forge/feedback.md`, `aiwiki/gotchas/` + `aiwiki/conventions/` (during iteration) |
245
+ | **Updates manifest** | `artifacts.prototype.{path, locked_at}` |
246
+ | **Triggers** | wiki-lint on every `aiwiki/**` write during iteration; phase-close dream after lock |
247
+
248
+ ## Integration
249
+
250
+ | Caller | When |
251
+ |---|---|
252
+ | Wireframe-lock event in `/feature` and `/greenfield` | Phase 3 → Phase 4 transition |
253
+ | Manual invocation | When a wireframe is mature enough to verify via running code |
254
+
255
+ | Dispatches | For |
256
+ |---|---|
257
+ | `prototype-builder` subagent (multi-instance) | Per-partition implementation in own context windows |
258
+
259
+ | Pairs with | For |
260
+ |---|---|
261
+ | `iterate-prototype` skill | Polish loop after initial scaffold; user feedback drives revisions |
262
+ | `prototype-reviewer` agent | Drift check between prototype and wireframe before Phase 5 |
263
+ | `support-gotcha` skill | Capture gotchas surfaced during iteration |
264
+ | `harden` skill | Phase 5 successor — reads the locked prototype as input |
@@ -0,0 +1,340 @@
1
+ ---
2
+ name: build-scaffold
3
+ description: "Use after architecture is approved to generate project directory layout, build tooling, Docker config, and test infrastructure for a new codebase."
4
+ ---
5
+
6
+ # Build Scaffold
7
+
8
+ ## Overview
9
+
10
+ Set up a new project from scratch with production-ready structure, build tooling, containerization, and test infrastructure.
11
+
12
+ **Core principle:** A project that builds and tests from the first commit is a project that stays healthy.
13
+
14
+ **Announce at start:** "I'm using the build-scaffold skill to set up the project structure."
15
+
16
+ ## When to Use
17
+
18
+ - Greenfield projects (no existing code)
19
+ - `/greenfield` command (scaffold phase)
20
+ - When the user says "start a new project" or "set up from scratch"
21
+
22
+ **Not for:**
23
+ - Adding features to existing projects (use build-tdd)
24
+ - Restructuring existing projects (use /refactor command)
25
+
26
+ ## Prerequisites
27
+
28
+ Before scaffolding, the project profile must exist (CLAUDE.md or equivalent specifying tech stack, frameworks, database). Architecture context is also required, sourced from whichever upstream phase applies to the work:
29
+
30
+ - **Prototype-driven flow** (default `/feature`, `/greenfield`): the codified architecture in `aiwiki/architecture/` and the slice graph in the work manifest, produced by the `harden` skill at Phase 5 (codify).
31
+ - **Non-prototype fallback flow** (libraries, internal tools where wireframe makes no sense): architecture artifacts from `plan-architecture` in `.forge/work/{type}/{name}/architecture/` and key decisions in `aiwiki/decisions/`.
32
+
33
+ If neither is available, stop and request — do not guess at technology choices.
34
+
35
+ ## Step 0: Codex Delegate Check
36
+
37
+ Before running any scaffold steps, check if Codex should build the scaffold instead of Claude:
38
+
39
+ 1. Run `codex --version`. If exit code is non-zero, Codex is unavailable — skip this step silently and proceed to Step 1. Never prompt the user about Codex when it isn't installed.
40
+ 2. If Codex is available, read `codex.delegate` in `.forge/local.yaml`:
41
+ - **`always`** or the user explicitly requested Codex as the builder → dispatch Codex with the architecture artifacts, project profile, and this skill's SKILL.md. Codex generates the complete scaffold. Skip to Step 7 (Verify) when Codex returns. Quality gate still applies.
42
+ - **`ask`** or absent → prompt once per `protocols/codex.md`. Save the answer if the user picks "always" or "never".
43
+ - **`never`** → proceed with Claude-driven scaffold below.
44
+
45
+ See the **Codex Integration** section at the end for the exact invocation command and context paths.
46
+
47
+ ## The Scaffold Process
48
+
49
+ ### Step 1: Read Project Profile
50
+
51
+ Read CLAUDE.md (or the architecture artifacts) for:
52
+
53
+ ```
54
+ - Language / runtime (Node.js, Python, Go, Rust, Java, etc.)
55
+ - Framework (Express, FastAPI, Gin, Actix, Spring, etc.)
56
+ - Database (PostgreSQL, MySQL, MongoDB, SQLite, etc.)
57
+ - Frontend framework (React, Vue, Svelte, etc.) if applicable
58
+ - Package manager (npm, yarn, pnpm, pip, poetry, cargo, etc.)
59
+ - Testing framework (Jest, Vitest, pytest, go test, etc.)
60
+ - CI/CD target (GitHub Actions, GitLab CI, etc.)
61
+ ```
62
+
63
+ **Do not assume defaults.** If the project profile does not specify a choice, ask the user. Every technology decision matters.
64
+
65
+ ### Step 2: Generate Directory Structure
66
+
67
+ Follow conventions for the detected stack. General pattern:
68
+
69
+ ```
70
+ project-root/
71
+ ├── src/ # Application source code
72
+ │ ├── [domain-grouped dirs] # Organized by feature/domain, NOT by type
73
+ │ └── index.ts / main.py / main.go # Entry point
74
+ ├── tests/ # Test files (mirror src/ structure)
75
+ │ ├── unit/
76
+ │ ├── integration/
77
+ │ └── e2e/
78
+ ├── scripts/ # Build, deploy, utility scripts
79
+ ├── docs/ # Project documentation
80
+ ├── docker/ # Docker-related files (if complex)
81
+ ├── .github/ or .gitlab-ci/ # CI/CD configuration
82
+ └── [config files at root] # package.json, pyproject.toml, etc.
83
+ ```
84
+
85
+ **Stack-specific structures:**
86
+
87
+ #### Node.js / TypeScript
88
+ ```
89
+ ├── src/
90
+ │ ├── modules/ # Feature modules
91
+ │ │ └── [feature]/
92
+ │ │ ├── [feature].controller.ts
93
+ │ │ ├── [feature].service.ts
94
+ │ │ ├── [feature].repository.ts
95
+ │ │ ├── [feature].types.ts
96
+ │ │ └── [feature].test.ts
97
+ │ ├── common/ # Shared utilities
98
+ │ │ ├── middleware/
99
+ │ │ ├── errors/
100
+ │ │ └── utils/
101
+ │ ├── config/ # Configuration loading
102
+ │ └── app.ts # Application setup
103
+ ├── tests/
104
+ │ ├── integration/
105
+ │ └── e2e/
106
+ ├── package.json
107
+ ├── tsconfig.json
108
+ ├── vitest.config.ts / jest.config.ts
109
+ └── eslint.config.js
110
+ ```
111
+
112
+ #### Python
113
+ ```
114
+ ├── src/
115
+ │ └── [package_name]/
116
+ │ ├── __init__.py
117
+ │ ├── [module]/
118
+ │ │ ├── __init__.py
119
+ │ │ ├── routes.py
120
+ │ │ ├── service.py
121
+ │ │ ├── models.py
122
+ │ │ └── schemas.py
123
+ │ ├── core/
124
+ │ │ ├── config.py
125
+ │ │ └── dependencies.py
126
+ │ └── main.py
127
+ ├── tests/
128
+ │ ├── unit/
129
+ │ ├── integration/
130
+ │ └── conftest.py
131
+ ├── pyproject.toml
132
+ └── alembic/ (if using SQLAlchemy)
133
+ ```
134
+
135
+ #### Go
136
+ ```
137
+ ├── cmd/
138
+ │ └── server/
139
+ │ └── main.go
140
+ ├── internal/
141
+ │ ├── [domain]/
142
+ │ │ ├── handler.go
143
+ │ │ ├── service.go
144
+ │ │ ├── repository.go
145
+ │ │ └── models.go
146
+ │ ├── config/
147
+ │ └── middleware/
148
+ ├── pkg/ # Public packages (if any)
149
+ ├── go.mod
150
+ ├── go.sum
151
+ └── Makefile
152
+ ```
153
+
154
+ **Adapt structure to the specific framework** (e.g., Next.js uses `app/` or `pages/`, Django uses `manage.py` and app directories).
155
+
156
+ ### Step 3: Set Up Build Tooling
157
+
158
+ Create the appropriate package manifest for the detected stack. Adapt to the specific framework in use (Next.js, Django, FastAPI, etc.).
159
+
160
+ - **Node.js** (`package.json`): include scripts `dev`, `build`, `start`, `test`, `test:coverage`, `lint`, `lint:fix`, `typecheck`. Pin Node version in `engines`. Commit the lockfile.
161
+ - **Python** (`pyproject.toml`, PEP 621): configure `[tool.pytest.ini_options]`, `[tool.ruff]` (line-length 100), and `[tool.mypy]`. Pin Python version in `.python-version`. If the package manager produces a lockfile (`poetry.lock`, `uv.lock`, `Pipfile.lock`), commit it; plain pip has no standard lockfile.
162
+ - **Go** (`go.mod` + `Makefile`): Makefile targets `build`, `test`, `lint`, `run`. Pin Go version in `go.mod`. Commit `go.sum`.
163
+
164
+ **Key rule:** every script/target must work immediately after setup. If `npm test` fails on a fresh clone, the scaffold is broken.
165
+
166
+ ### Step 3.5: Install CSS Framework (Frontend Projects Only)
167
+
168
+ If the project has a frontend and `DESIGN.md` exists at the project root (from the `plan-design-system` skill):
169
+
170
+ 1. **Read `DESIGN.md`** at the project root for design tokens (colors, typography, spacing, component conventions)
171
+ 2. **Install the chosen CSS framework** (Tailwind, CSS Modules, styled-components, etc.) as specified in the design tokens
172
+ 3. **Configure the framework** — set up Tailwind config with the design token colors, or create CSS custom properties from the tokens
173
+ 4. **Apply the base theme** — set the global background, text color, and font family from the design tokens
174
+ 5. **Verify the build succeeds** with the CSS framework installed
175
+
176
+ If no `DESIGN.md` exists (e.g., backend-only project), skip this step.
177
+
178
+ ### Step 4: Docker Setup
179
+
180
+ Create Docker environment for reproducible development.
181
+
182
+ **Dockerfile** — multi-stage production build:
183
+ - `builder` stage installs dependencies and runs build
184
+ - `runtime` stage copies build output via `COPY --from=builder`
185
+ - Pin base image to a specific version (NEVER `:latest`)
186
+ - `EXPOSE` the app port, `CMD` runs the start command
187
+
188
+ **docker-compose.yml** — include every service the approved architecture requires (app, db, cache, queue, etc.). Omit services the architecture doesn't use; if the architecture uses no external services, compose may be omitted or contain only the app.
189
+ - `app`: `build: .`, port from `${APP_PORT}`, env from `.env`, volumes for hot-reload. If a db service is present, add `depends_on: db: condition: service_healthy`
190
+ - `db` (only if the architecture uses a containerized database — skip for SQLite or externally managed databases): pinned image (e.g., `postgres:16-alpine`), named volume for persistence, healthcheck (e.g., `pg_isready`)
191
+ - Top-level `volumes` block for any named volumes declared above
192
+
193
+ **.dockerignore** — exclude `node_modules/` (or equivalent), `.git/`, `.env*`, `*.log`, `dist/`/`build/`, `coverage/`, `.forge/`.
194
+
195
+ **Key rules:**
196
+ - Multi-stage builds for production images
197
+ - Healthchecks on every service that others depend on
198
+ - Volumes for hot-reload in development, not production
199
+ - Pinned base image versions — no `latest` tag
200
+ - `.dockerignore` must be present
201
+
202
+ ### Step 5: Environment Configuration
203
+
204
+ **`.env.example`** — document every environment variable the app reads. Group by purpose (Application, Database, Auth, External Services). Use safe placeholder values; never real secrets. Include a comment per variable explaining what it does. `.env` itself must be gitignored.
205
+
206
+ **`.gitignore`** — generate stack-idiomatic entries. Always include: `.env*` (except `.env.example`), `*.log`, coverage outputs, build artifacts, `.forge/`, `.worktrees/`, and the stack's dependency/cache dir (`node_modules/`, `__pycache__/`, `vendor/`, `target/`, etc.).
207
+
208
+ ### Step 6: Initial Test Infrastructure
209
+
210
+ Set up the test runner and write the first test:
211
+
212
+ **Test runner configuration** — configure the project's test framework (Vitest/Jest for Node, pytest for Python, `go test` for Go, etc.) with:
213
+ - Coverage enabled (v8, c8, coverage.py, `-cover`)
214
+ - Coverage thresholds at **80% on statements, branches, functions, lines** (or the stack equivalent)
215
+ - Test directory matches the structure in Step 2
216
+
217
+ **Smoke test** — write one trivial test per stack's idiom (e.g., `expect(true).toBe(true)` for Vitest, `assert True` for pytest, a minimal `t.Run` for Go). Its only job is to prove the test runner works. MUST pass before proceeding to any implementation.
218
+
219
+ ### Step 7: Verify Build and Tests
220
+
221
+ Run the full verification sequence:
222
+
223
+ ```bash
224
+ # 1. Install dependencies
225
+ [package-manager] install
226
+
227
+ # 2. Build the project
228
+ [build-command]
229
+
230
+ # 3. Run linter
231
+ [lint-command]
232
+
233
+ # 4. Run tests
234
+ [test-command]
235
+
236
+ # 5. Docker build (if Docker is set up)
237
+ docker compose build
238
+
239
+ # 6. Docker up + health check (optional but recommended)
240
+ docker compose up -d
241
+ docker compose ps # verify all services healthy
242
+ docker compose down
243
+ ```
244
+
245
+ **All steps must pass.** If any step fails:
246
+ 1. Fix the issue immediately
247
+ 2. Re-run verification from the beginning
248
+ 3. Do not proceed to build-tdd until everything passes
249
+
250
+ ### Step 8: Initial Commit
251
+
252
+ Once everything passes:
253
+
254
+ ```bash
255
+ git init
256
+ git add .
257
+ git commit -m "feat: initial project scaffold
258
+
259
+ - Project structure for [stack]
260
+ - Build tooling configured
261
+ - Docker environment set up
262
+ - Test infrastructure verified
263
+ - All tests passing"
264
+ ```
265
+
266
+ ## TDD Exemption
267
+
268
+ Scaffolding is explicitly exempt from the build-tdd "NO production code without a failing test" rule. Scaffold generates boilerplate infrastructure (directory structure, config files, Docker setup, build tooling) that is verified by the post-scaffold checklist below, not by TDD. The initial smoke test written during scaffolding proves the infrastructure works. Once scaffold is complete and handed off to build-tdd, normal TDD discipline applies to all subsequent code.
269
+
270
+ ## Post-Scaffold Checklist
271
+
272
+ Before handing off to build-tdd, verify:
273
+
274
+ - [ ] Directory structure follows stack conventions
275
+ - [ ] Package manifest exists with all required scripts
276
+ - [ ] All scripts work (`dev`, `build`, `test`, `lint`)
277
+ - [ ] Docker builds successfully
278
+ - [ ] docker-compose starts all services with health checks
279
+ - [ ] `.env.example` has all required variables
280
+ - [ ] `.gitignore` covers all generated/sensitive files
281
+ - [ ] Test runner configured with coverage thresholds
282
+ - [ ] Smoke test passes
283
+ - [ ] Linter passes with zero warnings
284
+ - [ ] Initial commit made
285
+
286
+ **Cannot check all boxes? Fix before proceeding. The scaffold is the foundation.**
287
+
288
+ ## Common Mistakes
289
+
290
+ | Mistake | Fix |
291
+ |---------|-----|
292
+ | Skipping Docker setup | Docker-first for reproducibility. Always set up. |
293
+ | Missing .env.example | Every env var must be documented. No guessing. |
294
+ | No test infrastructure | First test must pass before any implementation. |
295
+ | Using `latest` Docker tag | Pin specific versions for reproducibility. |
296
+ | Organizing by file type | Organize by feature/domain. Not controllers/, services/, models/. |
297
+ | Missing .gitignore entries | Generate comprehensive ignore file for the stack. |
298
+ | Scripts that do not work | Every script must work on fresh clone. Verify each one. |
299
+ | No linter configured | Linting catches issues early. Configure from day one. |
300
+
301
+ ## I/O Contract
302
+
303
+ | Field | Value |
304
+ |---|---|
305
+ | **Requires** | Architecture context (codified `aiwiki/architecture/` + manifest slice graph from `harden`, OR `.forge/work/{type}/{name}/architecture/` from `plan-architecture`) + project profile (CLAUDE.md) |
306
+ | **Produces** | Project directory structure, `package.json` / `pyproject.toml` / `go.mod`, `Dockerfile`, `docker-compose.yml`, `.env.example`, `.gitignore`, test runner config, initial smoke test |
307
+ | **Feeds into** | `build-tdd` at Phase 6 (production-build) |
308
+ | **Updates manifest** | `artifacts.scaffold.locked_at` (scaffold complete) — slice work proceeds against the scaffolded structure |
309
+
310
+ ## Codex Integration
311
+
312
+ **Mode:** Delegate | **Protocol:** `protocols/codex.md` | **Consent key:** `codex.delegate`
313
+
314
+ **When:** Step 0, if Codex is installed AND `codex.delegate` is `always` (or the user accepts the `ask` prompt).
315
+
316
+ **Context to pass:**
317
+ - Path to architecture (either `aiwiki/architecture/` from harden, or `.forge/work/{type}/{name}/architecture/` from plan-architecture)
318
+ - Slice graph from manifest (harden flow) or `tasks.md` (plan-task-decompose flow)
319
+ - Path to this skill: `skills/build-scaffold/SKILL.md`
320
+
321
+ **What Codex does:**
322
+ - Generate the project scaffold following the architecture spec
323
+ - Follow the methodology defined in this skill's SKILL.md (directory patterns in Step 2, adapt to the detected framework)
324
+
325
+ **Prompt focus:** "Generate the project scaffold following the architecture artifacts at [paths]. Follow the methodology in skills/build-scaffold/SKILL.md. Output the complete file tree with contents."
326
+
327
+ **Quality gate:** Scaffold output goes through standard verification (Step 7) — directory structure matches architecture, configuration files are valid, initial tests pass. Claude runs verification regardless of who built.
328
+
329
+ ---
330
+
331
+ ## Integration
332
+
333
+ **Called by:**
334
+ - `/greenfield` command (after architecture phase)
335
+
336
+ **Pairs with:**
337
+ - `harden` (prototype-driven flow: reads codified architecture + slice graph from `aiwiki/` and manifest)
338
+ - `plan-architecture` (non-prototype fallback flow: reads `.forge/work/.../architecture/`)
339
+ - `build-tdd` (hands off a working project ready for Phase 6 production-build)
340
+ - `deliver-onboarding` (scaffold creates the foundation that onboarding documents)