get-shit-done-cc 1.3.20 → 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/get-shit-done/references/plan-format.md +14 -40
- package/get-shit-done/references/principles.md +13 -9
- package/get-shit-done/references/scope-estimation.md +21 -0
- package/get-shit-done/references/tdd.md +98 -22
- package/get-shit-done/templates/phase-prompt.md +14 -1
- package/get-shit-done/workflows/execute-phase.md +32 -40
- package/get-shit-done/workflows/plan-phase.md +13 -25
- package/package.json +1 -1
|
@@ -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>
|
|
@@ -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>
|
|
@@ -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,39 +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
|
-
TDD
|
|
215
|
+
TDD plans produce 2-3 atomic commits (one per phase):
|
|
155
216
|
|
|
156
217
|
```
|
|
157
|
-
test(
|
|
218
|
+
test(08-02): add failing test for email validation
|
|
158
219
|
|
|
159
220
|
- Tests valid email formats accepted
|
|
160
221
|
- Tests invalid formats rejected
|
|
161
222
|
- Tests empty input handling
|
|
162
223
|
|
|
163
|
-
feat(
|
|
224
|
+
feat(08-02): implement email validation
|
|
164
225
|
|
|
165
226
|
- Regex pattern matches RFC 5322
|
|
166
227
|
- Returns boolean for validity
|
|
167
228
|
- Handles edge cases (empty, null)
|
|
168
229
|
|
|
169
|
-
refactor(
|
|
230
|
+
refactor(08-02): extract regex to constant (optional)
|
|
170
231
|
|
|
171
232
|
- Moved pattern to EMAIL_REGEX constant
|
|
172
233
|
- No behavior changes
|
|
173
234
|
- Tests still pass
|
|
174
235
|
```
|
|
175
236
|
|
|
176
|
-
**
|
|
177
|
-
-
|
|
178
|
-
- TDD
|
|
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
|
|
179
240
|
|
|
180
241
|
Both follow same format: `{type}({phase}-{plan}): {description}`
|
|
181
242
|
|
|
182
243
|
**Benefits:**
|
|
183
244
|
- Each commit independently revertable
|
|
184
|
-
- Git bisect works at commit level
|
|
245
|
+
- Git bisect works at commit level
|
|
185
246
|
- Clear history showing TDD discipline
|
|
186
247
|
- Consistent with overall commit strategy
|
|
187
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
|
|
|
@@ -815,55 +815,62 @@ Logged to .planning/ISSUES.md for future consideration:
|
|
|
815
815
|
|
|
816
816
|
</deviation_documentation>
|
|
817
817
|
|
|
818
|
-
<
|
|
819
|
-
## TDD
|
|
818
|
+
<tdd_plan_execution>
|
|
819
|
+
## TDD Plan Execution
|
|
820
820
|
|
|
821
|
-
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.
|
|
822
822
|
|
|
823
|
-
**1. Check test infrastructure:**
|
|
823
|
+
**1. Check test infrastructure (if first TDD plan):**
|
|
824
824
|
If no test framework configured:
|
|
825
825
|
- Detect project type from package.json/requirements.txt/etc.
|
|
826
826
|
- Install minimal test framework (Jest, pytest, Go testing, etc.)
|
|
827
827
|
- Create test config file
|
|
828
828
|
- Verify: run empty test suite
|
|
829
|
+
- This is part of the RED phase, not a separate task
|
|
829
830
|
|
|
830
831
|
**2. RED - Write failing test:**
|
|
831
|
-
- Read `<
|
|
832
|
+
- Read `<behavior>` element for test specification
|
|
832
833
|
- Create test file if doesn't exist (follow project conventions)
|
|
833
834
|
- Write test(s) that describe expected behavior
|
|
834
835
|
- Run tests - MUST fail (if passes, test is wrong or feature exists)
|
|
835
|
-
- Commit:
|
|
836
|
+
- Commit: `test({phase}-{plan}): add failing test for [feature]`
|
|
836
837
|
|
|
837
838
|
**3. GREEN - Implement to pass:**
|
|
838
|
-
- Read `<
|
|
839
|
+
- Read `<implementation>` element for guidance
|
|
839
840
|
- Write minimal code to make test pass
|
|
840
841
|
- Run tests - MUST pass
|
|
841
|
-
- Commit:
|
|
842
|
+
- Commit: `feat({phase}-{plan}): implement [feature]`
|
|
842
843
|
|
|
843
844
|
**4. REFACTOR (if needed):**
|
|
844
845
|
- Clean up code if obvious improvements
|
|
845
846
|
- Run tests - MUST still pass
|
|
846
|
-
- Commit only if changes made:
|
|
847
|
+
- Commit only if changes made: `refactor({phase}-{plan}): clean up [feature]`
|
|
847
848
|
|
|
848
|
-
**Commit pattern for TDD
|
|
849
|
-
Each TDD
|
|
850
|
-
1. `test: add failing test for X`
|
|
851
|
-
2. `feat: implement X`
|
|
852
|
-
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)
|
|
853
854
|
|
|
854
855
|
**Error handling:**
|
|
855
856
|
- If test doesn't fail in RED phase: Test is wrong or feature already exists. Investigate before proceeding.
|
|
856
|
-
- 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.
|
|
857
858
|
- If tests fail in REFACTOR phase: Undo refactor, commit was premature.
|
|
858
859
|
|
|
859
860
|
**Verification:**
|
|
860
|
-
After TDD
|
|
861
|
+
After TDD plan completion, ensure:
|
|
861
862
|
- All tests pass
|
|
862
863
|
- Test coverage for the new behavior exists
|
|
863
864
|
- No unrelated tests broken
|
|
864
865
|
|
|
865
|
-
**
|
|
866
|
-
|
|
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>
|
|
867
874
|
|
|
868
875
|
<task_commit>
|
|
869
876
|
## Task Commit Protocol
|
|
@@ -917,7 +924,7 @@ git commit -m "{type}({phase}-{plan}): {concise task description}
|
|
|
917
924
|
**Examples:**
|
|
918
925
|
|
|
919
926
|
```bash
|
|
920
|
-
#
|
|
927
|
+
# Standard plan task
|
|
921
928
|
git commit -m "feat(08-02): create user registration endpoint
|
|
922
929
|
|
|
923
930
|
- POST /auth/register validates email and password
|
|
@@ -925,31 +932,16 @@ git commit -m "feat(08-02): create user registration endpoint
|
|
|
925
932
|
- Returns JWT token on success
|
|
926
933
|
"
|
|
927
934
|
|
|
928
|
-
#
|
|
929
|
-
git commit -m "
|
|
930
|
-
|
|
931
|
-
- Tests token contains user ID claim
|
|
932
|
-
- Tests token expires in 1 hour
|
|
933
|
-
- Tests signature verification
|
|
934
|
-
"
|
|
935
|
-
|
|
936
|
-
# TDD task - GREEN phase
|
|
937
|
-
git commit -m "feat(07-02): implement JWT generation
|
|
935
|
+
# Another standard task
|
|
936
|
+
git commit -m "fix(08-02): correct email validation regex
|
|
938
937
|
|
|
939
|
-
-
|
|
940
|
-
-
|
|
941
|
-
- Signs with HS256 algorithm
|
|
942
|
-
"
|
|
943
|
-
|
|
944
|
-
# TDD task - REFACTOR phase
|
|
945
|
-
git commit -m "refactor(07-02): extract JWT config to constants
|
|
946
|
-
|
|
947
|
-
- Moved expiry time to constant
|
|
948
|
-
- Centralized algorithm selection
|
|
949
|
-
- No behavior changes
|
|
938
|
+
- Fixed regex to accept plus-addressing
|
|
939
|
+
- Added tests for edge cases
|
|
950
940
|
"
|
|
951
941
|
```
|
|
952
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
|
+
|
|
953
945
|
**5. Record commit hash:**
|
|
954
946
|
|
|
955
947
|
After committing, capture hash for SUMMARY.md:
|
|
@@ -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