@groupby/ai-dev 0.5.10 → 0.5.11

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 (61) hide show
  1. package/package.json +1 -1
  2. package/teams/fhr-neowise/commands/address-pr.md +120 -0
  3. package/teams/fhr-neowise/commands/ready-pr.md +70 -0
  4. package/teams/fhr-neowise/commands/review-pr.md +111 -0
  5. package/teams/fhr-neowise/commands/tdd-implementation.md +86 -0
  6. package/teams/fhr-neowise/commands/write-plan.md +23 -0
  7. package/teams/fhr-neowise/commands/write-pr.md +21 -0
  8. package/teams/fhr-neowise/commands/write-spec.md +25 -0
  9. package/teams/fhr-neowise/skills/agent-routing/SKILL.md +72 -0
  10. package/teams/fhr-neowise/skills/code-review/SKILL.md +83 -0
  11. package/teams/fhr-neowise/skills/code-review/review-template.md +90 -0
  12. package/teams/fhr-neowise/skills/mermaid-diagram/SKILL.md +94 -0
  13. package/teams/fhr-neowise/skills/mermaid-diagram/references/BEST_PRACTICES.md +96 -0
  14. package/teams/fhr-neowise/skills/mermaid-diagram/references/architecture.md +434 -0
  15. package/teams/fhr-neowise/skills/mermaid-diagram/references/block.md +753 -0
  16. package/teams/fhr-neowise/skills/mermaid-diagram/references/c4.md +619 -0
  17. package/teams/fhr-neowise/skills/mermaid-diagram/references/classDiagram.md +1186 -0
  18. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-configuration.md +72 -0
  19. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-directives.md +342 -0
  20. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-layouts.md +40 -0
  21. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-math.md +96 -0
  22. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-theming.md +246 -0
  23. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-tidy-tree.md +89 -0
  24. package/teams/fhr-neowise/skills/mermaid-diagram/references/cynefin.md +279 -0
  25. package/teams/fhr-neowise/skills/mermaid-diagram/references/entityRelationshipDiagram.md +670 -0
  26. package/teams/fhr-neowise/skills/mermaid-diagram/references/eventmodeling.md +475 -0
  27. package/teams/fhr-neowise/skills/mermaid-diagram/references/examples.md +301 -0
  28. package/teams/fhr-neowise/skills/mermaid-diagram/references/flowchart.md +2116 -0
  29. package/teams/fhr-neowise/skills/mermaid-diagram/references/gantt.md +725 -0
  30. package/teams/fhr-neowise/skills/mermaid-diagram/references/gitgraph.md +2138 -0
  31. package/teams/fhr-neowise/skills/mermaid-diagram/references/ishikawa.md +66 -0
  32. package/teams/fhr-neowise/skills/mermaid-diagram/references/kanban.md +161 -0
  33. package/teams/fhr-neowise/skills/mermaid-diagram/references/mindmap.md +335 -0
  34. package/teams/fhr-neowise/skills/mermaid-diagram/references/packet.md +153 -0
  35. package/teams/fhr-neowise/skills/mermaid-diagram/references/pie.md +93 -0
  36. package/teams/fhr-neowise/skills/mermaid-diagram/references/quadrantChart.md +267 -0
  37. package/teams/fhr-neowise/skills/mermaid-diagram/references/radar.md +269 -0
  38. package/teams/fhr-neowise/skills/mermaid-diagram/references/railroad.md +337 -0
  39. package/teams/fhr-neowise/skills/mermaid-diagram/references/requirementDiagram.md +495 -0
  40. package/teams/fhr-neowise/skills/mermaid-diagram/references/sankey.md +415 -0
  41. package/teams/fhr-neowise/skills/mermaid-diagram/references/sequenceDiagram.md +1195 -0
  42. package/teams/fhr-neowise/skills/mermaid-diagram/references/stateDiagram.md +670 -0
  43. package/teams/fhr-neowise/skills/mermaid-diagram/references/timeline.md +571 -0
  44. package/teams/fhr-neowise/skills/mermaid-diagram/references/treeView.md +321 -0
  45. package/teams/fhr-neowise/skills/mermaid-diagram/references/treemap.md +353 -0
  46. package/teams/fhr-neowise/skills/mermaid-diagram/references/userJourney.md +42 -0
  47. package/teams/fhr-neowise/skills/mermaid-diagram/references/venn.md +134 -0
  48. package/teams/fhr-neowise/skills/mermaid-diagram/references/wardley.md +732 -0
  49. package/teams/fhr-neowise/skills/mermaid-diagram/references/xyChart.md +312 -0
  50. package/teams/fhr-neowise/skills/mermaid-diagram/references/zenuml.md +474 -0
  51. package/teams/fhr-neowise/skills/mermaid-diagram/scripts/sync_docs.py +138 -0
  52. package/teams/fhr-neowise/skills/pull-request-authoring/COMPLEX.template.md +52 -0
  53. package/teams/fhr-neowise/skills/pull-request-authoring/NON-CODE.template.md +15 -0
  54. package/teams/fhr-neowise/skills/pull-request-authoring/SIMPLE.template.md +20 -0
  55. package/teams/fhr-neowise/skills/pull-request-authoring/SKILL.md +102 -0
  56. package/teams/fhr-neowise/skills/spec-investigation/SKILL.md +139 -0
  57. package/teams/fhr-neowise/skills/spec-investigation/TEMPLATE.spec.md +74 -0
  58. package/teams/fhr-neowise/skills/tdd-workflow/SKILL.md +137 -0
  59. package/teams/fhr-neowise/skills/write-plan/SKILL.md +285 -0
  60. package/teams/fhr-neowise/skills/write-plan/assets/TEMPLATE.checklist.json +79 -0
  61. package/teams/fhr-neowise/skills/write-plan/assets/TEMPLATE.plan.md +158 -0
