@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,76 @@
1
+ # User Stories
2
+
3
+ ## Story: {Story Title}
4
+
5
+ **ID**: US-{number}
6
+ **Priority**: Must / Should / Could / Won't (MoSCoW)
7
+
8
+ ### Description
9
+ As a **{role}**,
10
+ I want **{action}**,
11
+ so that **{benefit}**.
12
+
13
+ ### Acceptance Criteria
14
+
15
+ - [ ] **Given** {precondition}, **when** {action}, **then** {expected result}
16
+ - [ ] **Given** {precondition}, **when** {action}, **then** {expected result}
17
+ - [ ] **Given** {precondition}, **when** {action}, **then** {expected result}
18
+
19
+ ### Dependencies
20
+
21
+ - {Depends on US-{number} because...}
22
+ - {Requires {external system/service} to be available}
23
+
24
+ ### Notes
25
+
26
+ - {Additional context, constraints, or considerations}
27
+ - {Link to mockup, design, or reference material}
28
+
29
+ ---
30
+
31
+ ## Story: {Next Story Title}
32
+
33
+ **ID**: US-{number}
34
+ **Priority**: Must / Should / Could / Won't
35
+
36
+ ### Description
37
+ As a **{role}**,
38
+ I want **{action}**,
39
+ so that **{benefit}**.
40
+
41
+ ### Acceptance Criteria
42
+
43
+ - [ ] **Given** {precondition}, **when** {action}, **then** {expected result}
44
+
45
+ ### Dependencies
46
+
47
+ - {none / list dependencies}
48
+
49
+ ### Notes
50
+
51
+ - {Additional context}
52
+
53
+ ---
54
+
55
+ ## User Journeys
56
+
57
+ Chain user stories into end-to-end flows. Each journey represents a complete user goal. E2E tests are derived from these journeys.
58
+
59
+ ### Journey: {Journey Name}
60
+ **Priority:** Must / Should / Could
61
+ **Stories:** US-{x} → US-{y} → US-{z}
62
+
63
+ | Step | User Does | System Response | Story |
64
+ |---|---|---|---|
65
+ | 1 | {user action} | {system response} | US-{x} |
66
+ | 2 | {user action} | {system response} | US-{y} |
67
+ | 3 | {user action} | {system response} | US-{z} |
68
+
69
+ ---
70
+
71
+ ## Summary
72
+
73
+ | ID | Title | Priority | Dependencies | Status |
74
+ |----|-------|----------|-------------|--------|
75
+ | US-001 | {title} | Must | None | Draft |
76
+ | US-002 | {title} | Should | US-001 | Draft |
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: harden
3
+ description: "Use after a working prototype is locked and the user says 'codify', 'harden', 'ready to productionize', 'extract decisions', 'time to build for real', or runs /feature past the prototype phase. Extracts architecture, ADRs, design system, slice graph, and convention/gotcha promotions FROM the working prototype — does not invent them. Skip if prototype is still iterating or has been abandoned — re-iterate or restart instead."
4
+ ---
5
+
6
+ # Harden
7
+
8
+ ## Overview
9
+
10
+ A working prototype contains real decisions: what data shape works, which interactions feel right, where the seams are, what failures recur. Production code needs those decisions written down before it can be built. This skill codifies — it does not invent.
11
+
12
+ **Core principle:** the prototype is the verification; this skill is the transcription. Every output cites the prototype file, wireframe state, or iteration gotcha it derives from. ADRs that can't cite a concrete prototype decision are flagged for review — they may be premature.
13
+
14
+ **Announce at start:** "I'm using the harden skill to codify the prototype into production plans."
15
+
16
+ ## When to Use
17
+
18
+ - Right after the user locks the prototype phase ("satisfied — go to production"). Triggered by the prototype-lock event or by an explicit invocation.
19
+ - Ad-hoc when a feature's prototype is mature enough that production planning should begin while iteration continues at low intensity.
20
+
21
+ **Do NOT skip when:**
22
+ - The prototype "feels obvious" — obvious shape still needs an architecture document so the production build is testable against it
23
+ - The team is in a hurry — skipping codification means the production build is improvising; the gates downstream rely on this skill's outputs as inputs
24
+
25
+ **Do NOT use this skill for:**
26
+ - Generating architecture from scratch with no prototype (use `plan-architecture` directly during a non-prototype-driven flow)
27
+ - Reviewing existing architecture docs (that's `craft-reviewer` and `code-reviewer`'s job)
28
+ - Building the production code itself (that's the production-build phase, after this skill closes)
29
+
30
+ ## What harden produces (multi-output)
31
+
32
+ This is an orchestrator skill. A single invocation may produce all of the below:
33
+
34
+ | Output | Where | Purpose |
35
+ |---|---|---|
36
+ | Architecture file(s) | `aiwiki/architecture/{topic}.md` (one per subsystem) | The system shape, components, boundaries, tradeoffs as observed in the prototype |
37
+ | ADRs | `aiwiki/decisions/{nnnn}-{slug}.md` | Production-only decisions that the prototype implicitly made; needs explicit recording (with `review:` block per the adversarial-review trigger list) |
38
+ | Convention additions | `aiwiki/conventions/{slug}.md` | Production-surface conventions the frontend prototype didn't cover (API route handler naming, error shapes, etc.) |
39
+ | Gotcha addenda | `aiwiki/gotchas/{date}-{slug}.md` (existing files updated) | Re-evaluates Phase 4 gotchas under production scope; adds "still applies under server-rendered hydration" or similar production-only notes |
40
+ | Production task graph | `.forge/work/{type}/{name}/tasks.md` + `slice_graph` field in manifest | What needs to be built to take the prototype to production |
41
+ | Session entry | `aiwiki/sessions/{date}-{slug}.md` | Index linking everything produced this session |
42
+
43
+ The expected total is short: ~200-400 lines across all architecture files combined, ~3-8 ADRs, a slice graph with explicit dependencies. Not 1000+ lines of monolithic plan.
44
+
45
+ ## What harden does NOT do
46
+
47
+ - Does NOT write production code (Phase 6's job)
48
+ - Does NOT run gates (LINT runs on the wiki output; reachability runs on production code later)
49
+ - Does NOT modify the prototype (it's the source of truth — leave it alone)
50
+ - Does NOT pre-promote raw entries from `aiwiki/raw/` to typed pages (dream's job at phase close)
51
+ - Does NOT skip the adversarial-review step on ADRs — every production ADR is reviewed inline at Step 2 (the dedicated `/second-opinion` slash command + `support-second-opinion` skill are *planned, not yet implemented*; until they ship, harden inlines the review pass and records reviewer, objections, resolutions, verdict in the ADR `review:` block before promoting to `accepted`)
52
+
53
+ ## Inputs
54
+
55
+ | Source | Required | Purpose |
56
+ |---|---|---|
57
+ | Locked prototype directory | yes | The codebase being codified |
58
+ | Wireframe single-HTML | yes | Visual spec; design-system extraction source |
59
+ | Concept slides | yes | High-level intent context |
60
+ | `aiwiki/gotchas/` (Phase 4 entries) | if present | Prototype iteration gotchas to re-evaluate under production scope |
61
+ | `aiwiki/conventions/` (Phase 4 entries) | if present | Conventions captured during prototype iteration |
62
+ | Existing `aiwiki/architecture/` | if present | Prior architecture this work extends or supersedes |
63
+ | Existing `aiwiki/decisions/` | if present | Prior ADRs to check for supersession |
64
+ | `references/common/coding-standards.md` + `references/{lang}/standards.md` | yes | Production standards loaded as constraints on codified output |
65
+ | `rules/common/{testing,quality-gates,git-workflow}.md` | yes | Phase-conditional rules that activate from this phase forward |
66
+ | Manifest at `.forge/work/{type}/{name}/manifest.yaml` | yes | Target for slice graph + task list output |
67
+
68
+ ## Process
69
+
70
+ ### Step 0: locate inputs
71
+
72
+ ```
73
+ Repo root: `git rev-parse --show-toplevel` or `${CLAUDE_PROJECT_DIR}`
74
+ Manifest: the in-progress manifest under `.forge/work/*/*/manifest.yaml`. Multiple in flight = ask user.
75
+ Prototype dir: from manifest's `prototype_path` field, or default `pocs/{name}-prototype/`
76
+ Wireframe path: from manifest's `wireframe_path` field, or default `pocs/{name}-wireframe/index.html`
77
+ ```
78
+
79
+ If the manifest does not yet have `artifacts.prototype.locked_at`, surface the gap and stop — this skill runs after prototype lock.
80
+
81
+ ### Step 1: dispatch the prototype-codifier subagent
82
+
83
+ The bulk of the codification work happens in a separate context window so the main session stays lean.
84
+
85
+ Dispatch `prototype-codifier` with:
86
+ - Prototype directory path
87
+ - Wireframe HTML path
88
+ - Concept slides path
89
+ - Path lists for existing `aiwiki/gotchas/`, `aiwiki/conventions/`, `aiwiki/architecture/`
90
+ - Manifest path (writes target)
91
+
92
+ The subagent returns a structured report listing:
93
+ - Proposed architecture files (with topics + content)
94
+ - Proposed ADRs (with subjects + draft content, marked `status: proposed`)
95
+ - Convention additions
96
+ - Gotcha addenda
97
+ - Slice graph + task list
98
+
99
+ The subagent does NOT write the files itself — it returns the proposals. The main session writes them after step 2.
100
+
101
+ ### Step 2: invoke adversarial review on each proposed ADR
102
+
103
+ Each proposed ADR represents a decision that's hard to reverse — by definition, ADR-worthy. The `prototype-codifier` agent only proposes ADRs that match the adversarial-review trigger list (the canonical list lives in `agents/prototype-codifier.md` Phase 4); every proposal therefore arrives flagged for review.
104
+
105
+ For each proposed ADR, run an adversarial review pass and write a structured `review:` block (reviewers, objections, resolutions, verdict) into the draft. The dedicated `/second-opinion` slash command + `support-second-opinion` skill that would package this work are *planned, not yet implemented* — until they ship, perform the review inline within harden (interrogate the decision against the trigger list's failure modes, surface objections explicitly, and either record resolutions or escalate to the user).
106
+
107
+ Only ADRs with `verdict: approved` get written as `status: accepted`. ADRs with `verdict: escalate` are surfaced to the user for resolution before the phase closes. ADRs with `verdict: reject` are dropped from the proposal set.
108
+
109
+ ### Step 2.5: test-oracle capture
110
+
111
+ Snapshot the prototype's behavior — route renders, key interactions, golden output traces — as integration-test oracles. Production code in Phase 6 must pass these.
112
+
113
+ This is the SDLC's load-bearing wiring-test backbone — without it, mock-heavy unit tests pass while real integration breaks (Flux/REACH dogfood gap). Capture at least:
114
+
115
+ - **Route/render oracles** for every page or HTTP endpoint the prototype exposes (status + body shape + critical DOM/JSON nodes)
116
+ - **Interaction oracles** for the click-through paths the wireframe demos (sequence of state transitions and observable outputs)
117
+ - **Golden output traces** for any pipeline, transform, or CLI command in the prototype (input fixture → expected output, byte- or structure-exact)
118
+
119
+ Write the oracles to `aiwiki/oracles/{slug}.md` (one per slice or subsystem) with: source citation (prototype file + sha7), capture method (manual click-through, recorded fixture, snapshot diff), and the expected observable. Reference them in the slice graph so Phase 6 knows which oracle each task must satisfy.
120
+
121
+ Oracles are not unit tests — they describe behavior at the same boundaries `build-tdd`'s Wiring Coverage subsection requires real-wiring tests for. They are the contract that says "the production rebuild meets the prototype's verified behavior," and they are what closes the mock-only gap.
122
+
123
+ ### Step 3: write the outputs
124
+
125
+ In order:
126
+
127
+ 1. Architecture files → `aiwiki/architecture/{topic}.md` (one per topic; do NOT collapse into a monolith)
128
+ 2. Approved ADRs → `aiwiki/decisions/{nnnn}-{slug}.md` (numbering: continue from the highest existing number)
129
+ 3. Convention additions → `aiwiki/conventions/{slug}.md`
130
+ 4. Gotcha addenda → update existing `aiwiki/gotchas/{date}-{slug}.md` files with production scope notes
131
+ 5. Slice graph + tasks → manifest's `slice_graph` field + `.forge/work/{type}/{name}/tasks.md`
132
+ 6. Session entry → `aiwiki/sessions/{date}-{slug}.md` linking everything written this session
133
+
134
+ Each write triggers wiki-lint synchronously; lint failures must be resolved before continuing.
135
+
136
+ ### Step 4: trigger a focused dream
137
+
138
+ After the writes land, fire a phase-close dream over the touched subfolders. The dream is the consolidation pass that may merge new ADRs with existing ones, promote raw entries that became relevant during codification, and prune stale entries the new architecture supersedes.
139
+
140
+ Dream output goes to `aiwiki/proposed/{dream_id}/` for user review. The phase does NOT close until the user accepts or rejects the dream output.
141
+
142
+ ### Step 5: gate
143
+
144
+ User reviews:
145
+ - The architecture files (do they accurately reflect the prototype?)
146
+ - The ADRs (each `review:` block has a clear verdict; objections are addressed)
147
+ - The slice graph (is the production task decomposition reasonable?)
148
+ - The dream proposal (any consolidation conflicts to resolve?)
149
+
150
+ User approves → Phase 6 (production-build) starts. User has objections → harden iterates: revise outputs, re-run dream, re-gate.
151
+
152
+ The user reviews ALL outputs as a unit, not piecemeal. The codified plan is short by design (~200-400 lines architecture + ~3-8 ADRs + slice graph) — review should be a single sitting, not a series of sessions.
153
+
154
+ ## Adversarial review integration
155
+
156
+ Every production-only decision is an ADR-worthy decision; the prototype-codifier subagent flags them all. Adversarial review runs on each proposed ADR before it's written as `accepted`. This is non-optional — production code that ships against an ADR with no recorded review is silent debt. The dedicated `/second-opinion` skill that will eventually own this work is *planned, not yet implemented* (see docs/V6-PLAN.md §11); today the review pass runs inline within harden Step 2 and writes the verdict directly into the ADR.
157
+
158
+ Decisions that don't make the trigger list (variable naming, inline-vs-extract, choosing between known-good libraries with no real tradeoff) don't need ADRs at all and are NOT proposed by the subagent.
159
+
160
+ ## Common mistakes
161
+
162
+ | Mistake | Fix |
163
+ |---|---|
164
+ | Generating architecture from imagination instead of citing the prototype | Every claim about a component cites `prototype-dir/path/to/file.ts:line@<sha7>` — if you can't cite, the claim is premature |
165
+ | One giant `aiwiki/architecture.md` file | Split by subsystem: `data-layer.md`, `auth-flow.md`, `event-bus.md`. Each <400 lines. |
166
+ | Writing ADRs for non-trigger-list decisions | Variable naming and inline-vs-extract are NOT ADRs. Use the trigger list strictly. |
167
+ | Skipping adversarial review because "the decision is obvious" | If the decision is obvious it doesn't need an ADR; if it needs an ADR it needs review (today inline; `/second-opinion` dedicated surface planned) |
168
+ | Pre-promoting raw entries during codification | Raw entries are dream's territory; harden writes to typed pages directly, raw stays raw until dream consolidates |
169
+ | Modifying the prototype during codification | The prototype is the source of truth — leave it alone. Annotation goes in the architecture file, not in prototype source |
170
+ | Treating the gate as advisory | Phase 6 reads these outputs; if codification is incomplete, the production build is improvising. Block until the user accepts. |
171
+
172
+ ## Red Flags
173
+
174
+ **Never:**
175
+ - Write production code in this phase (that's Phase 6)
176
+ - Skip the adversarial review on any proposed ADR
177
+ - Leave a proposed ADR with `verdict: escalate` unresolved at gate time
178
+ - Commit to the slice graph without listing explicit dependencies between slices
179
+ - Bypass wiki-lint on the outputs
180
+
181
+ **Always:**
182
+ - Cite the prototype file (or wireframe state) for every claim about how the system works
183
+ - Run the focused dream after writes — it catches conflicts the codification step alone misses
184
+ - Surface ALL outputs to the user for unified review
185
+ - Keep the codified plan short — if it grows past ~500 lines combined, it's invented, not codified
186
+
187
+ ## I/O Contract
188
+
189
+ | Field | Value |
190
+ |---|---|
191
+ | **Requires** | Locked prototype, wireframe, concept slides, Phase 4 wiki entries, manifest |
192
+ | **Produces** | `aiwiki/architecture/*.md`, `aiwiki/decisions/*.md` (ADRs), `aiwiki/conventions/*.md` (additions), `aiwiki/gotchas/*.md` (updates), manifest's `slice_graph` field, `.forge/work/{type}/{name}/tasks.md`, `aiwiki/sessions/*.md` |
193
+ | **Updates manifest** | `slice_graph`, `artifacts.codify.locked_at` |
194
+ | **Triggers** | wiki-lint on every write; phase-close dream after writes complete |
195
+
196
+ ## Integration
197
+
198
+ | Caller | When |
199
+ |---|---|
200
+ | Prototype-lock event in `/feature` and `/greenfield` | Phase 4 → Phase 5 transition |
201
+ | Manual invocation | When prototype is mature enough that production planning should begin |
202
+
203
+ | Dispatches | For |
204
+ |---|---|
205
+ | `prototype-codifier` subagent | Bulk codification work in own context window |
206
+ | `support-second-opinion` (`/second-opinion`) *(planned, not yet implemented)* | Adversarial review on each proposed ADR — until shipped, harden inlines this pass at Step 2 |
207
+ | `support-dream` | Focused dream over touched subfolders after writes |
208
+ | `support-wiki-lint` | Synchronous validation on every wiki write |
209
+
210
+ | Pairs with | For |
211
+ |---|---|
212
+ | `iterate-prototype` | Phase 4 driver that hands off to harden at lock |
213
+ | `build-tdd` | Phase 6 driver that reads harden's outputs as inputs |
214
+ | `quality-code-review` | Phase 6 reviewer that checks production code against the codified architecture |
@@ -0,0 +1,241 @@
1
+ ---
2
+ name: iterate-prototype
3
+ description: "Use to drive the polish loop on an in-progress prototype — read user feedback list, revise the relevant partitions, re-verify, repeat until the user emits 'satisfied' or 'LOCKED'. The polish loop after build-prototype's initial scaffold; runs sequentially (not parallel partitions). Captures gotchas + conventions discovered during iteration."
4
+ ---
5
+
6
+ # Iterate Prototype
7
+
8
+ ## Overview
9
+
10
+ After build-prototype scaffolds the initial Vite + React app from the wireframe, the user runs it locally and gives feedback: "this header is too tall", "the case detail needs a wrap-up modal", "the inbox filter is in the wrong place." This skill turns that feedback into focused revisions and verifies each one before the next.
11
+
12
+ **Core principle:** the prototype iterates against the running app, not against imagined screens. Every revision cycle ends with `npm run dev` + click-through verification before the user gives the next round of feedback.
13
+
14
+ **Announce at start:** "I'm using the iterate-prototype skill to apply the pending feedback to the prototype."
15
+
16
+ ## When to Use
17
+
18
+ - After `build-prototype` finishes the initial scaffold and the user starts giving feedback
19
+ - When the user says "polish", "iterate", "fix this", "tweak X", or names a specific feedback item
20
+ - When the user adds entries to `pocs/{name}-prototype/.forge/feedback.md` and asks to apply them
21
+
22
+ **Do NOT use this skill for:**
23
+ - Initial scaffolding (use `build-prototype` instead)
24
+ - Adding entirely new screens not in the wireframe (revise the wireframe first via `build-wireframe`)
25
+ - Fixing actual bugs in production code (this is prototype-only; production bugs go through `/bugfix`)
26
+ - Implementing real auth / real DB / production hardening (still Phase 6)
27
+
28
+ ## Loop modes
29
+
30
+ Two modes, both opt-in:
31
+
32
+ | Mode | When |
33
+ |---|---|
34
+ | **Manual** (default) | User adds feedback, invokes `/iterate-prototype`, reviews after revision, repeats. One cycle per invocation. |
35
+ | **Autopilot** *(planned, not yet implemented)* | User invokes `/autopilot prototype` once. A stop-loop hook re-feeds the prompt until the user emits `LOCKED`. The skill reads feedback, applies, verifies, then yields back to the loop hook for the next cycle. See docs/V6-PLAN.md §11; until shipped, every cycle is manual. |
36
+
37
+ Default to manual unless the user explicitly opts into autopilot. Autopilot's risk is iteration without human review at each step — useful for hands-off polish but easy to misuse on consequential design changes.
38
+
39
+ ## Inputs
40
+
41
+ | Source | Required | Purpose |
42
+ |---|---|---|
43
+ | Running prototype at `pocs/{name}-prototype/` | yes | The codebase being iterated |
44
+ | Locked wireframe HTML | yes | Still the spec — drift is checked against it |
45
+ | `pocs/{name}-prototype/.forge/feedback.md` | yes | Running list of user feedback items, oldest first |
46
+ | `pocs/{name}-prototype/.forge/partition-plan.md` | yes (from build-prototype) | Which partition each feedback item routes to |
47
+ | Existing `aiwiki/gotchas/` and `aiwiki/conventions/` | optional | Phase 4 captures so far |
48
+ | Manifest at `.forge/work/{type}/{name}/manifest.yaml` | yes | Phase state target |
49
+
50
+ ## Feedback file format
51
+
52
+ `pocs/{name}-prototype/.forge/feedback.md` is a checklist:
53
+
54
+ ```markdown
55
+ # Prototype Feedback
56
+
57
+ ## Pending
58
+
59
+ - [ ] Case header is too tall on supervisor view — reduce vertical padding by 1 step
60
+ - [ ] Inbox filter sticky-positioned at wrong y-offset on `/inbox`
61
+ - [ ] Add an explicit "wrap up" CTA on case detail (currently only via menu)
62
+
63
+ ## Resolved
64
+
65
+ - [x] (2026-05-09) Wireframe `s2` had a left rail; prototype was missing it — added
66
+ - [x] (2026-05-09) Tutorial overlay click-target too small — bumped hit area
67
+ ```
68
+
69
+ The skill reads the `## Pending` section, applies each item in order, then moves resolved items to `## Resolved` with the date.
70
+
71
+ The user appends to `## Pending` between iterations. Manual mode runs one batch of pending items per invocation; autopilot mode keeps draining until pending is empty AND the user emits LOCKED.
72
+
73
+ ## Process
74
+
75
+ ### Step 0: locate inputs
76
+
77
+ | Input | How to find |
78
+ |---|---|
79
+ | Repo root | `git rev-parse --show-toplevel` or `${CLAUDE_PROJECT_DIR}` |
80
+ | Manifest | The single in-progress manifest under `.forge/work/*/*/manifest.yaml`. Multiple = ask user. |
81
+ | Prototype path | Manifest's `artifacts.prototype.path`, or default `pocs/{name}-prototype/` |
82
+ | Wireframe path | Manifest's `wireframe_path`, or default `pocs/{name}-wireframe/index.html` |
83
+ | Feedback file | `<prototype-path>/.forge/feedback.md` |
84
+ | Partition plan | `<prototype-path>/.forge/partition-plan.md` |
85
+
86
+ If `artifacts.prototype.locked_at` is already present in the manifest, surface the gap and stop — iterate runs while the prototype phase is open, not after lock. Otherwise the prototype phase is open: proceed.
87
+
88
+ ### Step 1: read pending feedback
89
+
90
+ Parse `## Pending` from the feedback file. Each line that begins with `- [ ]` is an unresolved item.
91
+
92
+ If no pending items: report "No pending feedback to apply" and stop. The skill is a no-op when there's nothing to do.
93
+
94
+ ### Step 2: route feedback items to partitions
95
+
96
+ For each pending item, identify which partition the change touches by reading the partition plan and the feedback content.
97
+
98
+ Three routing patterns:
99
+
100
+ | Feedback shape | Routing |
101
+ |---|---|
102
+ | Names a specific screen ("case detail header...") | Route to that screen's partition |
103
+ | Names a system area ("tutorial overlay..., notifications...") | Route to that system's partition |
104
+ | Cross-cutting (design tokens, shared component, global state) | Dispatch a single instance of `prototype-builder` covering the shared scaffold (NOT a partition) |
105
+
106
+ If a feedback item is genuinely ambiguous (could touch multiple partitions), dispatch one builder per affected partition with the item scoped to "your-partition's expression of <feedback>".
107
+
108
+ ### Step 3: dispatch sequentially per partition
109
+
110
+ Unlike build-prototype's parallel dispatch, iterate-prototype runs sequentially. Reasons:
111
+
112
+ - Feedback items are usually small, individually scoped
113
+ - Sequential application keeps the diff reviewable per item
114
+ - Parallel revisions of the same partition would conflict
115
+
116
+ For each pending item:
117
+
118
+ 1. Dispatch `prototype-builder` with the item scoped to the relevant partition (or shared scaffold)
119
+ 2. Subagent returns the diff (changed files, content)
120
+ 3. Apply the diff
121
+ 4. Mark the item resolved
122
+
123
+ For cross-cutting items that touch multiple partitions, route to each in turn (still sequential).
124
+
125
+ ### Step 4: verify after each cycle (or after the batch in autopilot)
126
+
127
+ In manual mode, after applying the batch:
128
+
129
+ ```bash
130
+ cd pocs/{name}-prototype
131
+ npm run dev # smoke test
132
+ # user clicks through; provides next round of feedback
133
+ ```
134
+
135
+ In autopilot mode, after each individual item is applied:
136
+
137
+ ```bash
138
+ cd pocs/{name}-prototype
139
+ npm run dev &
140
+ sleep 2 # give Vite time to compile
141
+ npx playwright codegen http://localhost:5173 --output /tmp/codegen.spec.ts &
142
+ # script kills after sanity check; the codegen output is for human review later
143
+ ```
144
+
145
+ Verification doesn't replace user judgment — it just catches obvious breakage (compile errors, missing routes). The user is still the final reviewer.
146
+
147
+ ### Step 5: dispatch prototype-reviewer for drift check (optional, every 5 cycles or on demand)
148
+
149
+ After ~5 iteration cycles, drift between prototype and wireframe accumulates silently. Dispatch `prototype-reviewer` to flag:
150
+
151
+ - Wireframe states that no longer have a matching prototype screen
152
+ - Prototype screens that aren't in the wireframe (undocumented features)
153
+ - Interaction model deviations (e.g. wireframe shows modal, prototype now uses sheet)
154
+ - Convention drift (file naming, import order, design token usage)
155
+
156
+ The reviewer returns findings; the user decides whether to update the wireframe (codify the change) or revert the prototype (restore alignment). Either way, the next iteration starts from a known-aligned state.
157
+
158
+ In autopilot, the reviewer runs every 5 cycles automatically. In manual, it runs on demand or when the user invokes `/check-prototype-drift`.
159
+
160
+ ### Step 6: capture side effects during iteration
161
+
162
+ Each iteration may surface gotchas or conventions. The dispatched prototype-builder subagent will write these to `aiwiki/` per the gotcha and convention schemas. The wiki-lint hook validates on save.
163
+
164
+ If the prototype-builder reports a gotcha that already exists (matched by root cause), bump the existing gotcha's `occurrences` field instead of creating a duplicate. If `occurrences` reaches 3+, the gotcha is auto-drafted as a `proposed_rule:` block — the next session-start will hard-interrupt to require user approval before promoting it.
165
+
166
+ ### Step 7: update the feedback file
167
+
168
+ After each batch (manual) or each item (autopilot):
169
+
170
+ - Move resolved items from `## Pending` to `## Resolved` with date
171
+ - Keep pending items that weren't applied (e.g. user reordered priorities)
172
+
173
+ ### Step 8: detect convergence
174
+
175
+ Two convergence signals:
176
+
177
+ | Signal | Meaning |
178
+ |---|---|
179
+ | User emits "satisfied", "LOCKED", "done", or equivalent | Phase 4 is closing — set manifest's `artifacts.prototype.{path, locked_at}` and stop the loop |
180
+ | Iteration count reaches 10 cycles since last alignment check | Run prototype-reviewer drift check before continuing; surface "are we converging?" if drift is high |
181
+
182
+ In autopilot mode, the loop hook reads the LOCKED signal from the manifest and exits cleanly.
183
+
184
+ ## Anti-fatigue
185
+
186
+ If pending feedback grows past 10 items without any being resolved, the loop is not iterating — it's accumulating. Surface this to the user explicitly: "Pending list has grown to N items without resolution; consider whether the wireframe needs an update before continuing prototype iteration." This is the prototype-equivalent of the wiki accept-fatigue safeguard.
187
+
188
+ ## Common mistakes
189
+
190
+ | Mistake | Fix |
191
+ |---|---|
192
+ | Running parallel revisions of the same partition | Sequential only in iterate; parallel is build-prototype's territory |
193
+ | Skipping drift check across many iteration cycles | Drift accumulates silently; run `prototype-reviewer` every 5 cycles or surface the gap |
194
+ | Applying feedback that asks for new screens | New screens require wireframe revision first; surface the gap, do not extrapolate |
195
+ | Hardening the prototype during iteration | Phase 4 is still the prototype; real auth / real DB / production-grade error handling stays out |
196
+ | Letting feedback file grow unbounded without convergence signal | Anti-fatigue: surface explicit "pending growing without resolution" warning at >10 unresolved |
197
+ | Forgetting to capture gotchas surfaced during iteration | Gotchas are Phase 5 inputs; they must land in `aiwiki/gotchas/` to feed harden |
198
+ | Bypassing wiki-lint on captured gotchas/conventions | Hook fires automatically; if it's bypassed, lint manually after |
199
+
200
+ ## Red Flags
201
+
202
+ **Never:**
203
+ - Add screens not in the wireframe (revise the wireframe first)
204
+ - Lock the prototype with known broken interactions (the lock signal means "production should match this")
205
+ - Run autopilot mode on consequential design changes (e.g. layout overhaul) — autopilot is for polish, not redesign
206
+ - Skip drift checks indefinitely (5-cycle cadence is the floor)
207
+
208
+ **Always:**
209
+ - Sequential dispatch (one prototype-builder at a time during iterate)
210
+ - Update the feedback file as items resolve
211
+ - Run `npm run dev` between cycles in manual mode
212
+ - Capture gotchas + conventions to `aiwiki/` as they surface
213
+
214
+ ## I/O Contract
215
+
216
+ | Field | Value |
217
+ |---|---|
218
+ | **Requires** | Running prototype, locked wireframe, feedback file, partition plan, manifest |
219
+ | **Produces** | Code changes in `pocs/{name}-prototype/`, updated `pocs/{name}-prototype/.forge/feedback.md`, gotchas + conventions in `aiwiki/` |
220
+ | **Updates manifest** | `artifacts.prototype.{path, locked_at}` on convergence |
221
+ | **Triggers** | wiki-lint on every `aiwiki/**` write; phase-close dream when prototype locks |
222
+
223
+ ## Integration
224
+
225
+ | Caller | When |
226
+ |---|---|
227
+ | Manual `/iterate-prototype` | User-driven polish cycle |
228
+ | `/autopilot prototype` *(planned, not yet implemented)* | Stop-loop hook re-feeds the prompt; this skill runs once per cycle |
229
+ | `build-prototype` final step | After initial scaffold + first verification, hands off to iterate-prototype for refinement |
230
+
231
+ | Dispatches | For |
232
+ |---|---|
233
+ | `prototype-builder` (sequential, per partition) | Code revisions for each feedback item |
234
+ | `prototype-reviewer` (every 5 cycles or on demand) | Drift check between prototype and wireframe |
235
+
236
+ | Pairs with | For |
237
+ |---|---|
238
+ | `build-prototype` | Initial scaffold predecessor |
239
+ | `harden` | Phase 5 successor — runs once iterate-prototype emits the LOCKED signal |
240
+ | `support-gotcha` | Captures gotchas during iteration |
241
+ | `support-wiki-lint` | Validates gotcha + convention writes |