get-shit-done-cc 1.3.13 → 1.3.15

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.
@@ -27,6 +27,7 @@ Uses intelligent segmentation:
27
27
  @~/.claude/get-shit-done/workflows/execute-phase.md
28
28
  @~/.claude/get-shit-done/templates/summary.md
29
29
  @~/.claude/get-shit-done/references/checkpoints.md
30
+ @~/.claude/get-shit-done/references/tdd.md
30
31
  </execution_context>
31
32
 
32
33
  <context>
@@ -25,6 +25,7 @@ Output: One or more PLAN.md files in the phase directory (.planning/phases/XX-na
25
25
  @~/.claude/get-shit-done/references/plan-format.md
26
26
  @~/.claude/get-shit-done/references/scope-estimation.md
27
27
  @~/.claude/get-shit-done/references/checkpoints.md
28
+ @~/.claude/get-shit-done/references/tdd.md
28
29
  </execution_context>
29
30
 
30
31
  <context>
@@ -243,6 +243,43 @@ 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
+ <tdd_annotation>
247
+ Tasks can include `tdd="true"` attribute when TDD improves quality:
248
+
249
+ **Structure:**
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
+ ```
260
+
261
+ **When to add tdd="true":**
262
+ - Business logic with defined inputs/outputs
263
+ - API endpoints with request/response contracts
264
+ - Data transformations and parsing
265
+ - Validation rules
266
+ - Algorithms with testable behavior
267
+
268
+ **When NOT to add tdd="true":**
269
+ - UI layout and styling
270
+ - Configuration changes
271
+ - Glue code connecting existing components
272
+ - One-off scripts
273
+
274
+ **Execution flow (when tdd="true"):**
275
+ 1. Claude writes failing test from `<test-first>`
276
+ 2. Claude implements from `<action>` until test passes
277
+ 3. Claude refactors if needed (tests still pass)
278
+ 4. Claude commits atomic change
279
+
280
+ See `./tdd.md` for comprehensive TDD guidance.
281
+ </tdd_annotation>
282
+
246
283
  <context_references>
247
284
  Use @file references to load context for the prompt:
248
285
 
@@ -347,6 +384,26 @@ Claude: "How? What type? What library? Where?"
347
384
  Claude can implement this immediately.
348
385
  </just_right>
349
386
 
387
+ <tdd_example>
388
+ TDD task example:
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
+ ```
403
+
404
+ Claude executes this with RED → GREEN → REFACTOR cycle, producing atomic commits.
405
+ </tdd_example>
406
+
350
407
  <too_detailed>
351
408
  Writing the actual code in the plan. Trust Claude to implement from clear instructions.
352
409
  </too_detailed>
@@ -0,0 +1,168 @@
1
+ <overview>
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
+
4
+ **Principle:** If you can describe the behavior as `expect(fn(input)).toBe(output)` before writing `fn`, TDD improves the result.
5
+ </overview>
6
+
7
+ <detection>
8
+ ## When TDD Improves Quality
9
+
10
+ **TDD candidates (add `tdd="true"`, include `<test-first>`):**
11
+ - Business logic with defined inputs/outputs
12
+ - API endpoints with request/response contracts
13
+ - Data transformations, parsing, formatting
14
+ - Validation rules and constraints
15
+ - Algorithms with testable behavior
16
+ - State machines and workflows
17
+ - Utility functions with clear specifications
18
+
19
+ **Skip TDD (standard `type="auto"`):**
20
+ - UI layout, styling, visual components
21
+ - Configuration changes
22
+ - Glue code connecting existing components
23
+ - One-off scripts and migrations
24
+ - Simple CRUD with no business logic
25
+ - Exploratory prototyping
26
+
27
+ **Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
28
+ → Yes: TDD will help
29
+ → No: Implement first, add tests after if needed
30
+ </detection>
31
+
32
+ <execution_flow>
33
+ ## Red-Green-Refactor Cycle
34
+
35
+ **RED - Write failing test:**
36
+ 1. Create test file following project conventions
37
+ 2. Write test describing expected behavior (from `<test-first>` element)
38
+ 3. Run test - it MUST fail
39
+ 4. If test passes: feature exists or test is wrong. Investigate.
40
+ 5. Commit: `test: add failing test for [feature]`
41
+
42
+ **GREEN - Implement to pass:**
43
+ 1. Write minimal code to make test pass
44
+ 2. No cleverness, no optimization - just make it work
45
+ 3. Run test - it MUST pass
46
+ 4. Commit: `feat: implement [feature]`
47
+
48
+ **REFACTOR (if needed):**
49
+ 1. Clean up implementation if obvious improvements exist
50
+ 2. Run tests - MUST still pass
51
+ 3. Only commit if changes made: `refactor: clean up [feature]`
52
+
53
+ **Atomic commits:** Each TDD task produces 2-3 commits following this pattern.
54
+ </execution_flow>
55
+
56
+ <test_quality>
57
+ ## Good Tests vs Bad Tests
58
+
59
+ **Test behavior, not implementation:**
60
+ - Good: "returns formatted date string"
61
+ - Bad: "calls formatDate helper with correct params"
62
+ - Tests should survive refactors
63
+
64
+ **One concept per test:**
65
+ - Good: Separate tests for valid input, empty input, malformed input
66
+ - Bad: Single test checking all edge cases with multiple assertions
67
+
68
+ **Descriptive names:**
69
+ - Good: "should reject empty email", "returns null for invalid ID"
70
+ - Bad: "test1", "handles error", "works correctly"
71
+
72
+ **No implementation details:**
73
+ - Good: Test public API, observable behavior
74
+ - Bad: Mock internals, test private methods, assert on internal state
75
+ </test_quality>
76
+
77
+ <framework_setup>
78
+ ## Test Framework Setup (If None Exists)
79
+
80
+ When a TDD task exists but no test framework is configured:
81
+
82
+ **1. Detect project type:**
83
+ ```bash
84
+ # JavaScript/TypeScript
85
+ if [ -f package.json ]; then echo "node"; fi
86
+
87
+ # Python
88
+ if [ -f requirements.txt ] || [ -f pyproject.toml ]; then echo "python"; fi
89
+
90
+ # Go
91
+ if [ -f go.mod ]; then echo "go"; fi
92
+
93
+ # Rust
94
+ if [ -f Cargo.toml ]; then echo "rust"; fi
95
+ ```
96
+
97
+ **2. Install minimal framework:**
98
+ | Project | Framework | Install |
99
+ |---------|-----------|---------|
100
+ | Node.js | Jest | `npm install -D jest @types/jest ts-jest` |
101
+ | Node.js (Vite) | Vitest | `npm install -D vitest` |
102
+ | Python | pytest | `pip install pytest` |
103
+ | Go | testing | Built-in |
104
+ | Rust | cargo test | Built-in |
105
+
106
+ **3. Create config if needed:**
107
+ - Jest: `jest.config.js` with ts-jest preset
108
+ - Vitest: `vitest.config.ts` with test globals
109
+ - pytest: `pytest.ini` or `pyproject.toml` section
110
+
111
+ **4. Verify setup:**
112
+ ```bash
113
+ # Run empty test suite - should pass with 0 tests
114
+ npm test # Node
115
+ pytest # Python
116
+ go test ./... # Go
117
+ cargo test # Rust
118
+ ```
119
+
120
+ **5. Create first test file:**
121
+ Follow project conventions for test location:
122
+ - `*.test.ts` / `*.spec.ts` next to source
123
+ - `__tests__/` directory
124
+ - `tests/` directory at root
125
+ </framework_setup>
126
+
127
+ <error_handling>
128
+ ## Error Handling
129
+
130
+ **Test doesn't fail in RED phase:**
131
+ - Feature may already exist - investigate
132
+ - Test may be wrong (not testing what you think)
133
+ - Fix before proceeding
134
+
135
+ **Test doesn't pass in GREEN phase:**
136
+ - Debug implementation
137
+ - Don't skip to next task
138
+ - Keep iterating until green
139
+
140
+ **Tests fail in REFACTOR phase:**
141
+ - Undo refactor
142
+ - Commit was premature
143
+ - Refactor in smaller steps
144
+
145
+ **Unrelated tests break:**
146
+ - Stop and investigate
147
+ - May indicate coupling issue
148
+ - Fix before proceeding
149
+ </error_handling>
150
+
151
+ <commit_pattern>
152
+ ## Commit Pattern for TDD Tasks
153
+
154
+ Each TDD task produces atomic commits:
155
+
156
+ ```
157
+ test: add failing test for email validation
158
+
159
+ feat: implement email validation
160
+
161
+ refactor: extract regex to constant (optional)
162
+ ```
163
+
164
+ This pattern:
165
+ - Creates clean git history
166
+ - Each commit is independently revertable
167
+ - Shows TDD discipline in commit log
168
+ </commit_pattern>
@@ -439,6 +439,10 @@ Execute each task in the prompt. **Deviations are normal** - handle them automat
439
439
 
440
440
  **If `type="auto"`:**
441
441
 
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 multiple atomic commits
444
+ - If no: Standard implementation with single commit
445
+
442
446
  - Work toward task completion
443
447
  - **If CLI/API returns authentication error:** Handle as authentication gate (see below)
444
448
  - **When you discover additional work not in plan:** Apply deviation rules (see below) automatically
@@ -810,6 +814,54 @@ Logged to .planning/ISSUES.md for future consideration:
810
814
 
811
815
  </deviation_documentation>
812
816
 
817
+ <tdd_execution>
818
+ ## TDD Task Execution
819
+
820
+ When executing a task with `tdd="true"` attribute:
821
+
822
+ **1. Check test infrastructure:**
823
+ If no test framework configured:
824
+ - Detect project type from package.json/requirements.txt/etc.
825
+ - Install minimal test framework (Jest, pytest, Go testing, etc.)
826
+ - Create test config file
827
+ - Verify: run empty test suite
828
+
829
+ **2. RED - Write failing test:**
830
+ - Read `<test-first>` element for test specification
831
+ - Create test file if doesn't exist (follow project conventions)
832
+ - Write test(s) that describe expected behavior
833
+ - Run tests - MUST fail (if passes, test is wrong or feature exists)
834
+ - Commit: "test: add failing test for [feature]"
835
+
836
+ **3. GREEN - Implement to pass:**
837
+ - Read `<action>` element for implementation guidance
838
+ - Write minimal code to make test pass
839
+ - Run tests - MUST pass
840
+ - Commit: "feat: implement [feature]"
841
+
842
+ **4. REFACTOR (if needed):**
843
+ - Clean up code if obvious improvements
844
+ - Run tests - MUST still pass
845
+ - Commit only if changes made: "refactor: clean up [feature]"
846
+
847
+ **Commit pattern for TDD tasks:**
848
+ Each TDD task produces 2-3 atomic commits:
849
+ 1. `test: add failing test for X`
850
+ 2. `feat: implement X`
851
+ 3. `refactor: clean up X` (optional)
852
+
853
+ **Error handling:**
854
+ - 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, don't skip to next task.
856
+ - If tests fail in REFACTOR phase: Undo refactor, commit was premature.
857
+
858
+ **Verification:**
859
+ After TDD task completion, ensure:
860
+ - All tests pass
861
+ - Test coverage for the new behavior exists
862
+ - No unrelated tests broken
863
+ </tdd_execution>
864
+
813
865
  <step name="checkpoint_protocol">
814
866
  When encountering `type="checkpoint:*"`:
815
867
 
@@ -19,8 +19,9 @@ Decimal phases enable urgent work insertion without renumbering:
19
19
  2. ~/.claude/get-shit-done/references/plan-format.md
20
20
  3. ~/.claude/get-shit-done/references/scope-estimation.md
21
21
  4. ~/.claude/get-shit-done/references/checkpoints.md
22
- 5. .planning/ROADMAP.md
23
- 6. .planning/PROJECT.md
22
+ 5. ~/.claude/get-shit-done/references/tdd.md
23
+ 6. .planning/ROADMAP.md
24
+ 7. .planning/PROJECT.md
24
25
 
25
26
  **Load domain expertise from ROADMAP:**
26
27
  - Parse ROADMAP.md's `## Domain Expertise` section for paths
@@ -187,7 +188,33 @@ Decompose phase into tasks. Each task needs:
187
188
  - **Verify**: How to prove it worked
188
189
  - **Done**: Acceptance criteria
189
190
 
190
- **TDD fit:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`? Yes (business logic, APIs, validation) → test-first. No (UI layout, config, glue code) → standard implementation.
191
+ **TDD detection:** For each task, evaluate TDD fit:
192
+
193
+ TDD candidates (add `tdd="true"` to task, include `<test-first>` element):
194
+ - Business logic with defined inputs/outputs
195
+ - API endpoints with request/response contracts
196
+ - Data transformations, parsing, formatting
197
+ - Validation rules and constraints
198
+ - Algorithms with testable behavior
199
+ - State machines and workflows
200
+
201
+ Skip TDD (standard `type="auto"` task):
202
+ - UI layout, styling, visual components
203
+ - Configuration changes
204
+ - Glue code connecting existing components
205
+ - One-off scripts and migrations
206
+ - Simple CRUD with no business logic
207
+
208
+ **Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
209
+ → Yes: Add `tdd="true"`, include `<test-first>` describing the failing test
210
+ → No: Standard task, no TDD annotation
211
+
212
+ **Test framework:** If project has no test setup and TDD tasks exist, add a setup task first:
213
+ - Detect project type (package.json → Jest, requirements.txt → pytest, etc.)
214
+ - Add minimal test configuration
215
+ - Create example test file to verify setup
216
+
217
+ See `~/.claude/get-shit-done/references/tdd.md` for complete TDD guidance.
191
218
 
192
219
  **Checkpoints:** Visual/functional verification → checkpoint:human-verify. Implementation choices → checkpoint:decision. Manual action (email, 2FA) → checkpoint:human-action (rare).
193
220
 
@@ -292,6 +319,21 @@ Phase plan created: .planning/phases/XX-name/{phase}-01-PLAN.md
292
319
  - "Set up authentication" / "Make it secure" / "Handle edge cases"
293
320
 
294
321
  If you can't specify Files + Action + Verify + Done, the task is too vague.
322
+
323
+ **Good TDD task:**
324
+ ```xml
325
+ <task type="auto" tdd="true">
326
+ <name>Create price calculator with discount rules</name>
327
+ <files>src/lib/pricing.ts, src/lib/pricing.test.ts</files>
328
+ <test-first>
329
+ Test: calculatePrice applies discounts correctly
330
+ Cases: base 100 + 10% off → 90, base 100 + 20% off + $5 coupon → 75
331
+ </test-first>
332
+ <action>Implement calculatePrice(base, discountPercent, couponAmount). Apply percentage first, then flat amount.</action>
333
+ <verify>npm test -- pricing.test.ts passes</verify>
334
+ <done>Price calculation handles all discount combinations correctly</done>
335
+ </task>
336
+ ```
295
337
  </task_quality>
296
338
 
297
339
  <anti_patterns>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-shit-done-cc",
3
- "version": "1.3.13",
3
+ "version": "1.3.15",
4
4
  "description": "A meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.",
5
5
  "bin": {
6
6
  "get-shit-done-cc": "bin/install.js"