@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,297 @@
1
+ ---
2
+ name: quality-test-plan
3
+ description: "Use when implementation is complete and a comprehensive test strategy covering unit, integration, E2E, smoke, load, and contract tests is needed."
4
+ ---
5
+
6
+ # Test Plan
7
+
8
+ ## Overview
9
+
10
+ Generate a comprehensive test plan covering every test type needed for the feature. Each test maps to a requirement for full traceability.
11
+
12
+ **Core principle:** Every acceptance criterion needs a test that traces back to it.
13
+
14
+ **Announce at start:** "I'm using the quality-test-plan skill to generate the test strategy."
15
+
16
+ ## When to Use
17
+
18
+ - After implementation is complete (all TDD cycles done)
19
+ - Before running the full test execution phase
20
+ - During `/feature` and `/greenfield` commands at the test planning phase
21
+
22
+ **Not for:**
23
+ - Writing tests during implementation (that is build-tdd)
24
+ - Executing tests (that is quality-test-execution)
25
+
26
+ ## When to load references
27
+
28
+ - **`references/test-type-guide.md`** — purpose, structure, examples, and key rules for each of the six test types (unit, integration, E2E, smoke, load, contract). Load when generating any test-type section.
29
+
30
+ ## Prerequisites
31
+
32
+ Before generating a test plan, the following must exist:
33
+
34
+ 1. **Requirements** -- `.forge/work/{type}/{name}/requirements.md` (for acceptance criteria mapping)
35
+ 2. **Architecture artifacts** -- `.forge/work/{type}/{name}/architecture/` (for API contracts, DB schema)
36
+ 3. **Implementation code** -- The actual code to test (from build-tdd phase)
37
+ 4. **Existing TDD tests** -- Unit tests written during build-tdd already exist
38
+
39
+ If any are missing, stop and request them. Do not generate a test plan against imagined requirements.
40
+
41
+ ## The Test Plan Process
42
+
43
+ ### Step 1: Read Input Artifacts
44
+
45
+ Read and understand:
46
+
47
+ ```
48
+ 1. requirements.md
49
+ - All requirements and their acceptance criteria
50
+ - Priority levels (must/should/could/won't)
51
+ - User stories and their scenarios
52
+
53
+ 2. architecture/api-contract.md
54
+ - Every endpoint: method, path, request/response shapes
55
+ - Error codes and error response format
56
+ - Authentication requirements per endpoint
57
+
58
+ 3. architecture/db-schema.md
59
+ - Tables, columns, types, constraints
60
+ - Indexes, unique constraints, foreign keys
61
+ - Cascade behavior
62
+
63
+ 4. Implementation code
64
+ - All new/modified source files
65
+ - All existing TDD tests
66
+ - Entry points, routes, handlers, services
67
+
68
+ 5. Decision log
69
+ - Architecture decisions that affect test strategy
70
+ - Known limitations or accepted risks
71
+ ```
72
+
73
+ ### Step 1.5: Codex Mode Check
74
+
75
+ Now that input artifacts are read, run the Codex consent flow from `protocols/codex.md`. The selected mode applies for the rest of this skill's invocation.
76
+
77
+ - **Takeover:** Dispatch Codex with the artifacts to generate the full test plan. Claude reviews coverage and gap analysis.
78
+ - **Verify** or **Skip / Codex unavailable:** Proceed with the steps below. Step 4.5 will dispatch Codex to review Claude's test plan (Verify only).
79
+
80
+ ### Step 2: Map Requirements to Tests
81
+
82
+ Create a traceability matrix:
83
+
84
+ ```markdown
85
+ | Requirement | Acceptance Criteria | Test Type | Test ID |
86
+ |-------------|-------------------|-----------|---------|
87
+ | REQ-001: User registration | AC-001.1: Email must be valid | Unit | UT-001 |
88
+ | REQ-001: User registration | AC-001.2: Password min 8 chars | Unit | UT-002 |
89
+ | REQ-001: User registration | AC-001.3: Duplicate email rejected | Integration | IT-001 |
90
+ | REQ-001: User registration | AC-001.4: Success creates user | Integration | IT-002 |
91
+ | REQ-001: User registration | Full flow | E2E | E2E-001 |
92
+ | REQ-002: User login | AC-002.1: Valid credentials succeed | Integration | IT-003 |
93
+ | REQ-002: User login | AC-002.2: Invalid credentials fail | Integration | IT-004 |
94
+ | REQ-002: User login | Full flow | E2E | E2E-002 |
95
+ ```
96
+
97
+ **Rule:** Every acceptance criterion MUST have at least one test. If a criterion has no test, the plan is incomplete.
98
+
99
+ ### Step 2.5: Map User Journeys to E2E Scenarios
100
+
101
+ If the requirements document includes a User Journeys section, create a business flow traceability table. Every journey MUST map to an E2E test scenario. Gaps are flagged before test execution.
102
+
103
+ ```markdown
104
+ ## Business Flow Traceability
105
+
106
+ | Journey | Priority | E2E Scenario | Steps | Requirements Covered | Status |
107
+ |---|---|---|---|---|---|
108
+ | {journey name} | Must | E2E-001 | {N} steps | {FR-xxx, FR-yyy} | COVERED |
109
+ | {journey name} | Must | E2E-002 | {N} steps | {FR-xxx, FR-yyy} | COVERED |
110
+ | {journey name} | Should | — | {N} steps | {FR-xxx} | GAP |
111
+ ```
112
+
113
+ **Rule:** Every "Must" priority journey MUST have a corresponding E2E scenario. "Should" journeys without E2E scenarios are flagged as gaps but do not block.
114
+
115
+ ### Step 3: Generate Test Sections
116
+
117
+ Before generating output, check this skill's `templates/` directory and use the provided templates as the output format for each test type.
118
+
119
+ Generate a plan section for each test type below. For each, load **`references/test-type-guide.md`** to see the purpose, structure, illustrative examples, and key rules:
120
+
121
+ | Test type | Purpose | Output template |
122
+ |---|---|---|
123
+ | **Unit** | Individual functions/methods in isolation | `templates/unit-test-plan.md` |
124
+ | **Integration** | Component interactions, API endpoints, DB ops | `templates/integration-test-plan.md` |
125
+ | **E2E** | Full user flows through the UI (Playwright) | `templates/e2e-test-plan.md` |
126
+ | **Smoke** | Critical-path sanity check post-deploy | `templates/smoke-test-plan.md` |
127
+ | **Load/Stress** | Performance under realistic and peak load | `templates/load-test-plan.md` |
128
+ | **API Contract** | Frontend/backend agree on API shapes | (no separate output template — follow the example in `references/test-type-guide.md`) |
129
+
130
+ Coverage targets, key rules, traceability requirements, and per-type examples all live in `references/test-type-guide.md`.
131
+
132
+ ### Step 4: Coverage Gap Analysis
133
+
134
+ After generating all test sections, verify completeness:
135
+
136
+ ```markdown
137
+ ### Coverage Gap Analysis
138
+
139
+ | Requirement | Unit | Integration | E2E | Smoke | Contract | Status |
140
+ |-------------|------|-------------|-----|-------|----------|--------|
141
+ | REQ-001 | 3 tests | 2 tests | 1 flow | - | 1 test | COVERED |
142
+ | REQ-002 | 2 tests | 2 tests | 1 flow | 1 test | 1 test | COVERED |
143
+ | REQ-003 | 1 test | 0 tests | 0 flows | - | - | GAP |
144
+
145
+ GAPS FOUND: 1
146
+ - REQ-003 has no integration or E2E tests. Must add before plan is complete.
147
+ ```
148
+
149
+ **Rule:** No gaps allowed. Every requirement must have coverage at the appropriate test levels. If a gap exists, add the missing tests to the plan.
150
+
151
+ ### Step 4.5: Codex Verify
152
+
153
+ After gap analysis, check the mode recorded at Step 1.5. If **Verify** was selected, dispatch Codex to review the test plan for missing scenarios, edge cases, mock-vs-real blind spots, and coverage gaps. Add missing scenarios if user approves. If **Takeover** was selected, skip this step (Codex already generated the plan). If **Skip**, do nothing. Do NOT re-run the consent flow. See **Codex Integration** section below for full details.
154
+
155
+ ### Step 5: Write the Test Plan Document
156
+
157
+ Output to `.forge/work/{type}/{name}/test-plan.md` with this structure:
158
+
159
+ ```markdown
160
+ # Test Plan: {Feature Name}
161
+
162
+ ## Metadata
163
+ - **Feature:** {name}
164
+ - **Date:** {date}
165
+ - **Requirements:** {link to requirements.md}
166
+ - **Architecture:** {link to architecture/}
167
+
168
+ ## Traceability Matrix
169
+ [Full requirement-to-test mapping table]
170
+
171
+ ## Unit Tests
172
+ [All unit test specifications]
173
+
174
+ ## Integration Tests
175
+ [All integration test specifications]
176
+
177
+ ## E2E Tests
178
+ [All E2E test specifications]
179
+
180
+ ## Smoke Tests
181
+ [All smoke test specifications]
182
+
183
+ ## Load/Stress Tests
184
+ [All load test specifications, if applicable]
185
+
186
+ ## API Contract Tests
187
+ [All contract test specifications]
188
+
189
+ ## Coverage Gap Analysis
190
+ [Completeness verification]
191
+
192
+ ## Test Environment Requirements
193
+ - Database: {test database config}
194
+ - Services: {external services needed}
195
+ - Tools: {Playwright, k6, etc.}
196
+ - Data: {seed data requirements}
197
+ ```
198
+
199
+ ### Step 5.5: Critic Review of Test Plan
200
+
201
+ After writing the test plan, dispatch the **critic** subagent (Opus) to review the plan for completeness against requirements and API contracts. Provide the critic with the test plan, requirements document, and architecture artifacts.
202
+
203
+ If the critic identifies coverage gaps or missing scenarios, address them before presenting the plan to the user.
204
+
205
+ ## Common Mistakes
206
+
207
+ | Mistake | Fix |
208
+ |---------|-----|
209
+ | Skipping E2E for "simple" features | No feature is too simple. E2E catches integration issues. |
210
+ | Only testing happy paths | Every error code, every validation failure, every edge case. |
211
+ | No traceability | Every test must link to a requirement. No orphan tests. |
212
+ | Vague test descriptions | Specify exact inputs, exact expected outputs. |
213
+ | Missing error scenarios | For every success scenario, there is at least one error scenario. |
214
+ | No load test thresholds | "Should be fast" is not a threshold. Specify numbers. |
215
+ | Ignoring existing TDD tests | TDD tests are part of the plan. Include them in the traceability matrix. |
216
+ | Tests that depend on each other | Each test must be independent. No ordering requirements. |
217
+
218
+ ## Red Flags
219
+
220
+ **Never:**
221
+ - Generate a test plan without reading requirements first
222
+ - Skip any test type without explicit project profile justification
223
+ - Leave gaps in the traceability matrix
224
+ - Use vague descriptions ("test that it works")
225
+ - Assume existing TDD tests cover everything
226
+ - Generate load tests for projects that do not need them (check project profile)
227
+
228
+ **Always:**
229
+ - Read requirements, architecture, and implementation before planning
230
+ - Map every acceptance criterion to at least one test
231
+ - Include both happy and error paths for every scenario
232
+ - Specify exact inputs and expected outputs
233
+ - Verify completeness with gap analysis
234
+ - Output to `.forge/work/{type}/{name}/test-plan.md`
235
+
236
+ ## I/O Contract
237
+
238
+ | Field | Value |
239
+ |---|---|
240
+ | **Requires** | Implementation code (from `build-tdd`), architecture artifacts (`.forge/work/{type}/{name}/architecture/`), requirements (`.forge/work/{type}/{name}/requirements.md`) |
241
+ | **Produces** | `.forge/work/{type}/{name}/test-plan.md` |
242
+ | **Feeds into** | `quality-test-execution` (test plan drives execution) |
243
+ | **Updates manifest** | `artifacts.test-plan: test-plan.md` |
244
+
245
+ ## Graphify Context
246
+
247
+ **Protocol:** `protocols/graphify.md` | **Guard:** Run the status check from the protocol before Step 1.
248
+
249
+ Graph data directly informs test prioritization — god nodes need the most integration tests, and community boundaries reveal integration gaps.
250
+
251
+ **How graph data maps to this skill:**
252
+ - **God nodes (highest-degree)** → components with most connections need the most integration tests
253
+ - **Community boundaries** → cross-community edges are integration test priorities
254
+ - **INFERRED edges** → relationships worth validating with contract tests
255
+
256
+ **CLI queries** (if graph exists and CLI available):
257
+ - `graphify query "what are the most connected components" --budget 1000 --graph graphify-out/graph.json` — identify integration test priorities
258
+
259
+ **Codex bridge:** Pass graph-informed test priorities to the Codex verify step below.
260
+
261
+ ---
262
+
263
+ ## Codex Integration
264
+ **Modes:** Verify or Takeover | **Protocol:** `protocols/codex.md`
265
+
266
+ - **Verify:** Claude generates the test plan, Codex reviews for gaps.
267
+ - **Takeover:** Codex generates the test plan, Claude reviews coverage.
268
+
269
+ **When:** After Claude generates the test plan, before user approval.
270
+
271
+ **Context to pass:**
272
+ - Path to `test-plan.md`
273
+ - Path to `architecture/api-contract.md`
274
+ - Path to `requirements.md`
275
+
276
+ **What Codex reviews:**
277
+ - Missing test scenarios (edge cases, error paths, boundary conditions)
278
+ - Mock-vs-real blind spots (tests that mock away the thing they should test)
279
+ - Coverage gaps against requirements (must-haves without corresponding tests)
280
+
281
+ **Prompt focus:** "Review this test plan against the requirements and architecture. For each test scenario, assess: does this test the real behavior or just a mock? What edge cases are missing? What requirements have no corresponding test?"
282
+
283
+ **Presentation:** Codex findings merged into the test plan review. Missing scenarios added to the plan if user approves.
284
+
285
+ ---
286
+
287
+ ## Integration
288
+
289
+ **Called by:**
290
+ - `/feature` command (after implementation loop)
291
+ - `/greenfield` command (after implementation loop)
292
+
293
+ **Pairs with:**
294
+ - `build-tdd` (existing unit tests become part of the plan)
295
+ - `quality-test-execution` (executes every test in this plan)
296
+ - `plan-architecture` (API contracts and DB schema inform integration/contract tests)
297
+ - `discover-requirements` (acceptance criteria drive the traceability matrix)
@@ -0,0 +1,263 @@
1
+ # Test-type guide
2
+
3
+ Per-test-type purpose, structure, illustrative examples, and key rules. Load this when generating any of the six test-type sections in the test plan.
4
+
5
+ For each test type below, the **Structure** block shows the markdown shape of the plan entry. The corresponding output template in `templates/{type}-test-plan.md` (if present) is the authoritative output format — the structure here is illustrative.
6
+
7
+ ---
8
+
9
+ ## Unit Tests
10
+
11
+ Use the template from `templates/unit-test-plan.md` as the output format.
12
+
13
+ **Purpose:** Test individual functions and methods in isolation.
14
+
15
+ **Coverage targets:**
16
+ - 80% minimum overall coverage
17
+ - 100% for critical paths (auth, payments, data validation)
18
+ - All error paths tested
19
+ - All edge cases tested (null, empty, boundary values, overflow)
20
+
21
+ **What to include:**
22
+
23
+ ```markdown
24
+ ### Unit Tests
25
+
26
+ #### UT-001: Email validation accepts valid emails
27
+ - **File:** tests/unit/auth/validation.test.ts
28
+ - **Function under test:** validateEmail()
29
+ - **Scenarios:**
30
+ - Valid standard email: user@example.com -> true
31
+ - Valid with subdomain: user@sub.example.com -> true
32
+ - Invalid missing @: userexample.com -> false
33
+ - Invalid missing domain: user@ -> false
34
+ - Empty string: "" -> false
35
+ - Null input: null -> false
36
+ - **Traces to:** REQ-001, AC-001.1
37
+
38
+ #### UT-002: Password validation enforces minimum length
39
+ - **File:** tests/unit/auth/validation.test.ts
40
+ - **Function under test:** validatePassword()
41
+ - **Scenarios:**
42
+ - Valid 8 chars: "abcd1234" -> true
43
+ - Invalid 7 chars: "abcd123" -> false
44
+ - Empty string: "" -> false
45
+ - Exactly 8 chars boundary: "12345678" -> true
46
+ - **Traces to:** REQ-001, AC-001.2
47
+ ```
48
+
49
+ **Key rules for unit tests:**
50
+ - One behavior per test (if name has "and", split it)
51
+ - Test behavior, not implementation
52
+ - Real code preferred over mocks
53
+ - Edge cases: null, undefined, empty, boundary, overflow, special characters
54
+
55
+ ---
56
+
57
+ ## Integration Tests
58
+
59
+ Use the template from `templates/integration-test-plan.md` as the output format.
60
+
61
+ **Purpose:** Test component interactions, API endpoints, database operations.
62
+
63
+ **What to include:**
64
+
65
+ ```markdown
66
+ ### Integration Tests
67
+
68
+ #### IT-001: POST /api/users rejects duplicate email
69
+ - **File:** tests/integration/auth/registration.test.ts
70
+ - **Components:** UserController -> UserService -> UserRepository -> Database
71
+ - **Setup:** Create existing user with email "test@example.com"
72
+ - **Action:** POST /api/users { email: "test@example.com", password: "valid123" }
73
+ - **Expected:** 409 Conflict, { error: { code: "EMAIL_EXISTS" } }
74
+ - **Cleanup:** Remove test users
75
+ - **Traces to:** REQ-001, AC-001.3
76
+ - **API contract ref:** api-contract.md, POST /api/users, error codes
77
+
78
+ #### IT-002: POST /api/users creates user successfully
79
+ - **File:** tests/integration/auth/registration.test.ts
80
+ - **Components:** UserController -> UserService -> UserRepository -> Database
81
+ - **Setup:** Clean database
82
+ - **Action:** POST /api/users { email: "new@example.com", password: "valid123", name: "Test" }
83
+ - **Expected:** 201 Created, { id: string, email: "new@example.com", name: "Test", createdAt: string }
84
+ - **Verify:** User exists in database with hashed password
85
+ - **Cleanup:** Remove test users
86
+ - **Traces to:** REQ-001, AC-001.4
87
+ - **API contract ref:** api-contract.md, POST /api/users, success response
88
+ ```
89
+
90
+ **Key rules for integration tests:**
91
+ - Test against real database (use test database, not mocks)
92
+ - Validate against API contract shapes exactly
93
+ - Test both success and error paths per endpoint
94
+ - Clean up test data (use transactions or explicit cleanup)
95
+ - Test database constraints (unique, NOT NULL, foreign keys)
96
+
97
+ ---
98
+
99
+ ## E2E Tests
100
+
101
+ Use the template from `templates/e2e-test-plan.md` as the output format.
102
+
103
+ **Purpose:** Test complete user flows through the UI using Playwright.
104
+
105
+ **What to include:**
106
+
107
+ ```markdown
108
+ ### E2E Tests (Playwright)
109
+
110
+ #### E2E-001: User registration flow
111
+ - **File:** tests/e2e/auth/registration.spec.ts
112
+ - **Preconditions:** Application running, database clean
113
+ - **Steps:**
114
+ 1. Navigate to /register
115
+ 2. Fill in email: "e2e-test@example.com"
116
+ 3. Fill in password: "ValidPass123"
117
+ 4. Fill in name: "E2E Test User"
118
+ 5. Click "Create Account" button
119
+ 6. Wait for redirect to /dashboard
120
+ - **Expected results:**
121
+ - Registration form accepts input
122
+ - Loading state shown during submission
123
+ - Redirected to /dashboard after success
124
+ - Welcome message displays user name
125
+ - User can log out and log back in with same credentials
126
+ - **Error scenarios:**
127
+ - Submit with empty email -> validation error shown inline
128
+ - Submit with short password -> validation error shown inline
129
+ - Submit with duplicate email -> error message shown
130
+ - **Traces to:** REQ-001
131
+ - **Screenshots:** Capture at each step for visual regression
132
+ ```
133
+
134
+ **Key rules for E2E tests:**
135
+ - Test complete user journeys, not individual components
136
+ - Include both happy path and error scenarios
137
+ - Test loading states, error states, empty states
138
+ - No skipping "obvious" flows (login, logout, navigation)
139
+ - Use realistic test data, not "test" and "12345"
140
+ - Capture screenshots for visual verification
141
+
142
+ ---
143
+
144
+ ## Smoke Tests
145
+
146
+ Use the template from `templates/smoke-test-plan.md` as the output format.
147
+
148
+ **Purpose:** Quick sanity check that critical paths work after deployment.
149
+
150
+ **What to include:**
151
+
152
+ ```markdown
153
+ ### Smoke Tests
154
+
155
+ #### SMOKE-001: Application starts and responds
156
+ - **Check:** GET /health returns 200
157
+ - **Timeout:** 5 seconds
158
+ - **Traces to:** Infrastructure
159
+
160
+ #### SMOKE-002: Authentication works
161
+ - **Check:** POST /api/auth/login with valid credentials returns 200 + token
162
+ - **Timeout:** 10 seconds
163
+ - **Traces to:** REQ-002
164
+
165
+ #### SMOKE-003: Core API responds
166
+ - **Check:** GET /api/users (authenticated) returns 200
167
+ - **Timeout:** 10 seconds
168
+ - **Traces to:** REQ-003
169
+
170
+ #### SMOKE-004: Database connected
171
+ - **Check:** Any database query succeeds
172
+ - **Timeout:** 5 seconds
173
+ - **Traces to:** Infrastructure
174
+ ```
175
+
176
+ **Key rules for smoke tests:**
177
+ - Only critical paths (not comprehensive)
178
+ - Fast execution (under 60 seconds total)
179
+ - Run after every deployment
180
+ - Binary pass/fail (no partial success)
181
+
182
+ ---
183
+
184
+ ## Load/Stress Tests
185
+
186
+ Use the template from `templates/load-test-plan.md` as the output format.
187
+
188
+ **Purpose:** Verify performance under realistic and peak load.
189
+
190
+ **What to include:**
191
+
192
+ ```markdown
193
+ ### Load/Stress Tests
194
+
195
+ #### LOAD-001: Registration endpoint under load
196
+ - **Tool:** k6 / artillery
197
+ - **Endpoint:** POST /api/users
198
+ - **Scenarios:**
199
+ - Normal load: 50 concurrent users, 5 min duration
200
+ - Peak load: 200 concurrent users, 2 min duration
201
+ - Stress: Ramp to 500 concurrent users, find breaking point
202
+ - **Thresholds:**
203
+ - p95 response time < 500ms under normal load
204
+ - p99 response time < 2000ms under peak load
205
+ - Error rate < 1% under normal load
206
+ - Error rate < 5% under peak load
207
+ - **Traces to:** NFR-001 (performance requirements)
208
+
209
+ #### LOAD-002: Authentication endpoint under load
210
+ - **Tool:** k6 / artillery
211
+ - **Endpoint:** POST /api/auth/login
212
+ - **Scenarios:**
213
+ - Normal load: 100 concurrent users, 5 min duration
214
+ - Peak load: 500 concurrent users, 2 min duration
215
+ - **Thresholds:**
216
+ - p95 response time < 200ms under normal load
217
+ - Error rate < 0.1% under normal load
218
+ - **Traces to:** NFR-001
219
+ ```
220
+
221
+ **Key rules for load tests:**
222
+ - Define specific thresholds (not "should be fast")
223
+ - Test against realistic data volumes
224
+ - Include ramp-up period
225
+ - Test the most-called endpoints
226
+ - Only include if project profile indicates load testing is relevant
227
+
228
+ ---
229
+
230
+ ## API Contract Tests
231
+
232
+ **Purpose:** Verify frontend and backend agree on API shapes.
233
+
234
+ **What to include:**
235
+
236
+ ```markdown
237
+ ### API Contract Tests
238
+
239
+ #### CONTRACT-001: POST /api/users request/response shape
240
+ - **File:** tests/contract/auth/users.contract.test.ts
241
+ - **Contract source:** api-contract.md
242
+ - **Validates:**
243
+ - Request body schema matches contract (required fields, types)
244
+ - Success response (201) body schema matches contract
245
+ - Error response (400) body schema matches contract
246
+ - Error response (409) body schema matches contract
247
+ - **Traces to:** api-contract.md, POST /api/users
248
+
249
+ #### CONTRACT-002: GET /api/users/:id response shape
250
+ - **File:** tests/contract/auth/users.contract.test.ts
251
+ - **Contract source:** api-contract.md
252
+ - **Validates:**
253
+ - Response (200) body schema matches contract
254
+ - Response (404) body schema matches contract
255
+ - All fields present with correct types
256
+ - **Traces to:** api-contract.md, GET /api/users/:id
257
+ ```
258
+
259
+ **Key rules for contract tests:**
260
+ - Validate exact shapes (field names, types, required vs optional)
261
+ - Test all status codes defined in the contract
262
+ - Run on both frontend and backend independently
263
+ - Fail if contract changes without corresponding code change
@@ -0,0 +1,72 @@
1
+ # E2E Test Plan
2
+
3
+ ## User Flow: {flow_name}
4
+
5
+ ### Description
6
+ {What user journey this flow tests. One sentence.}
7
+
8
+ ### Preconditions
9
+ - {User is logged in as: role}
10
+ - {Database contains: specific test data}
11
+ - {Feature flag: enabled/disabled}
12
+ - {Browser: chromium / firefox / webkit}
13
+
14
+ ### Steps
15
+
16
+ | # | Action | Expected Result | Assertion |
17
+ |---|--------|----------------|-----------|
18
+ | 1 | Navigate to {URL} | Page loads with {element} visible | `expect(page.locator('{selector}')).toBeVisible()` |
19
+ | 2 | Fill {field} with "{value}" | Field accepts input | `expect(input).toHaveValue('{value}')` |
20
+ | 3 | Click "{button text}" | {Loading state appears, then result} | `expect(page.locator('{selector}')).toContainText('{text}')` |
21
+ | 4 | Wait for {condition} | {Expected state after async operation} | `expect(response.status()).toBe(200)` |
22
+ | 5 | Verify {final state} | {Page shows expected content} | `expect(page.locator('{selector}')).toBeVisible()` |
23
+
24
+ ### Screenshots/Visual Assertions
25
+ - Capture screenshot after step {N}: {what it should look like}
26
+ - Capture screenshot on failure: {automatic}
27
+
28
+ ### Error Flow Variant: {variant_name}
29
+ | # | Action | Expected Result | Assertion |
30
+ |---|--------|----------------|-----------|
31
+ | 1 | {Same setup as happy path} | | |
32
+ | 2 | Fill {field} with "{invalid value}" | | |
33
+ | 3 | Click "{button text}" | Error message: "{expected error}" | `expect(page.locator('.error')).toContainText('{message}')` |
34
+
35
+ ### Cleanup
36
+ - {Delete test user/data created during the flow}
37
+ - {Reset application state}
38
+
39
+ ---
40
+
41
+ ## User Flow: {next_flow_name}
42
+
43
+ ### Description
44
+ {What this flow tests.}
45
+
46
+ ### Preconditions
47
+ - {list}
48
+
49
+ ### Steps
50
+
51
+ | # | Action | Expected Result | Assertion |
52
+ |---|--------|----------------|-----------|
53
+ | 1 | {action} | {result} | {assertion} |
54
+
55
+ ### Cleanup
56
+ - {cleanup steps}
57
+
58
+ ---
59
+
60
+ ## Flow Summary
61
+
62
+ | Flow | Steps | Variants | Priority | Requirement |
63
+ |------|-------|----------|----------|-------------|
64
+ | {flow name} | {count} | {count} | Critical / High / Medium | {FR-XXX} |
65
+ | {flow name} | {count} | {count} | Critical / High / Medium | {FR-XXX} |
66
+
67
+ ## Browser Matrix
68
+
69
+ | Flow | Chromium | Firefox | WebKit |
70
+ |------|---------|---------|--------|
71
+ | {flow} | Required | Required | Optional |
72
+ | {flow} | Required | Optional | Optional |