get-shit-done-cc 1.3.19 → 1.3.21
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.
- package/README.md +17 -2
- package/commands/gsd/execute-plan.md +25 -7
- package/get-shit-done/references/git-integration.md +154 -26
- package/get-shit-done/references/plan-format.md +14 -40
- package/get-shit-done/references/principles.md +36 -9
- package/get-shit-done/references/scope-estimation.md +25 -2
- package/get-shit-done/references/tdd.md +117 -22
- package/get-shit-done/templates/phase-prompt.md +14 -1
- package/get-shit-done/templates/summary.md +15 -3
- package/get-shit-done/workflows/execute-phase.md +173 -47
- package/get-shit-done/workflows/plan-phase.md +13 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,9 +171,24 @@ GSD prevents this. Each plan is maximum 3 tasks. Each plan runs in a fresh subag
|
|
|
171
171
|
|
|
172
172
|
No degradation. Walk away, come back to completed work.
|
|
173
173
|
|
|
174
|
-
###
|
|
174
|
+
### Atomic Git Commits
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
Each task gets its own commit immediately after completion. Plans produce 2-4 commits total:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
abc123f docs(08-02): complete user registration plan
|
|
180
|
+
def456g feat(08-02): add email confirmation flow
|
|
181
|
+
hij789k feat(08-02): implement password hashing
|
|
182
|
+
lmn012o feat(08-02): create registration endpoint
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Benefits:**
|
|
186
|
+
- Git bisect finds exact failing task
|
|
187
|
+
- Each task independently revertable
|
|
188
|
+
- Clear history for Claude in future sessions
|
|
189
|
+
- Better observability in AI-automated workflow
|
|
190
|
+
|
|
191
|
+
Every commit is surgical, traceable, and meaningful.
|
|
177
192
|
|
|
178
193
|
### Modular by Design
|
|
179
194
|
|
|
@@ -14,10 +14,13 @@ allowed-tools:
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
<objective>
|
|
17
|
-
Execute a PLAN.md file, create SUMMARY.md, update project state
|
|
17
|
+
Execute a PLAN.md file with per-task atomic commits, create SUMMARY.md, update project state.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Commit strategy:
|
|
20
|
+
- Each task → 1 commit immediately after completion (feat/fix/test/refactor)
|
|
21
|
+
- Plan completion → 1 metadata commit (docs: SUMMARY + STATE + ROADMAP)
|
|
20
22
|
|
|
23
|
+
Uses intelligent segmentation:
|
|
21
24
|
- Plans without checkpoints → spawn subagent for full autonomous execution
|
|
22
25
|
- Plans with verify checkpoints → segment execution, pause at checkpoints
|
|
23
26
|
- Plans with decision checkpoints → execute in main context
|
|
@@ -88,23 +91,38 @@ Only rule 4 requires user intervention.
|
|
|
88
91
|
</deviation_rules>
|
|
89
92
|
|
|
90
93
|
<commit_rules>
|
|
91
|
-
**
|
|
94
|
+
**Per-Task Commits:**
|
|
95
|
+
|
|
96
|
+
After each task completes:
|
|
97
|
+
1. Stage only files modified by that task
|
|
98
|
+
2. Commit with format: `{type}({phase}-{plan}): {task-name}`
|
|
99
|
+
3. Types: feat, fix, test, refactor, perf, chore
|
|
100
|
+
4. Record commit hash for SUMMARY.md
|
|
92
101
|
|
|
93
|
-
|
|
102
|
+
**Plan Metadata Commit:**
|
|
94
103
|
|
|
104
|
+
After all tasks complete:
|
|
105
|
+
1. Stage planning artifacts only: PLAN.md, SUMMARY.md, STATE.md, ROADMAP.md
|
|
106
|
+
2. Commit with format: `docs({phase}-{plan}): complete [plan-name] plan`
|
|
107
|
+
3. NO code files (already committed per-task)
|
|
108
|
+
|
|
109
|
+
**NEVER use:**
|
|
95
110
|
- `git add .`
|
|
96
111
|
- `git add -A`
|
|
97
112
|
- `git add src/` or any broad directory
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
**Always stage files individually.**
|
|
115
|
+
|
|
116
|
+
See ~/.claude/get-shit-done/references/git-integration.md for full commit strategy.
|
|
100
117
|
</commit_rules>
|
|
101
118
|
|
|
102
119
|
<success_criteria>
|
|
103
120
|
|
|
104
121
|
- [ ] All tasks executed
|
|
105
|
-
- [ ]
|
|
122
|
+
- [ ] Each task committed individually (feat/fix/test/refactor)
|
|
123
|
+
- [ ] SUMMARY.md created with substantive content and commit hashes
|
|
106
124
|
- [ ] STATE.md updated (position, decisions, issues, session)
|
|
107
125
|
- [ ] ROADMAP updated (plan count, phase status)
|
|
108
|
-
- [ ]
|
|
126
|
+
- [ ] Metadata committed with docs({phase}-{plan}): complete [plan-name] plan
|
|
109
127
|
- [ ] User informed of next steps
|
|
110
128
|
</success_criteria>
|
|
@@ -11,14 +11,15 @@ The git log should read like a changelog of what shipped, not a diary of plannin
|
|
|
11
11
|
|
|
12
12
|
<commit_points>
|
|
13
13
|
|
|
14
|
-
| Event | Commit? | Why
|
|
15
|
-
| ----------------------- | ------- |
|
|
16
|
-
| BRIEF + ROADMAP created | YES | Project initialization
|
|
17
|
-
| PLAN.md created | NO | Intermediate - commit with completion
|
|
18
|
-
| RESEARCH.md created | NO | Intermediate
|
|
19
|
-
| DISCOVERY.md created | NO | Intermediate
|
|
20
|
-
| **
|
|
21
|
-
|
|
|
14
|
+
| Event | Commit? | Why |
|
|
15
|
+
| ----------------------- | ------- | ------------------------------------------------ |
|
|
16
|
+
| BRIEF + ROADMAP created | YES | Project initialization |
|
|
17
|
+
| PLAN.md created | NO | Intermediate - commit with plan completion |
|
|
18
|
+
| RESEARCH.md created | NO | Intermediate |
|
|
19
|
+
| DISCOVERY.md created | NO | Intermediate |
|
|
20
|
+
| **Task completed** | YES | Atomic unit of work (1 commit per task) |
|
|
21
|
+
| **Plan completed** | YES | Metadata commit (SUMMARY + STATE + ROADMAP) |
|
|
22
|
+
| Handoff created | YES | WIP state preserved |
|
|
22
23
|
|
|
23
24
|
</commit_points>
|
|
24
25
|
|
|
@@ -56,30 +57,88 @@ git commit
|
|
|
56
57
|
|
|
57
58
|
</format>
|
|
58
59
|
|
|
59
|
-
<format name="
|
|
60
|
-
##
|
|
60
|
+
<format name="task-completion">
|
|
61
|
+
## Task Completion (During Plan Execution)
|
|
61
62
|
|
|
63
|
+
Each task gets its own commit immediately after completion.
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
{type}({phase}-{plan}): {task-name}
|
|
67
|
+
|
|
68
|
+
- [Key change 1]
|
|
69
|
+
- [Key change 2]
|
|
70
|
+
- [Key change 3]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Commit types:**
|
|
74
|
+
- `feat` - New feature/functionality
|
|
75
|
+
- `fix` - Bug fix
|
|
76
|
+
- `test` - Test-only (TDD RED phase)
|
|
77
|
+
- `refactor` - Code cleanup (TDD REFACTOR phase)
|
|
78
|
+
- `perf` - Performance improvement
|
|
79
|
+
- `chore` - Dependencies, config, tooling
|
|
80
|
+
|
|
81
|
+
**Examples:**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Standard task
|
|
85
|
+
git add src/api/auth.ts src/types/user.ts
|
|
86
|
+
git commit -m "feat(08-02): create user registration endpoint
|
|
87
|
+
|
|
88
|
+
- POST /auth/register validates email and password
|
|
89
|
+
- Checks for duplicate users
|
|
90
|
+
- Returns JWT token on success
|
|
91
|
+
"
|
|
92
|
+
|
|
93
|
+
# TDD task - RED phase
|
|
94
|
+
git add src/__tests__/jwt.test.ts
|
|
95
|
+
git commit -m "test(07-02): add failing test for JWT generation
|
|
96
|
+
|
|
97
|
+
- Tests token contains user ID claim
|
|
98
|
+
- Tests token expires in 1 hour
|
|
99
|
+
- Tests signature verification
|
|
100
|
+
"
|
|
101
|
+
|
|
102
|
+
# TDD task - GREEN phase
|
|
103
|
+
git add src/utils/jwt.ts
|
|
104
|
+
git commit -m "feat(07-02): implement JWT generation
|
|
105
|
+
|
|
106
|
+
- Uses jose library for signing
|
|
107
|
+
- Includes user ID and expiry claims
|
|
108
|
+
- Signs with HS256 algorithm
|
|
109
|
+
"
|
|
62
110
|
```
|
|
63
|
-
feat([domain]): [one-liner from SUMMARY.md]
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
112
|
+
</format>
|
|
113
|
+
|
|
114
|
+
<format name="plan-completion">
|
|
115
|
+
## Plan Completion (After All Tasks Done)
|
|
116
|
+
|
|
117
|
+
After all tasks committed, one final metadata commit captures plan completion.
|
|
68
118
|
|
|
69
|
-
[If issues encountered:]
|
|
70
|
-
Note: [issue and resolution]
|
|
71
119
|
```
|
|
120
|
+
docs({phase}-{plan}): complete [plan-name] plan
|
|
72
121
|
|
|
73
|
-
|
|
122
|
+
Tasks completed: [N]/[N]
|
|
123
|
+
- [Task 1 name]
|
|
124
|
+
- [Task 2 name]
|
|
125
|
+
- [Task 3 name]
|
|
126
|
+
|
|
127
|
+
SUMMARY: .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md
|
|
128
|
+
```
|
|
74
129
|
|
|
75
130
|
What to commit:
|
|
76
131
|
|
|
77
132
|
```bash
|
|
78
|
-
git add .planning/phases/XX-name/
|
|
79
|
-
git add
|
|
133
|
+
git add .planning/phases/XX-name/{phase}-{plan}-PLAN.md
|
|
134
|
+
git add .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md
|
|
135
|
+
git add .planning/STATE.md
|
|
136
|
+
git add .planning/ROADMAP.md
|
|
80
137
|
git commit
|
|
81
138
|
```
|
|
82
139
|
|
|
140
|
+
**Note:** Code files NOT included - already committed per-task.
|
|
141
|
+
|
|
83
142
|
</format>
|
|
84
143
|
|
|
85
144
|
<format name="handoff">
|
|
@@ -104,23 +163,92 @@ git commit
|
|
|
104
163
|
|
|
105
164
|
<example_log>
|
|
106
165
|
|
|
166
|
+
**Old approach (per-plan commits):**
|
|
107
167
|
```
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
168
|
+
a7f2d1 feat(checkout): Stripe payments with webhook verification
|
|
169
|
+
3e9c4b feat(products): catalog with search, filters, and pagination
|
|
170
|
+
8a1b2c feat(auth): JWT with refresh rotation using jose
|
|
171
|
+
5c3d7e feat(foundation): Next.js 15 + Prisma + Tailwind scaffold
|
|
172
|
+
2f4a8d docs: initialize ecommerce-app (5 phases)
|
|
113
173
|
```
|
|
114
174
|
|
|
175
|
+
**New approach (per-task commits):**
|
|
176
|
+
```
|
|
177
|
+
# Phase 04 - Checkout
|
|
178
|
+
1a2b3c docs(04-01): complete checkout flow plan
|
|
179
|
+
4d5e6f feat(04-01): add webhook signature verification
|
|
180
|
+
7g8h9i feat(04-01): implement payment session creation
|
|
181
|
+
0j1k2l feat(04-01): create checkout page component
|
|
182
|
+
|
|
183
|
+
# Phase 03 - Products
|
|
184
|
+
3m4n5o docs(03-02): complete product listing plan
|
|
185
|
+
6p7q8r feat(03-02): add pagination controls
|
|
186
|
+
9s0t1u feat(03-02): implement search and filters
|
|
187
|
+
2v3w4x feat(03-01): create product catalog schema
|
|
188
|
+
|
|
189
|
+
# Phase 02 - Auth
|
|
190
|
+
5y6z7a docs(02-02): complete token refresh plan
|
|
191
|
+
8b9c0d feat(02-02): implement refresh token rotation
|
|
192
|
+
1e2f3g test(02-02): add failing test for token refresh
|
|
193
|
+
4h5i6j docs(02-01): complete JWT setup plan
|
|
194
|
+
7k8l9m feat(02-01): add JWT generation and validation
|
|
195
|
+
0n1o2p chore(02-01): install jose library
|
|
196
|
+
|
|
197
|
+
# Phase 01 - Foundation
|
|
198
|
+
3q4r5s docs(01-01): complete scaffold plan
|
|
199
|
+
6t7u8v feat(01-01): configure Tailwind and globals
|
|
200
|
+
9w0x1y feat(01-01): set up Prisma with database
|
|
201
|
+
2z3a4b feat(01-01): create Next.js 15 project
|
|
202
|
+
|
|
203
|
+
# Initialization
|
|
204
|
+
5c6d7e docs: initialize ecommerce-app (5 phases)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Each plan produces 2-4 commits (tasks + metadata). Clear, granular, bisectable.
|
|
208
|
+
|
|
115
209
|
</example_log>
|
|
116
210
|
|
|
117
211
|
<anti_patterns>
|
|
118
212
|
|
|
119
|
-
|
|
213
|
+
**Still don't commit (intermediate artifacts):**
|
|
214
|
+
- PLAN.md creation (commit with plan completion)
|
|
120
215
|
- RESEARCH.md (intermediate)
|
|
121
216
|
- DISCOVERY.md (intermediate)
|
|
122
217
|
- Minor planning tweaks
|
|
123
218
|
- "Fixed typo in roadmap"
|
|
124
219
|
|
|
125
|
-
|
|
220
|
+
**Do commit (outcomes):**
|
|
221
|
+
- Each task completion (feat/fix/test/refactor)
|
|
222
|
+
- Plan completion metadata (docs)
|
|
223
|
+
- Project initialization (docs)
|
|
224
|
+
|
|
225
|
+
**Key principle:** Commit working code and shipped outcomes, not planning process.
|
|
226
|
+
|
|
126
227
|
</anti_patterns>
|
|
228
|
+
|
|
229
|
+
<commit_strategy_rationale>
|
|
230
|
+
|
|
231
|
+
## Why Per-Task Commits?
|
|
232
|
+
|
|
233
|
+
**Context engineering for AI:**
|
|
234
|
+
- Git history becomes primary context source for future Claude sessions
|
|
235
|
+
- `git log --grep="{phase}-{plan}"` shows all work for a plan
|
|
236
|
+
- `git diff <hash>^..<hash>` shows exact changes per task
|
|
237
|
+
- Less reliance on parsing SUMMARY.md = more context for actual work
|
|
238
|
+
|
|
239
|
+
**Failure recovery:**
|
|
240
|
+
- Task 1 committed ✅, Task 2 failed ❌
|
|
241
|
+
- Claude in next session: sees task 1 complete, can retry task 2
|
|
242
|
+
- Can `git reset --hard` to last successful task
|
|
243
|
+
|
|
244
|
+
**Debugging:**
|
|
245
|
+
- `git bisect` finds exact failing task, not just failing plan
|
|
246
|
+
- `git blame` traces line to specific task context
|
|
247
|
+
- Each commit is independently revertable
|
|
248
|
+
|
|
249
|
+
**Observability:**
|
|
250
|
+
- Solo developer + Claude workflow benefits from granular attribution
|
|
251
|
+
- Atomic commits are git best practice
|
|
252
|
+
- "Commit noise" irrelevant when consumer is Claude, not humans
|
|
253
|
+
|
|
254
|
+
</commit_strategy_rationale>
|
|
@@ -243,42 +243,30 @@ Use for: Technology selection, architecture decisions, design choices, feature p
|
|
|
243
243
|
See `./checkpoints.md` for comprehensive checkpoint guidance.
|
|
244
244
|
</task_types>
|
|
245
245
|
|
|
246
|
-
<
|
|
247
|
-
|
|
246
|
+
<tdd_plans>
|
|
247
|
+
**TDD work uses dedicated plans.**
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
```xml
|
|
251
|
-
<task type="auto" tdd="true">
|
|
252
|
-
<name>Task N: [Name]</name>
|
|
253
|
-
<files>[paths]</files>
|
|
254
|
-
<test-first>[What test to write first - the failing assertion]</test-first>
|
|
255
|
-
<action>[Implementation to make test pass]</action>
|
|
256
|
-
<verify>[Tests pass, behavior works]</verify>
|
|
257
|
-
<done>[Criteria]</done>
|
|
258
|
-
</task>
|
|
259
|
-
```
|
|
249
|
+
TDD features require 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. This is fundamentally heavier than standard tasks and would consume 50-60% of context if embedded in a multi-task plan.
|
|
260
250
|
|
|
261
|
-
**When to
|
|
251
|
+
**When to create a TDD plan:**
|
|
262
252
|
- Business logic with defined inputs/outputs
|
|
263
253
|
- API endpoints with request/response contracts
|
|
264
254
|
- Data transformations and parsing
|
|
265
255
|
- Validation rules
|
|
266
256
|
- Algorithms with testable behavior
|
|
267
257
|
|
|
268
|
-
**When
|
|
258
|
+
**When to use standard plans (skip TDD):**
|
|
269
259
|
- UI layout and styling
|
|
270
260
|
- Configuration changes
|
|
271
261
|
- Glue code connecting existing components
|
|
272
262
|
- One-off scripts
|
|
273
263
|
|
|
274
|
-
**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
3. Claude refactors if needed (tests still pass)
|
|
278
|
-
4. Claude commits atomic change
|
|
264
|
+
**Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
|
|
265
|
+
→ Yes: Create a TDD plan (one feature per plan)
|
|
266
|
+
→ No: Use standard plan, add tests after if needed
|
|
279
267
|
|
|
280
|
-
See `./tdd.md` for
|
|
281
|
-
</
|
|
268
|
+
See `./tdd.md` for TDD plan structure and execution guidance.
|
|
269
|
+
</tdd_plans>
|
|
282
270
|
|
|
283
271
|
<context_references>
|
|
284
272
|
Use @file references to load context for the prompt:
|
|
@@ -384,25 +372,11 @@ Claude: "How? What type? What library? Where?"
|
|
|
384
372
|
Claude can implement this immediately.
|
|
385
373
|
</just_right>
|
|
386
374
|
|
|
387
|
-
<
|
|
388
|
-
TDD
|
|
389
|
-
|
|
390
|
-
```xml
|
|
391
|
-
<task type="auto" tdd="true">
|
|
392
|
-
<name>Task 2: Create email validation utility</name>
|
|
393
|
-
<files>src/lib/validation.ts, src/lib/validation.test.ts</files>
|
|
394
|
-
<test-first>
|
|
395
|
-
Test: isValidEmail returns true for valid emails, false for invalid
|
|
396
|
-
Cases: "user@example.com" → true, "invalid" → false, "" → false, "user@" → false
|
|
397
|
-
</test-first>
|
|
398
|
-
<action>Implement isValidEmail using regex pattern. Handle edge cases: empty string, missing @, missing domain.</action>
|
|
399
|
-
<verify>npm test -- validation.test.ts passes all cases</verify>
|
|
400
|
-
<done>Email validation works for all edge cases, tests document behavior</done>
|
|
401
|
-
</task>
|
|
402
|
-
```
|
|
375
|
+
<note_on_tdd>
|
|
376
|
+
**TDD candidates get dedicated plans.**
|
|
403
377
|
|
|
404
|
-
|
|
405
|
-
</
|
|
378
|
+
If email validation warrants TDD, create a TDD plan for it. See `./tdd.md` for TDD plan structure.
|
|
379
|
+
</note_on_tdd>
|
|
406
380
|
|
|
407
381
|
<too_detailed>
|
|
408
382
|
Writing the actual code in the plan. Trust Claude to implement from clear instructions.
|
|
@@ -77,7 +77,7 @@ Plans are guides, not straitjackets. During execution:
|
|
|
77
77
|
|
|
78
78
|
Use TDD when the work WOULD benefit from it. Not dogma—pragmatism.
|
|
79
79
|
|
|
80
|
-
**TDD candidates (
|
|
80
|
+
**TDD candidates (create dedicated TDD plan):**
|
|
81
81
|
- Business logic with defined inputs/outputs
|
|
82
82
|
- API endpoints and handlers
|
|
83
83
|
- Data transformations and parsing
|
|
@@ -85,7 +85,7 @@ Use TDD when the work WOULD benefit from it. Not dogma—pragmatism.
|
|
|
85
85
|
- State machines and workflows
|
|
86
86
|
- Anything where you can describe expected behavior before implementing
|
|
87
87
|
|
|
88
|
-
**Skip TDD
|
|
88
|
+
**Skip TDD (use standard plan):**
|
|
89
89
|
- UI layout and styling
|
|
90
90
|
- Exploratory prototyping
|
|
91
91
|
- One-off scripts and migrations
|
|
@@ -94,16 +94,20 @@ Use TDD when the work WOULD benefit from it. Not dogma—pragmatism.
|
|
|
94
94
|
|
|
95
95
|
**Decision heuristic:**
|
|
96
96
|
Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
|
|
97
|
-
→ Yes: TDD
|
|
98
|
-
→ No:
|
|
97
|
+
→ Yes: Create a TDD plan (one feature per plan)
|
|
98
|
+
→ No: Standard plan, add tests after if needed
|
|
99
99
|
|
|
100
|
-
**TDD
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
**Why TDD gets its own plan:**
|
|
101
|
+
TDD requires 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. This consumes 40-50% of context for a single feature. Dedicated TDD plans ensure full quality throughout the cycle.
|
|
102
|
+
|
|
103
|
+
**TDD plan structure:**
|
|
104
|
+
1. Write failing test (RED) → commit
|
|
105
|
+
2. Implement to pass (GREEN) → commit
|
|
106
|
+
3. Refactor if needed → commit
|
|
105
107
|
|
|
106
108
|
This is about design quality, not test coverage metrics.
|
|
109
|
+
|
|
110
|
+
See `~/.claude/get-shit-done/references/tdd.md` for TDD plan structure.
|
|
107
111
|
</test_driven_when_beneficial>
|
|
108
112
|
|
|
109
113
|
<ship_fast>
|
|
@@ -115,6 +119,29 @@ Plan → Execute → Ship → Learn → Repeat
|
|
|
115
119
|
Milestones mark shipped versions (v1.0 → v1.1 → v2.0).
|
|
116
120
|
</ship_fast>
|
|
117
121
|
|
|
122
|
+
<atomic_commits>
|
|
123
|
+
|
|
124
|
+
**Git commits = context engineering for Claude.**
|
|
125
|
+
|
|
126
|
+
Each task gets its own commit immediately after completion:
|
|
127
|
+
- Format: `{type}({phase}-{plan}): {task-description}`
|
|
128
|
+
- Types: feat, fix, test, refactor, perf, chore, docs
|
|
129
|
+
- One final metadata commit per plan: `docs({phase}-{plan}): complete [plan-name]`
|
|
130
|
+
|
|
131
|
+
**Why per-task commits:**
|
|
132
|
+
- Git history becomes primary context source for future Claude sessions
|
|
133
|
+
- `git bisect` finds exact failing task, not just failing plan
|
|
134
|
+
- Each task independently revertable
|
|
135
|
+
- Better failure recovery (task 1 committed ✅, retry task 2)
|
|
136
|
+
- Observability optimized for AI workflow, not human browsing
|
|
137
|
+
|
|
138
|
+
**Plans produce 3-4 commits total:**
|
|
139
|
+
- 2-3 task commits (working code)
|
|
140
|
+
- 1 metadata commit (SUMMARY + STATE + ROADMAP)
|
|
141
|
+
|
|
142
|
+
See `~/.claude/get-shit-done/references/git-integration.md` for complete strategy.
|
|
143
|
+
</atomic_commits>
|
|
144
|
+
|
|
118
145
|
<anti_enterprise>
|
|
119
146
|
|
|
120
147
|
NEVER include:
|
|
@@ -38,6 +38,27 @@ Why 50% not 80%?
|
|
|
38
38
|
**When in doubt: Default to 2 tasks.** Better to have an extra plan than degraded quality.
|
|
39
39
|
</task_rule>
|
|
40
40
|
|
|
41
|
+
<tdd_plans>
|
|
42
|
+
**TDD features get their own plans. Target ~40% context.**
|
|
43
|
+
|
|
44
|
+
TDD requires 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. This is fundamentally heavier than linear task execution.
|
|
45
|
+
|
|
46
|
+
| TDD Feature Complexity | Context Usage |
|
|
47
|
+
|------------------------|---------------|
|
|
48
|
+
| Simple utility function | ~25-30% |
|
|
49
|
+
| Business logic with edge cases | ~35-40% |
|
|
50
|
+
| Complex algorithm | ~40-50% |
|
|
51
|
+
|
|
52
|
+
**One feature per TDD plan.** If features are trivial enough to batch, they're trivial enough to skip TDD.
|
|
53
|
+
|
|
54
|
+
**Why TDD plans are separate:**
|
|
55
|
+
- TDD consumes 40-50% context for a single feature
|
|
56
|
+
- Dedicated plans ensure full quality throughout RED-GREEN-REFACTOR
|
|
57
|
+
- Each TDD feature gets fresh context, peak quality
|
|
58
|
+
|
|
59
|
+
See `~/.claude/get-shit-done/references/tdd.md` for TDD plan structure.
|
|
60
|
+
</tdd_plans>
|
|
61
|
+
|
|
41
62
|
<split_signals>
|
|
42
63
|
|
|
43
64
|
<always_split>
|
|
@@ -80,7 +101,7 @@ Plan 1: "Auth Database Models" (2 tasks)
|
|
|
80
101
|
Plan 2: "Auth API Core" (3 tasks)
|
|
81
102
|
Plan 3: "Auth API Protection" (2 tasks)
|
|
82
103
|
Plan 4: "Auth UI Components" (2 tasks)
|
|
83
|
-
Each: 30-40% context, peak quality,
|
|
104
|
+
Each: 30-40% context, peak quality, atomic commits (2-3 task commits + 1 metadata commit)
|
|
84
105
|
```
|
|
85
106
|
</anti_patterns>
|
|
86
107
|
|
|
@@ -137,7 +158,7 @@ Each plan: fresh context, peak quality. More plans = more thoroughness, same qua
|
|
|
137
158
|
<summary>
|
|
138
159
|
**2-3 tasks, 50% context target:**
|
|
139
160
|
- All tasks: Peak quality
|
|
140
|
-
- Git: Atomic,
|
|
161
|
+
- Git: Atomic per-task commits (each task = 1 commit, plan = 1 metadata commit)
|
|
141
162
|
- Autonomous plans: Subagent execution (fresh context)
|
|
142
163
|
|
|
143
164
|
**The principle:** Aggressive atomicity. More plans, smaller scope, consistent quality.
|
|
@@ -145,5 +166,7 @@ Each plan: fresh context, peak quality. More plans = more thoroughness, same qua
|
|
|
145
166
|
**The rule:** If in doubt, split. Quality over consolidation. Always.
|
|
146
167
|
|
|
147
168
|
**Depth rule:** Depth increases plan COUNT, never plan SIZE.
|
|
169
|
+
|
|
170
|
+
**Commit rule:** Each plan produces 3-4 commits total (2-3 task commits + 1 docs commit). More granular history = better observability for Claude.
|
|
148
171
|
</summary>
|
|
149
172
|
</scope_estimation>
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
TDD is about design quality, not coverage metrics. The red-green-refactor cycle forces you to think about behavior before implementation, producing cleaner interfaces and more testable code.
|
|
3
3
|
|
|
4
4
|
**Principle:** If you can describe the behavior as `expect(fn(input)).toBe(output)` before writing `fn`, TDD improves the result.
|
|
5
|
+
|
|
6
|
+
**Key insight:** TDD work is fundamentally heavier than standard tasks—it requires 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. TDD features get dedicated plans to ensure full context is available throughout the cycle.
|
|
5
7
|
</overview>
|
|
6
8
|
|
|
7
|
-
<
|
|
9
|
+
<when_to_use_tdd>
|
|
8
10
|
## When TDD Improves Quality
|
|
9
11
|
|
|
10
|
-
**TDD candidates (
|
|
12
|
+
**TDD candidates (create a TDD plan):**
|
|
11
13
|
- Business logic with defined inputs/outputs
|
|
12
14
|
- API endpoints with request/response contracts
|
|
13
15
|
- Data transformations, parsing, formatting
|
|
@@ -16,7 +18,7 @@ TDD is about design quality, not coverage metrics. The red-green-refactor cycle
|
|
|
16
18
|
- State machines and workflows
|
|
17
19
|
- Utility functions with clear specifications
|
|
18
20
|
|
|
19
|
-
**Skip TDD (standard `type="auto"`):**
|
|
21
|
+
**Skip TDD (use standard plan with `type="auto"` tasks):**
|
|
20
22
|
- UI layout, styling, visual components
|
|
21
23
|
- Configuration changes
|
|
22
24
|
- Glue code connecting existing components
|
|
@@ -25,32 +27,89 @@ TDD is about design quality, not coverage metrics. The red-green-refactor cycle
|
|
|
25
27
|
- Exploratory prototyping
|
|
26
28
|
|
|
27
29
|
**Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
|
|
28
|
-
→ Yes: TDD
|
|
29
|
-
→ No:
|
|
30
|
-
</
|
|
30
|
+
→ Yes: Create a TDD plan
|
|
31
|
+
→ No: Use standard plan, add tests after if needed
|
|
32
|
+
</when_to_use_tdd>
|
|
33
|
+
|
|
34
|
+
<tdd_plan_structure>
|
|
35
|
+
## TDD Plan Structure
|
|
36
|
+
|
|
37
|
+
Each TDD plan implements **one feature** through the full RED-GREEN-REFACTOR cycle.
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
---
|
|
41
|
+
phase: XX-name
|
|
42
|
+
plan: NN
|
|
43
|
+
type: tdd
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
<objective>
|
|
47
|
+
[What feature and why]
|
|
48
|
+
Purpose: [Design benefit of TDD for this feature]
|
|
49
|
+
Output: [Working, tested feature]
|
|
50
|
+
</objective>
|
|
51
|
+
|
|
52
|
+
<context>
|
|
53
|
+
@.planning/PROJECT.md
|
|
54
|
+
@.planning/ROADMAP.md
|
|
55
|
+
@relevant/source/files.ts
|
|
56
|
+
</context>
|
|
57
|
+
|
|
58
|
+
<feature>
|
|
59
|
+
<name>[Feature name]</name>
|
|
60
|
+
<files>[source file, test file]</files>
|
|
61
|
+
<behavior>
|
|
62
|
+
[Expected behavior in testable terms]
|
|
63
|
+
Cases: input → expected output
|
|
64
|
+
</behavior>
|
|
65
|
+
<implementation>[How to implement once tests pass]</implementation>
|
|
66
|
+
</feature>
|
|
67
|
+
|
|
68
|
+
<verification>
|
|
69
|
+
[Test command that proves feature works]
|
|
70
|
+
</verification>
|
|
71
|
+
|
|
72
|
+
<success_criteria>
|
|
73
|
+
- Failing test written and committed
|
|
74
|
+
- Implementation passes test
|
|
75
|
+
- Refactor complete (if needed)
|
|
76
|
+
- All 2-3 commits present
|
|
77
|
+
</success_criteria>
|
|
78
|
+
|
|
79
|
+
<output>
|
|
80
|
+
After completion, create SUMMARY.md with:
|
|
81
|
+
- RED: What test was written, why it failed
|
|
82
|
+
- GREEN: What implementation made it pass
|
|
83
|
+
- REFACTOR: What cleanup was done (if any)
|
|
84
|
+
- Commits: List of commits produced
|
|
85
|
+
</output>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**One feature per TDD plan.** If features are trivial enough to batch, they're trivial enough to skip TDD—use a standard plan and add tests after.
|
|
89
|
+
</tdd_plan_structure>
|
|
31
90
|
|
|
32
91
|
<execution_flow>
|
|
33
92
|
## Red-Green-Refactor Cycle
|
|
34
93
|
|
|
35
94
|
**RED - Write failing test:**
|
|
36
95
|
1. Create test file following project conventions
|
|
37
|
-
2. Write test describing expected behavior (from `<
|
|
96
|
+
2. Write test describing expected behavior (from `<behavior>` element)
|
|
38
97
|
3. Run test - it MUST fail
|
|
39
98
|
4. If test passes: feature exists or test is wrong. Investigate.
|
|
40
|
-
5. Commit: `test: add failing test for [feature]`
|
|
99
|
+
5. Commit: `test({phase}-{plan}): add failing test for [feature]`
|
|
41
100
|
|
|
42
101
|
**GREEN - Implement to pass:**
|
|
43
102
|
1. Write minimal code to make test pass
|
|
44
103
|
2. No cleverness, no optimization - just make it work
|
|
45
104
|
3. Run test - it MUST pass
|
|
46
|
-
4. Commit: `feat: implement [feature]`
|
|
105
|
+
4. Commit: `feat({phase}-{plan}): implement [feature]`
|
|
47
106
|
|
|
48
107
|
**REFACTOR (if needed):**
|
|
49
108
|
1. Clean up implementation if obvious improvements exist
|
|
50
109
|
2. Run tests - MUST still pass
|
|
51
|
-
3. Only commit if changes made: `refactor: clean up [feature]`
|
|
110
|
+
3. Only commit if changes made: `refactor({phase}-{plan}): clean up [feature]`
|
|
52
111
|
|
|
53
|
-
**
|
|
112
|
+
**Result:** Each TDD plan produces 2-3 atomic commits.
|
|
54
113
|
</execution_flow>
|
|
55
114
|
|
|
56
115
|
<test_quality>
|
|
@@ -77,7 +136,7 @@ TDD is about design quality, not coverage metrics. The red-green-refactor cycle
|
|
|
77
136
|
<framework_setup>
|
|
78
137
|
## Test Framework Setup (If None Exists)
|
|
79
138
|
|
|
80
|
-
When a TDD
|
|
139
|
+
When executing a TDD plan but no test framework is configured, set it up as part of the RED phase:
|
|
81
140
|
|
|
82
141
|
**1. Detect project type:**
|
|
83
142
|
```bash
|
|
@@ -122,6 +181,8 @@ Follow project conventions for test location:
|
|
|
122
181
|
- `*.test.ts` / `*.spec.ts` next to source
|
|
123
182
|
- `__tests__/` directory
|
|
124
183
|
- `tests/` directory at root
|
|
184
|
+
|
|
185
|
+
Framework setup is a one-time cost included in the first TDD plan's RED phase.
|
|
125
186
|
</framework_setup>
|
|
126
187
|
|
|
127
188
|
<error_handling>
|
|
@@ -134,7 +195,7 @@ Follow project conventions for test location:
|
|
|
134
195
|
|
|
135
196
|
**Test doesn't pass in GREEN phase:**
|
|
136
197
|
- Debug implementation
|
|
137
|
-
- Don't skip to
|
|
198
|
+
- Don't skip to refactor
|
|
138
199
|
- Keep iterating until green
|
|
139
200
|
|
|
140
201
|
**Tests fail in REFACTOR phase:**
|
|
@@ -149,20 +210,54 @@ Follow project conventions for test location:
|
|
|
149
210
|
</error_handling>
|
|
150
211
|
|
|
151
212
|
<commit_pattern>
|
|
152
|
-
## Commit Pattern for TDD
|
|
213
|
+
## Commit Pattern for TDD Plans
|
|
153
214
|
|
|
154
|
-
|
|
215
|
+
TDD plans produce 2-3 atomic commits (one per phase):
|
|
155
216
|
|
|
156
217
|
```
|
|
157
|
-
test: add failing test for email validation
|
|
218
|
+
test(08-02): add failing test for email validation
|
|
219
|
+
|
|
220
|
+
- Tests valid email formats accepted
|
|
221
|
+
- Tests invalid formats rejected
|
|
222
|
+
- Tests empty input handling
|
|
223
|
+
|
|
224
|
+
feat(08-02): implement email validation
|
|
225
|
+
|
|
226
|
+
- Regex pattern matches RFC 5322
|
|
227
|
+
- Returns boolean for validity
|
|
228
|
+
- Handles edge cases (empty, null)
|
|
158
229
|
|
|
159
|
-
|
|
230
|
+
refactor(08-02): extract regex to constant (optional)
|
|
160
231
|
|
|
161
|
-
|
|
232
|
+
- Moved pattern to EMAIL_REGEX constant
|
|
233
|
+
- No behavior changes
|
|
234
|
+
- Tests still pass
|
|
162
235
|
```
|
|
163
236
|
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
|
|
237
|
+
**Comparison with standard plans:**
|
|
238
|
+
- Standard plans: 1 commit per task, 2-4 commits per plan
|
|
239
|
+
- TDD plans: 2-3 commits for single feature
|
|
240
|
+
|
|
241
|
+
Both follow same format: `{type}({phase}-{plan}): {description}`
|
|
242
|
+
|
|
243
|
+
**Benefits:**
|
|
244
|
+
- Each commit independently revertable
|
|
245
|
+
- Git bisect works at commit level
|
|
246
|
+
- Clear history showing TDD discipline
|
|
247
|
+
- Consistent with overall commit strategy
|
|
168
248
|
</commit_pattern>
|
|
249
|
+
|
|
250
|
+
<context_budget>
|
|
251
|
+
## Context Budget
|
|
252
|
+
|
|
253
|
+
TDD plans target **~40% context usage** (lower than standard plans' ~50%).
|
|
254
|
+
|
|
255
|
+
Why lower:
|
|
256
|
+
- RED phase: write test, run test, potentially debug why it didn't fail
|
|
257
|
+
- GREEN phase: implement, run test, potentially iterate on failures
|
|
258
|
+
- REFACTOR phase: modify code, run tests, verify no regressions
|
|
259
|
+
|
|
260
|
+
Each phase involves reading files, running commands, analyzing output. The back-and-forth is inherently heavier than linear task execution.
|
|
261
|
+
|
|
262
|
+
Single feature focus ensures full quality throughout the cycle.
|
|
263
|
+
</context_budget>
|
|
@@ -169,7 +169,20 @@ From create-meta-prompts patterns:
|
|
|
169
169
|
- Different subsystems (auth vs API vs UI)
|
|
170
170
|
- Clear dependency boundaries (setup → implement → test)
|
|
171
171
|
- Risk of context overflow (>50% estimated usage)
|
|
172
|
-
|
|
172
|
+
- **TDD candidates** - Features that warrant TDD become their own TDD plans
|
|
173
|
+
</scope_guidance>
|
|
174
|
+
|
|
175
|
+
<tdd_plan_note>
|
|
176
|
+
**TDD features get dedicated plans.**
|
|
177
|
+
|
|
178
|
+
TDD requires 2-3 execution cycles (RED → GREEN → REFACTOR) that consume 40-50% context for a single feature. Features warranting TDD (business logic, validation, algorithms, API contracts) each get their own TDD plan.
|
|
179
|
+
|
|
180
|
+
**Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
|
|
181
|
+
→ Yes: Create a TDD plan (one feature per plan)
|
|
182
|
+
→ No: Standard task in standard plan
|
|
183
|
+
|
|
184
|
+
See `~/.claude/get-shit-done/references/tdd.md` for TDD plan structure.
|
|
185
|
+
</tdd_plan_note>
|
|
173
186
|
|
|
174
187
|
<good_examples>
|
|
175
188
|
|
|
@@ -62,6 +62,18 @@ completed: YYYY-MM-DD
|
|
|
62
62
|
- [Second key accomplishment]
|
|
63
63
|
- [Third if applicable]
|
|
64
64
|
|
|
65
|
+
## Task Commits
|
|
66
|
+
|
|
67
|
+
Each task was committed atomically:
|
|
68
|
+
|
|
69
|
+
1. **Task 1: [task name]** - `abc123f` (feat/fix/test/refactor)
|
|
70
|
+
2. **Task 2: [task name]** - `def456g` (feat/fix/test/refactor)
|
|
71
|
+
3. **Task 3: [task name]** - `hij789k` (feat/fix/test/refactor)
|
|
72
|
+
|
|
73
|
+
**Plan metadata:** `lmn012o` (docs: complete plan)
|
|
74
|
+
|
|
75
|
+
_Note: TDD tasks may have multiple commits (test → feat → refactor)_
|
|
76
|
+
|
|
65
77
|
## Files Created/Modified
|
|
66
78
|
- `path/to/file.ts` - What it does
|
|
67
79
|
- `path/to/another.ts` - What it does
|
|
@@ -83,7 +95,7 @@ completed: YYYY-MM-DD
|
|
|
83
95
|
- **Fix:** [What was done]
|
|
84
96
|
- **Files modified:** [file paths]
|
|
85
97
|
- **Verification:** [How it was verified]
|
|
86
|
-
- **
|
|
98
|
+
- **Committed in:** [hash] (part of task commit)
|
|
87
99
|
|
|
88
100
|
[... repeat for each auto-fix ...]
|
|
89
101
|
|
|
@@ -189,7 +201,7 @@ The one-liner should tell someone what actually shipped.
|
|
|
189
201
|
- **Fix:** Added bcrypt hashing on registration, comparison on login with salt rounds 10
|
|
190
202
|
- **Files modified:** src/app/api/auth/login/route.ts, src/lib/auth.ts
|
|
191
203
|
- **Verification:** Password hash test passes, plaintext never stored
|
|
192
|
-
- **
|
|
204
|
+
- **Committed in:** abc123f (Task 2 commit)
|
|
193
205
|
|
|
194
206
|
**2. [Rule 3 - Blocking] Installed missing jose dependency**
|
|
195
207
|
- **Found during:** Task 4 (JWT token generation)
|
|
@@ -197,7 +209,7 @@ The one-liner should tell someone what actually shipped.
|
|
|
197
209
|
- **Fix:** Ran `npm install jose`
|
|
198
210
|
- **Files modified:** package.json, package-lock.json
|
|
199
211
|
- **Verification:** Import succeeds, build passes
|
|
200
|
-
- **
|
|
212
|
+
- **Committed in:** def456g (Task 4 commit)
|
|
201
213
|
|
|
202
214
|
### Deferred Enhancements
|
|
203
215
|
|
|
@@ -440,8 +440,8 @@ Execute each task in the prompt. **Deviations are normal** - handle them automat
|
|
|
440
440
|
**If `type="auto"`:**
|
|
441
441
|
|
|
442
442
|
**Before executing:** Check if task has `tdd="true"` attribute:
|
|
443
|
-
- If yes: Follow TDD execution flow (see `<tdd_execution>`) - RED → GREEN → REFACTOR cycle with
|
|
444
|
-
- If no: Standard implementation
|
|
443
|
+
- If yes: Follow TDD execution flow (see `<tdd_execution>`) - RED → GREEN → REFACTOR cycle with atomic commits per stage
|
|
444
|
+
- If no: Standard implementation
|
|
445
445
|
|
|
446
446
|
- Work toward task completion
|
|
447
447
|
- **If CLI/API returns authentication error:** Handle as authentication gate (see below)
|
|
@@ -449,7 +449,8 @@ Execute each task in the prompt. **Deviations are normal** - handle them automat
|
|
|
449
449
|
- Continue implementing, applying rules as needed
|
|
450
450
|
- Run the verification
|
|
451
451
|
- Confirm done criteria met
|
|
452
|
-
-
|
|
452
|
+
- **Commit the task** (see `<task_commit>` below)
|
|
453
|
+
- Track task completion and commit hash for Summary documentation
|
|
453
454
|
- Continue to next task
|
|
454
455
|
|
|
455
456
|
**If `type="checkpoint:*"`:**
|
|
@@ -814,53 +815,155 @@ Logged to .planning/ISSUES.md for future consideration:
|
|
|
814
815
|
|
|
815
816
|
</deviation_documentation>
|
|
816
817
|
|
|
817
|
-
<
|
|
818
|
-
## TDD
|
|
818
|
+
<tdd_plan_execution>
|
|
819
|
+
## TDD Plan Execution
|
|
819
820
|
|
|
820
|
-
When executing a
|
|
821
|
+
When executing a plan with `type: tdd` in frontmatter, follow the RED-GREEN-REFACTOR cycle for the single feature defined in the plan.
|
|
821
822
|
|
|
822
|
-
**1. Check test infrastructure:**
|
|
823
|
+
**1. Check test infrastructure (if first TDD plan):**
|
|
823
824
|
If no test framework configured:
|
|
824
825
|
- Detect project type from package.json/requirements.txt/etc.
|
|
825
826
|
- Install minimal test framework (Jest, pytest, Go testing, etc.)
|
|
826
827
|
- Create test config file
|
|
827
828
|
- Verify: run empty test suite
|
|
829
|
+
- This is part of the RED phase, not a separate task
|
|
828
830
|
|
|
829
831
|
**2. RED - Write failing test:**
|
|
830
|
-
- Read `<
|
|
832
|
+
- Read `<behavior>` element for test specification
|
|
831
833
|
- Create test file if doesn't exist (follow project conventions)
|
|
832
834
|
- Write test(s) that describe expected behavior
|
|
833
835
|
- Run tests - MUST fail (if passes, test is wrong or feature exists)
|
|
834
|
-
- Commit:
|
|
836
|
+
- Commit: `test({phase}-{plan}): add failing test for [feature]`
|
|
835
837
|
|
|
836
838
|
**3. GREEN - Implement to pass:**
|
|
837
|
-
- Read `<
|
|
839
|
+
- Read `<implementation>` element for guidance
|
|
838
840
|
- Write minimal code to make test pass
|
|
839
841
|
- Run tests - MUST pass
|
|
840
|
-
- Commit:
|
|
842
|
+
- Commit: `feat({phase}-{plan}): implement [feature]`
|
|
841
843
|
|
|
842
844
|
**4. REFACTOR (if needed):**
|
|
843
845
|
- Clean up code if obvious improvements
|
|
844
846
|
- Run tests - MUST still pass
|
|
845
|
-
- Commit only if changes made:
|
|
847
|
+
- Commit only if changes made: `refactor({phase}-{plan}): clean up [feature]`
|
|
846
848
|
|
|
847
|
-
**Commit pattern for TDD
|
|
848
|
-
Each TDD
|
|
849
|
-
1. `test: add failing test for X`
|
|
850
|
-
2. `feat: implement X`
|
|
851
|
-
3. `refactor: clean up X` (optional)
|
|
849
|
+
**Commit pattern for TDD plans:**
|
|
850
|
+
Each TDD plan produces 2-3 atomic commits:
|
|
851
|
+
1. `test({phase}-{plan}): add failing test for X`
|
|
852
|
+
2. `feat({phase}-{plan}): implement X`
|
|
853
|
+
3. `refactor({phase}-{plan}): clean up X` (optional)
|
|
852
854
|
|
|
853
855
|
**Error handling:**
|
|
854
856
|
- If test doesn't fail in RED phase: Test is wrong or feature already exists. Investigate before proceeding.
|
|
855
|
-
- If test doesn't pass in GREEN phase: Debug implementation,
|
|
857
|
+
- If test doesn't pass in GREEN phase: Debug implementation, keep iterating until green.
|
|
856
858
|
- If tests fail in REFACTOR phase: Undo refactor, commit was premature.
|
|
857
859
|
|
|
858
860
|
**Verification:**
|
|
859
|
-
After TDD
|
|
861
|
+
After TDD plan completion, ensure:
|
|
860
862
|
- All tests pass
|
|
861
863
|
- Test coverage for the new behavior exists
|
|
862
864
|
- No unrelated tests broken
|
|
863
|
-
|
|
865
|
+
|
|
866
|
+
**Why TDD uses dedicated plans:** TDD requires 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. This consumes 40-50% of context for a single feature. Dedicated plans ensure full quality throughout the cycle.
|
|
867
|
+
|
|
868
|
+
**Comparison:**
|
|
869
|
+
- Standard plans: Multiple tasks, 1 commit per task, 2-4 commits total
|
|
870
|
+
- TDD plans: Single feature, 2-3 commits for RED/GREEN/REFACTOR cycle
|
|
871
|
+
|
|
872
|
+
See `~/.claude/get-shit-done/references/tdd.md` for TDD plan structure.
|
|
873
|
+
</tdd_plan_execution>
|
|
874
|
+
|
|
875
|
+
<task_commit>
|
|
876
|
+
## Task Commit Protocol
|
|
877
|
+
|
|
878
|
+
After each task completes (verification passed, done criteria met), commit immediately:
|
|
879
|
+
|
|
880
|
+
**1. Identify modified files:**
|
|
881
|
+
|
|
882
|
+
Track files changed during this specific task (not the entire plan):
|
|
883
|
+
|
|
884
|
+
```bash
|
|
885
|
+
git status --short
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
**2. Stage only task-related files:**
|
|
889
|
+
|
|
890
|
+
Stage each file individually (NEVER use `git add .` or `git add -A`):
|
|
891
|
+
|
|
892
|
+
```bash
|
|
893
|
+
# Example - adjust to actual files modified by this task
|
|
894
|
+
git add src/api/auth.ts
|
|
895
|
+
git add src/types/user.ts
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
**3. Determine commit type:**
|
|
899
|
+
|
|
900
|
+
| Type | When to Use | Example |
|
|
901
|
+
|------|-------------|---------|
|
|
902
|
+
| `feat` | New feature, endpoint, component, functionality | feat(08-02): create user registration endpoint |
|
|
903
|
+
| `fix` | Bug fix, error correction | fix(08-02): correct email validation regex |
|
|
904
|
+
| `test` | Test-only changes (TDD RED phase) | test(08-02): add failing test for password hashing |
|
|
905
|
+
| `refactor` | Code cleanup, no behavior change (TDD REFACTOR phase) | refactor(08-02): extract validation to helper |
|
|
906
|
+
| `perf` | Performance improvement | perf(08-02): add database index for user lookups |
|
|
907
|
+
| `docs` | Documentation changes | docs(08-02): add API endpoint documentation |
|
|
908
|
+
| `style` | Formatting, linting fixes | style(08-02): format auth module |
|
|
909
|
+
| `chore` | Config, tooling, dependencies | chore(08-02): add bcrypt dependency |
|
|
910
|
+
|
|
911
|
+
**4. Craft commit message:**
|
|
912
|
+
|
|
913
|
+
Format: `{type}({phase}-{plan}): {task-name-or-description}`
|
|
914
|
+
|
|
915
|
+
```bash
|
|
916
|
+
git commit -m "{type}({phase}-{plan}): {concise task description}
|
|
917
|
+
|
|
918
|
+
- {key change 1}
|
|
919
|
+
- {key change 2}
|
|
920
|
+
- {key change 3}
|
|
921
|
+
"
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
**Examples:**
|
|
925
|
+
|
|
926
|
+
```bash
|
|
927
|
+
# Standard plan task
|
|
928
|
+
git commit -m "feat(08-02): create user registration endpoint
|
|
929
|
+
|
|
930
|
+
- POST /auth/register validates email and password
|
|
931
|
+
- Checks for duplicate users
|
|
932
|
+
- Returns JWT token on success
|
|
933
|
+
"
|
|
934
|
+
|
|
935
|
+
# Another standard task
|
|
936
|
+
git commit -m "fix(08-02): correct email validation regex
|
|
937
|
+
|
|
938
|
+
- Fixed regex to accept plus-addressing
|
|
939
|
+
- Added tests for edge cases
|
|
940
|
+
"
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
**Note:** TDD plans have their own commit pattern (test/feat/refactor for RED/GREEN/REFACTOR phases). See `<tdd_plan_execution>` section above.
|
|
944
|
+
|
|
945
|
+
**5. Record commit hash:**
|
|
946
|
+
|
|
947
|
+
After committing, capture hash for SUMMARY.md:
|
|
948
|
+
|
|
949
|
+
```bash
|
|
950
|
+
TASK_COMMIT=$(git rev-parse --short HEAD)
|
|
951
|
+
echo "Task ${TASK_NUM} committed: ${TASK_COMMIT}"
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
Store in array or list for SUMMARY generation:
|
|
955
|
+
```bash
|
|
956
|
+
TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
**Atomic commit benefits:**
|
|
960
|
+
- Each task independently revertable
|
|
961
|
+
- Git bisect finds exact failing task
|
|
962
|
+
- Git blame traces line to specific task context
|
|
963
|
+
- Clear history for Claude in future sessions
|
|
964
|
+
- Better observability for AI-automated workflow
|
|
965
|
+
|
|
966
|
+
</task_commit>
|
|
864
967
|
|
|
865
968
|
<step name="checkpoint_protocol">
|
|
866
969
|
When encountering `type="checkpoint:*"`:
|
|
@@ -1181,16 +1284,11 @@ ROADMAP_FILE=".planning/ROADMAP.md"
|
|
|
1181
1284
|
- Add completion date
|
|
1182
1285
|
</step>
|
|
1183
1286
|
|
|
1184
|
-
<step name="
|
|
1185
|
-
Commit plan
|
|
1186
|
-
|
|
1187
|
-
**Critical: Stage only files this plan actually modified.**
|
|
1188
|
-
|
|
1189
|
-
NEVER use:
|
|
1287
|
+
<step name="git_commit_metadata">
|
|
1288
|
+
Commit plan metadata (SUMMARY + STATE + ROADMAP):
|
|
1190
1289
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
- `git add src/` or any broad directory add
|
|
1290
|
+
**Note:** All task code has already been committed during execution (one commit per task).
|
|
1291
|
+
This final commit captures plan completion metadata only.
|
|
1194
1292
|
|
|
1195
1293
|
**1. Stage planning artifacts:**
|
|
1196
1294
|
|
|
@@ -1203,45 +1301,73 @@ git add .planning/STATE.md
|
|
|
1203
1301
|
**2. Stage roadmap file:**
|
|
1204
1302
|
|
|
1205
1303
|
```bash
|
|
1206
|
-
|
|
1207
|
-
git add .planning/ROADMAP.md
|
|
1208
|
-
else
|
|
1209
|
-
git add .planning/ROADMAP.md
|
|
1210
|
-
fi
|
|
1304
|
+
git add .planning/ROADMAP.md
|
|
1211
1305
|
```
|
|
1212
1306
|
|
|
1213
|
-
**3.
|
|
1214
|
-
|
|
1215
|
-
**4. Verify staging before commit:**
|
|
1307
|
+
**3. Verify staging:**
|
|
1216
1308
|
|
|
1217
1309
|
```bash
|
|
1218
1310
|
git status
|
|
1219
|
-
#
|
|
1311
|
+
# Should show only planning artifacts, no code files
|
|
1220
1312
|
```
|
|
1221
1313
|
|
|
1222
|
-
**
|
|
1314
|
+
**4. Commit metadata:**
|
|
1223
1315
|
|
|
1224
1316
|
```bash
|
|
1225
1317
|
git commit -m "$(cat <<'EOF'
|
|
1226
|
-
|
|
1318
|
+
docs({phase}-{plan}): complete [plan-name] plan
|
|
1319
|
+
|
|
1320
|
+
Tasks completed: [N]/[N]
|
|
1321
|
+
- [Task 1 name]
|
|
1322
|
+
- [Task 2 name]
|
|
1323
|
+
- [Task 3 name]
|
|
1227
1324
|
|
|
1228
|
-
-
|
|
1229
|
-
- [Key accomplishment 2]
|
|
1230
|
-
- [Key accomplishment 3]
|
|
1325
|
+
SUMMARY: .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md
|
|
1231
1326
|
EOF
|
|
1232
1327
|
)"
|
|
1233
1328
|
```
|
|
1234
1329
|
|
|
1235
|
-
|
|
1330
|
+
**Example:**
|
|
1331
|
+
|
|
1332
|
+
```bash
|
|
1333
|
+
git commit -m "$(cat <<'EOF'
|
|
1334
|
+
docs(08-02): complete user registration plan
|
|
1335
|
+
|
|
1336
|
+
Tasks completed: 3/3
|
|
1337
|
+
- User registration endpoint
|
|
1338
|
+
- Password hashing with bcrypt
|
|
1339
|
+
- Email confirmation flow
|
|
1340
|
+
|
|
1341
|
+
SUMMARY: .planning/phases/08-user-auth/08-02-registration-SUMMARY.md
|
|
1342
|
+
EOF
|
|
1343
|
+
)"
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
**Git log after plan execution:**
|
|
1347
|
+
|
|
1348
|
+
```
|
|
1349
|
+
abc123f docs(08-02): complete user registration plan
|
|
1350
|
+
def456g feat(08-02): add email confirmation flow
|
|
1351
|
+
hij789k feat(08-02): implement password hashing with bcrypt
|
|
1352
|
+
lmn012o feat(08-02): create user registration endpoint
|
|
1353
|
+
```
|
|
1354
|
+
|
|
1355
|
+
Each task has its own commit, followed by one metadata commit documenting plan completion.
|
|
1356
|
+
|
|
1357
|
+
For commit message conventions, see ~/.claude/get-shit-done/references/git-integration.md
|
|
1236
1358
|
</step>
|
|
1237
1359
|
|
|
1238
1360
|
<step name="update_codebase_map">
|
|
1239
1361
|
**If .planning/codebase/ exists:**
|
|
1240
1362
|
|
|
1241
|
-
Check what changed in this plan:
|
|
1363
|
+
Check what changed across all task commits in this plan:
|
|
1242
1364
|
|
|
1243
1365
|
```bash
|
|
1244
|
-
|
|
1366
|
+
# Find first task commit (right after previous plan's docs commit)
|
|
1367
|
+
FIRST_TASK=$(git log --oneline --grep="feat({phase}-{plan}):" --grep="fix({phase}-{plan}):" --grep="test({phase}-{plan}):" --reverse | head -1 | cut -d' ' -f1)
|
|
1368
|
+
|
|
1369
|
+
# Get all changes from first task through now
|
|
1370
|
+
git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null
|
|
1245
1371
|
```
|
|
1246
1372
|
|
|
1247
1373
|
**Update only if structural changes occurred:**
|
|
@@ -1265,7 +1391,7 @@ Make single targeted edits - add a bullet point, update a path, or remove a stal
|
|
|
1265
1391
|
|
|
1266
1392
|
```bash
|
|
1267
1393
|
git add .planning/codebase/*.md
|
|
1268
|
-
git commit --amend --no-edit # Include in
|
|
1394
|
+
git commit --amend --no-edit # Include in metadata commit
|
|
1269
1395
|
```
|
|
1270
1396
|
|
|
1271
1397
|
**If .planning/codebase/ doesn't exist:**
|
|
@@ -225,7 +225,9 @@ cat .planning/phases/XX-name/${PHASE}-CONTEXT.md 2>/dev/null
|
|
|
225
225
|
</step>
|
|
226
226
|
|
|
227
227
|
<step name="break_into_tasks">
|
|
228
|
-
Decompose phase into tasks
|
|
228
|
+
Decompose phase into tasks and identify TDD candidates.
|
|
229
|
+
|
|
230
|
+
**Standard tasks need:**
|
|
229
231
|
- **Type**: auto, checkpoint:human-verify, checkpoint:decision (human-action rarely needed)
|
|
230
232
|
- **Task name**: Clear, action-oriented
|
|
231
233
|
- **Files**: Which files created/modified (for auto tasks)
|
|
@@ -233,9 +235,9 @@ Decompose phase into tasks. Each task needs:
|
|
|
233
235
|
- **Verify**: How to prove it worked
|
|
234
236
|
- **Done**: Acceptance criteria
|
|
235
237
|
|
|
236
|
-
**TDD detection:** For each task, evaluate TDD fit:
|
|
238
|
+
**TDD detection:** For each potential task, evaluate TDD fit:
|
|
237
239
|
|
|
238
|
-
TDD candidates (
|
|
240
|
+
TDD candidates (create dedicated TDD plans):
|
|
239
241
|
- Business logic with defined inputs/outputs
|
|
240
242
|
- API endpoints with request/response contracts
|
|
241
243
|
- Data transformations, parsing, formatting
|
|
@@ -243,7 +245,7 @@ TDD candidates (add `tdd="true"` to task, include `<test-first>` element):
|
|
|
243
245
|
- Algorithms with testable behavior
|
|
244
246
|
- State machines and workflows
|
|
245
247
|
|
|
246
|
-
|
|
248
|
+
Standard tasks (remain in standard plans):
|
|
247
249
|
- UI layout, styling, visual components
|
|
248
250
|
- Configuration changes
|
|
249
251
|
- Glue code connecting existing components
|
|
@@ -251,15 +253,14 @@ Skip TDD (standard `type="auto"` task):
|
|
|
251
253
|
- Simple CRUD with no business logic
|
|
252
254
|
|
|
253
255
|
**Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
|
|
254
|
-
→ Yes:
|
|
255
|
-
→ No: Standard task
|
|
256
|
+
→ Yes: Create a dedicated TDD plan for this feature (one feature per TDD plan)
|
|
257
|
+
→ No: Standard task in standard plan
|
|
258
|
+
|
|
259
|
+
**Why TDD gets its own plan:** TDD requires 2-3 execution cycles (RED → GREEN → REFACTOR), each with file reads, test runs, and potential debugging. Embedded in a multi-task plan, TDD work consumes 50-60% of context alone, degrading quality for remaining tasks.
|
|
256
260
|
|
|
257
|
-
**Test framework:** If project has no test setup and TDD
|
|
258
|
-
- Detect project type (package.json → Jest, requirements.txt → pytest, etc.)
|
|
259
|
-
- Add minimal test configuration
|
|
260
|
-
- Create example test file to verify setup
|
|
261
|
+
**Test framework:** If project has no test setup and TDD plans are needed, the first TDD plan's RED phase handles framework setup as part of writing the first test.
|
|
261
262
|
|
|
262
|
-
See `~/.claude/get-shit-done/references/tdd.md` for
|
|
263
|
+
See `~/.claude/get-shit-done/references/tdd.md` for TDD plan structure.
|
|
263
264
|
|
|
264
265
|
**Checkpoints:** Visual/functional verification → checkpoint:human-verify. Implementation choices → checkpoint:decision. Manual action (email, 2FA) → checkpoint:human-action (rare).
|
|
265
266
|
|
|
@@ -427,20 +428,7 @@ Phase plan created: .planning/phases/XX-name/{phase}-01-PLAN.md
|
|
|
427
428
|
|
|
428
429
|
If you can't specify Files + Action + Verify + Done, the task is too vague.
|
|
429
430
|
|
|
430
|
-
**
|
|
431
|
-
```xml
|
|
432
|
-
<task type="auto" tdd="true">
|
|
433
|
-
<name>Create price calculator with discount rules</name>
|
|
434
|
-
<files>src/lib/pricing.ts, src/lib/pricing.test.ts</files>
|
|
435
|
-
<test-first>
|
|
436
|
-
Test: calculatePrice applies discounts correctly
|
|
437
|
-
Cases: base 100 + 10% off → 90, base 100 + 20% off + $5 coupon → 75
|
|
438
|
-
</test-first>
|
|
439
|
-
<action>Implement calculatePrice(base, discountPercent, couponAmount). Apply percentage first, then flat amount.</action>
|
|
440
|
-
<verify>npm test -- pricing.test.ts passes</verify>
|
|
441
|
-
<done>Price calculation handles all discount combinations correctly</done>
|
|
442
|
-
</task>
|
|
443
|
-
```
|
|
431
|
+
**TDD candidates get dedicated plans.** If "Create price calculator with discount rules" warrants TDD, create a TDD plan for it. See `~/.claude/get-shit-done/references/tdd.md` for TDD plan structure.
|
|
444
432
|
</task_quality>
|
|
445
433
|
|
|
446
434
|
<anti_patterns>
|
package/package.json
CHANGED