@@ -0,0 +1,285 @@
1
+ ---
2
+ name: write-plan
3
+ description: "Use when: writing a development plan, creating a PLAN.md and CHECKLIST.json, breaking a spec into implementation steps, generating a TDD checklist, planning test scenarios, producing Gherkin scenarios from a spec, preparing a coding roadmap from a spec file."
4
+ argument-hint: "Provide the path to the SPEC.md file to plan from..."
5
+ context: fork
6
+
7
+ ---
8
+
9
+ # Write Plan
10
+
11
+ Read a completed spec file and produce an executable development plan (PLAN.md) and a companion checklist (CHECKLIST.json) that an AI coding agent can follow step-by-step using TDD.
12
+
13
+ **Do NOT write any production code or test code.** Analyze the spec, research the codebase, and write the plan only.
14
+
15
+ ## Input
16
+
17
+ The user must provide the path to a SPEC.md file. If no spec file is provided, ask for it immediately before doing anything else. Do not search the workspace for spec files; the user chooses which spec to plan.
18
+
19
+ The spec file must follow the `.sprints/<sprint-name>/<ticket-number>/SPEC.md` convention. If the provided path does not match, ask the user to confirm the path before proceeding.
20
+
21
+ ## Templates
22
+
23
+ Read the bundled templates before writing:
24
+ 1. [TEMPLATE.plan.md](./assets/TEMPLATE.plan.md) — structure for PLAN.md
25
+ 2. [TEMPLATE.checklist.json](./assets/TEMPLATE.checklist.json) — structure for CHECKLIST.json
26
+
27
+ ## Output Location
28
+
29
+ Write both files next to the SPEC.md in the same directory:
30
+ - `.sprints/<sprint-name>/<ticket-number>/PLAN.md`
31
+ - `.sprints/<sprint-name>/<ticket-number>/CHECKLIST.json`
32
+
33
+ Also copy the helper script next to the checklist:
34
+ - `.sprints/<sprint-name>/<ticket-number>/checklist.mjs` — copied from `./assets/checklist.mjs`
35
+
36
+ The agent reads and modifies CHECKLIST.json directly using the Read and Edit tools. The `checklist.mjs` script is available for shell/CI use:
37
+ - `node checklist.mjs --get-next` — prints the next incomplete step as JSON
38
+ - `node checklist.mjs --complete-step <step-id>` — sets `completed: true` on the given step
39
+
40
+ Do not create any other files unless the user explicitly requests them.
41
+
42
+ ## Investigation Process
43
+
44
+ **Step summary:** Read spec → Understand affected code → Map dependencies between changes → Sequence into phases → Write test scenarios → Produce plan → Produce checklist → Validate → Request approval → Ask whether to commit generated files.
45
+
46
+ > Agent note: CHECKLIST.json is a structured JSON file — read and modify it directly with Read/Edit tools. Each step has an `id`, `description`, `verify`, and `completed` field. Set `"completed": true` to mark a step done.
47
+
48
+ Work through all ten steps in order. Do not skip steps.
49
+
50
+ ### Step 1 — Read and internalize the spec
51
+
52
+ Read the SPEC.md file completely. Extract:
53
+ - **Objective and success criteria** — what "done" looks like
54
+ - **Agent and module** — which agent handles implementation, which modules are in scope
55
+ - **Files to read, modify, and create** — the full file inventory from the Context section
56
+ - **Functional requirements** — every given/when/then requirement
57
+ - **Technical constraints** — architecture patterns, security, performance
58
+ - **Acceptance criteria** — the verifiable outcomes
59
+ - **Assumptions and open questions** — anything that blocks planning
60
+
61
+ If the spec has unresolved open questions that would change the plan structure, stop and ask the user to resolve them before proceeding.
62
+
63
+ ### Step 2 — Understand the affected code
64
+
65
+ For every file listed in the spec's Context section:
66
+ - Read the file and understand its current structure, public API, and test coverage.
67
+ - Identify the exact methods, classes, or components that need to change.
68
+ - Identify existing tests that cover the affected code.
69
+ - Identify existing patterns (naming conventions, architecture style, test style) that the plan must follow.
70
+
71
+ For each module in scope, identify:
72
+ - The test framework and runner (JUnit, Spock, Jest, etc.)
73
+ - The test command (e.g., `./gradlew :module:test`, `npm test`)
74
+ - The integration test command if applicable
75
+ - The directory structure for tests (unit vs integration)
76
+
77
+ ### Step 3 — Map dependencies between changes
78
+
79
+ Build a dependency graph of the changes:
80
+ - Which changes can proceed independently (parallel)?
81
+ - Which changes require another change to exist first (sequential)?
82
+ - Which tests require which production code to compile?
83
+
84
+ Group changes into phases where each phase is internally independent but depends on all previous phases being complete.
85
+
86
+ **Ordering rules:**
87
+ 1. Library modules before service modules that consume them.
88
+ 2. Data models and types before business logic that uses them.
89
+ 3. Lower-level utilities before higher-level orchestrators.
90
+ 4. Production code and its unit tests together in the same step.
91
+ 5. Integration tests after all production code they exercise is complete.
92
+
93
+ ### Step 4 — Sequence into implementation steps
94
+
95
+ Break each phase into atomic implementation steps. Each step must:
96
+ - Touch exactly one class, method, or component (single responsibility).
97
+ - Be completable in a single coding pass — a developer should reach a GREEN test run within one focused session.
98
+ - Have a clearly defined "done" state that can be verified by running a specific test command.
99
+ - Follow the double-loop TDD cycle (see TDD Methodology below).
100
+
101
+ For each step, specify:
102
+ 1. **What to do** — the exact change with specific method signatures, class names, field names, and return types. Not "implement the method" but "add `public Optional<Report> findById(String id)` to `ReportRepository`".
103
+ 2. **Where** — the exact file path and location within the file.
104
+ 3. **Why** — which spec requirement this satisfies.
105
+ 4. **Test first** — the test(s) to write before the production code.
106
+ 5. **Verify** — the exact command to run to confirm the step is done.
107
+
108
+ **No placeholders.** These are plan failures — never write them:
109
+ - "TBD", "TODO", "implement later", "handle edge cases"
110
+ - "Add appropriate error handling" / "add validation"
111
+ - "Write tests for the above" (without naming the specific scenarios)
112
+ - "Similar to Step N" (repeat the information — the executing agent may only see this step)
113
+ - Vague verbs with no specifics ("implement the logic", "update the service")
114
+
115
+ ### Step 5 — Write test scenarios
116
+
117
+ For every functional requirement and acceptance criterion in the spec, produce Gherkin-style test scenarios.
118
+
119
+ **Coverage rules:**
120
+ - At least one scenario per requirement (happy path).
121
+ - At least one scenario per error/edge case mentioned in the spec.
122
+ - At least one scenario per branch in any conditional logic implied by the spec.
123
+ - At least one scenario for boundary values (nulls, empty collections, min/max ranges).
124
+ - At least one negative scenario per requirement (what should NOT happen).
125
+ - Group scenarios by the class or component they test.
126
+
127
+ **Scenario format:**
128
+ ```gherkin
129
+ Feature: [Component or class name]
130
+
131
+ Scenario: [Descriptive name explaining what is being tested]
132
+ Given [precondition - specific setup state]
133
+ And [additional precondition if needed]
134
+ When [action - the method call or user interaction]
135
+ Then [expected outcome - specific and verifiable]
136
+ And [additional assertion if needed]
137
+ ```
138
+
139
+ Map each scenario to:
140
+ - The implementation step that should make it pass.
141
+ - The test file where it should be written.
142
+ - Whether it is a unit test or integration test.
143
+
144
+ ### Step 6 — Produce the plan (PLAN.md)
145
+
146
+ Write PLAN.md using the template structure. Rules:
147
+ - **Be concrete**: Exact file paths, method signatures, class names, and types. No vague descriptions.
148
+ - **TDD flow**: Every step starts with writing a failing test, then the production code, then verification.
149
+ - **Traceability**: Every step links back to a spec requirement or acceptance criterion.
150
+ - **Completeness**: Every requirement in the spec must be covered by at least one step.
151
+ - **No gaps**: A developer following the plan step-by-step should never need to make a decision not covered by the plan.
152
+
153
+ Include the TDD methodology reference section in the plan (see below).
154
+
155
+ ### Step 7 — Produce the checklist (CHECKLIST.json)
156
+
157
+ Write CHECKLIST.json as a structured JSON file derived from the plan steps. Rules:
158
+ - One entry per implementation step, matching the plan 1:1.
159
+ - Each step has: `id` (e.g. `"1.1"`), `description`, `verify` (exact test command or `null`), `completed: false`.
160
+ - Group steps under phases. Each phase has `id` (integer), `title`, and `steps` array.
161
+ - Include a `finalValidation` array for final validation items (id prefix `"final."`).
162
+ - Use the `TEMPLATE.checklist.json` structure exactly.
163
+ - Also copy `checklist.mjs` from assets next to the checklist file.
164
+
165
+ ### Step 8 — Validate the plan
166
+
167
+ **Gap check first.** Re-read the spec from the top. For every requirement in Section 4 and every criterion in Section 7, point to the specific step(s) in the plan that implement it. List any requirement or criterion with no matching step — these are gaps, not optional. Add missing steps before continuing.
168
+
169
+ Then verify the structural checklist:
170
+ - [ ] PLAN.md is saved next to the SPEC.md
171
+ - [ ] CHECKLIST.json is saved next to the SPEC.md
172
+ - [ ] Every spec requirement has at least one implementation step (confirmed by gap check above)
173
+ - [ ] Every implementation step has at least one test scenario
174
+ - [ ] Every acceptance criterion is covered by at least one test scenario
175
+ - [ ] Phase ordering respects the dependency graph (no forward references)
176
+ - [ ] Each step specifies the exact file path, specific method/class/type names, and the verification command
177
+ - [ ] No step uses placeholder language (TBD, "implement the logic", "add validation", "similar to Step N")
178
+ - [ ] No step requires a decision not already made in the spec or plan
179
+ - [ ] Gherkin scenarios cover happy path, edge cases, boundary values, and negative cases
180
+ - [ ] The checklist matches the plan steps 1:1
181
+
182
+ Fix any failing items before presenting the output.
183
+
184
+ ### Step 9 — Request approval or corrections
185
+
186
+ After Step 8 succeeds, present the generated plan artifacts to the developer and call
187
+ `#tool:vscode/askQuestions` using the question shape below to ask them to either approve
188
+ the artifacts or provide corrections. Do not ask about commit yet.
189
+
190
+ Requirements:
191
+ - Ask for approval before any commit question appears.
192
+ - Offer two explicit options: `Approve` and `Request corrections`.
193
+ - If the developer selects `Request corrections`, collect the requested changes, amend
194
+ `PLAN.md` and `CHECKLIST.json`, re-run Step 8, then return to this approval step.
195
+ - Repeat the correction cycle until the developer gives explicit approval.
196
+ - If the developer's feedback is ambiguous and could be read as either approval or a change
197
+ request, ask a clarifying question instead of assuming approval.
198
+
199
+ Question shape (substitute the actual sprint name and ticket number from the spec path before presenting):
200
+ ```text
201
+ header: approveGeneratedPlan
202
+ question: Approve the generated plan files, or request corrections?
203
+ message: Review `.sprints/<actual-sprint-name>/<actual-ticket-number>/PLAN.md` and `.sprints/<actual-sprint-name>/<actual-ticket-number>/CHECKLIST.json` and choose whether they are ready.
204
+ options:
205
+ - Approve
206
+ - Request corrections
207
+ ```
208
+
209
+ Correction behavior:
210
+ - When corrections are requested, update only the generated files from this skill run.
211
+ - Re-run validation after each correction cycle before asking for approval again.
212
+ - Do not offer commit until the developer explicitly selects `Approve`.
213
+
214
+ ### Step 10 — Ask whether to commit the generated files, then hand off to execution
215
+
216
+ After Step 9 succeeds with explicit approval, call `#tool:vscode/askQuestions` and ask the user whether to commit or skip the generated files from this skill run.
217
+
218
+ Requirements:
219
+ - Ask exactly once at the end of the workflow, after `PLAN.md` and `CHECKLIST.json` have been written, validated, and explicitly approved.
220
+ - The question must offer two explicit options: `Commit` and `Skip commit`.
221
+ - The prompt must mention the generated file paths that would be included.
222
+ - If the user chooses `Commit`, stage only the files generated by this skill run, not unrelated workspace changes.
223
+ - If the user chooses `Skip commit`, do not stage or commit anything.
224
+
225
+ Question shape:
226
+ ```text
227
+ header: commitGeneratedFiles
228
+ question: Commit the generated plan files now?
229
+ message: This will commit the files created by this skill run only.
230
+ options:
231
+ - Commit
232
+ - Skip commit
233
+ ```
234
+
235
+ Commit behavior:
236
+ - Commit only the generated files, typically `.sprints/<sprint-name>/<ticket-number>/PLAN.md`, `CHECKLIST.json`, and `checklist.mjs`.
237
+ - Use a commit message in this format: `<ticket-number>: add <FILE> for <feature>`
238
+ - When all files are committed together: `<ticket-number>: add PLAN.md, CHECKLIST.json, and checklist.mjs for <feature>`.
239
+ - If the repository requires signing, respect the existing git configuration and surface any git error to the user instead of retrying with a weaker flow.
240
+
241
+ After the commit question is resolved (whether committed or skipped), display this handoff message:
242
+
243
+ > **Plan ready.** To begin implementation:
244
+ > ```
245
+ > /tdd-implementation ticket=.sprints/<sprint-name>/<ticket-number>
246
+ > ```
247
+
248
+ ## TDD Methodology
249
+
250
+ Include this section verbatim in every generated PLAN.md:
251
+
252
+ ### Double-Loop TDD
253
+
254
+ ```
255
+ Outer Loop (Integration / Acceptance) Inner Loop (Unit)
256
+ ┌─────────────────────────────────┐ ┌──────────────────────┐
257
+ │ 1. Write a failing integration │ │ 1. Write a failing │
258
+ │ test (RED) │ │ unit test (RED) │
259
+ │ │ │ │
260
+ │ 2. Enter inner loop ───────────────────────► │ 2. Write minimal │
261
+ │ │ │ code (GREEN) │
262
+ │ │ │ │
263
+ │ │ ◄──────── │ 3. Refactor (CLEAN) │
264
+ │ │ repeat │ │
265
+ │ 3. Integration test passes │ until └──────────────────────┘
266
+ │ (GREEN) │ green
267
+ │ │
268
+ │ 4. Refactor across units │
269
+ │ (CLEAN) │
270
+ └─────────────────────────────────┘
271
+ ```
272
+
273
+ **Rules:**
274
+ - Never write production code without a failing test.
275
+ - Each RED-GREEN-REFACTOR cycle should take minutes, not hours.
276
+ - Run the relevant test suite after every GREEN step to confirm no regressions.
277
+ - Commit at every GREEN boundary (all tests pass).
278
+
279
+ ## Output
280
+
281
+ Save PLAN.md, CHECKLIST.json, and checklist.mjs to `.sprints/<sprint-name>/<ticket-number>/`. After validation, ask the user via `#tool:vscode/askQuestions` to approve the generated plan files or request corrections. Only after explicit approval should the workflow ask whether to commit the generated files or skip the commit. If the user chooses to commit, commit only the generated files with the required message format. Present a short summary covering:
282
+ - Number of phases and steps in the plan
283
+ - Total test scenarios generated
284
+ - Any spec ambiguities discovered during planning
285
+ - Suggested order of execution
@@ -0,0 +1,79 @@
1
+ {
2
+ "title": "[Feature Title]",
3
+ "phases": [
4
+ {
5
+ "id": 1,
6
+ "title": "[Phase Title]",
7
+ "steps": [
8
+ {
9
+ "id": "1.1",
10
+ "description": "[Action description]",
11
+ "verify": "[test command]",
12
+ "completed": false
13
+ },
14
+ {
15
+ "id": "1.2",
16
+ "description": "[Action description]",
17
+ "verify": "[test command]",
18
+ "completed": false
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ "id": 2,
24
+ "title": "[Phase Title]",
25
+ "steps": [
26
+ {
27
+ "id": "2.1",
28
+ "description": "[Action description]",
29
+ "verify": "[test command]",
30
+ "completed": false
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ "id": 99,
36
+ "title": "Integration Tests",
37
+ "steps": [
38
+ {
39
+ "id": "99.1",
40
+ "description": "[Test data setup]",
41
+ "verify": null,
42
+ "completed": false
43
+ },
44
+ {
45
+ "id": "99.2",
46
+ "description": "[Integration test cases]",
47
+ "verify": "[integration test command]",
48
+ "completed": false
49
+ }
50
+ ]
51
+ }
52
+ ],
53
+ "finalValidation": [
54
+ {
55
+ "id": "final.1",
56
+ "description": "All unit tests pass",
57
+ "verify": "[command]",
58
+ "completed": false
59
+ },
60
+ {
61
+ "id": "final.2",
62
+ "description": "All integration tests pass",
63
+ "verify": "[command]",
64
+ "completed": false
65
+ },
66
+ {
67
+ "id": "final.3",
68
+ "description": "No lint or compile errors",
69
+ "verify": null,
70
+ "completed": false
71
+ },
72
+ {
73
+ "id": "final.4",
74
+ "description": "No TODO, FIXME, or placeholder code",
75
+ "verify": null,
76
+ "completed": false
77
+ }
78
+ ]
79
+ }
@@ -0,0 +1,158 @@
1
+ # Plan: [Feature Title]
2
+
3
+ Date: YYYY-MM-DD
4
+ Spec: [link to SPEC.md](./SPEC.md)
5
+
6
+ > **Agent**: <!-- Which agent handles implementation? Inherited from spec. -->
7
+ > **Module(s)**: <!-- Which modules are in scope? Inherited from spec. -->
8
+ > **Ticket**: <!-- Link to the Jira/GitHub issue. Inherited from spec. -->
9
+
10
+ ---
11
+
12
+ ## TDD Methodology
13
+
14
+ ### Double-Loop TDD
15
+
16
+ ```
17
+ Outer Loop (Integration / Acceptance) Inner Loop (Unit)
18
+ ┌─────────────────────────────────┐ ┌──────────────────────┐
19
+ │ 1. Write a failing integration │ │ 1. Write a failing │
20
+ │ test (RED) │ │ unit test (RED) │
21
+ │ │ │ │
22
+ │ 2. Enter inner loop ───────────────────────► │ 2. Write minimal │
23
+ │ │ │ code (GREEN) │
24
+ │ │ │ │
25
+ │ │ ◄──────── │ 3. Refactor (CLEAN) │
26
+ │ │ repeat │ │
27
+ │ 3. Integration test passes │ until └──────────────────────┘
28
+ │ (GREEN) │ green
29
+ │ │
30
+ │ 4. Refactor across units │
31
+ │ (CLEAN) │
32
+ └─────────────────────────────────┘
33
+ ```
34
+
35
+ **Rules:**
36
+ - Never write production code without a failing test.
37
+ - Each RED-GREEN-REFACTOR cycle should take minutes, not hours.
38
+ - Run the relevant test suite after every GREEN step to confirm no regressions.
39
+ - Commit at every GREEN boundary (all tests pass).
40
+
41
+ ---
42
+
43
+ ## Dependency Graph
44
+
45
+ <!-- Describe which phases depend on which. Example: -->
46
+ <!-- Phase 2 depends on Phase 1. Phase 3 depends on Phases 1 and 2. -->
47
+
48
+ ```
49
+ Phase 1: [module-name] (library/foundation)
50
+ └── Phase 2: [module-name] (consumer/service)
51
+ └── Phase 3: [module-name] (integration tests)
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Phase 1: [Phase Title]
57
+
58
+ **Module**: `module-name`
59
+ **Test command**: `./gradlew :module-name:test`
60
+
61
+ > **No placeholders.** Every "Implementation" block must name the exact method signatures, class names, field names, and return types. Never write "implement the logic", "add validation", "TBD", or "similar to Step N". An agent executing this step should never need to make a decision not already made here.
62
+
63
+ ### Step 1.1 — [Action description]
64
+
65
+ **Spec requirement**: Section X.Y — [requirement name]
66
+ **File**: `path/to/file.ext`
67
+
68
+ **Test first** (RED):
69
+ - File: `path/to/test/file.ext`
70
+ - Scenario(s): [reference to Gherkin scenarios below]
71
+
72
+ **Implementation** (GREEN):
73
+ - [Exact description: e.g. "Add `public Optional<Report> findById(String id)` to `ReportRepository` — queries the `reports` Delta table filtered by `account_id` from context and the given `id`"]
74
+
75
+ **Verify**: `[exact test command]`
76
+
77
+ ### Step 1.2 — [Action description]
78
+
79
+ <!-- Repeat the same structure for each step -->
80
+
81
+ ---
82
+
83
+ ## Phase 2: [Phase Title]
84
+
85
+ <!-- Repeat phase structure -->
86
+
87
+ ---
88
+
89
+ ## Phase N: Integration Tests
90
+
91
+ **Module**: `module-name`
92
+ **Test command**: `./gradlew :module-name:integrationTest`
93
+
94
+ ### Step N.1 — [Test data setup]
95
+
96
+ **Spec requirement**: Section X.Y — [requirement name]
97
+ **File**: `path/to/test/resources/file.sql`
98
+
99
+ **Implementation**:
100
+ - [Describe test data to add]
101
+
102
+ ### Step N.2 — [Integration test cases]
103
+
104
+ **Spec requirement**: Acceptance criteria
105
+ **File**: `path/to/integration/test/file.ext`
106
+
107
+ **Test scenarios**: [reference to Gherkin scenarios below]
108
+
109
+ **Verify**: `[exact integration test command]`
110
+
111
+ ---
112
+
113
+ ## Test Scenarios
114
+
115
+ ### [Component / Class Name]
116
+
117
+ ```gherkin
118
+ Feature: [Component or class name]
119
+
120
+ Scenario: [Happy path description]
121
+ Given [precondition]
122
+ When [action]
123
+ Then [expected outcome]
124
+
125
+ Scenario: [Edge case description]
126
+ Given [precondition]
127
+ When [action]
128
+ Then [expected outcome]
129
+
130
+ Scenario: [Negative case description]
131
+ Given [precondition]
132
+ When [action]
133
+ Then [expected outcome]
134
+
135
+ Scenario: [Boundary value description]
136
+ Given [precondition]
137
+ When [action]
138
+ Then [expected outcome]
139
+ ```
140
+
141
+ ### [Next Component / Class Name]
142
+
143
+ ```gherkin
144
+ Feature: [Component or class name]
145
+
146
+ <!-- Repeat scenario structure -->
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Final Validation
152
+
153
+ After all phases are complete, run the full validation suite:
154
+
155
+ 1. `[unit test command for module 1]` — all unit tests pass
156
+ 2. `[unit test command for module 2]` — all unit tests pass
157
+ 3. `[integration test command]` — all integration tests pass
158
+ 4. `[lint/compile command]` — no errors or warnings