diff --git a/get-shit-done/references/principles.md b/get-shit-done/references/principles.md index dd38c6a97..4d44d062f 100644 --- a/get-shit-done/references/principles.md +++ b/get-shit-done/references/principles.md @@ -73,6 +73,39 @@ Plans are guides, not straitjackets. During execution: 5. **Log enhancements** - Nice-to-haves, log to Issues, continue + + +Use TDD when the work WOULD benefit from it. Not dogma—pragmatism. + +**TDD candidates (write test first):** +- Business logic with defined inputs/outputs +- API endpoints and handlers +- Data transformations and parsing +- Validation rules +- State machines and workflows +- Anything where you can describe expected behavior before implementing + +**Skip TDD for:** +- UI layout and styling +- Exploratory prototyping +- One-off scripts and migrations +- Configuration changes +- Glue code with no logic + +**Decision heuristic:** +Can you write `expect(fn(input)).toBe(output)` before writing `fn`? +→ Yes: TDD will help +→ No: Write implementation first, add tests after if needed + +**TDD task structure:** +When TDD applies, structure tasks as test-first: +1. Write failing test (red) +2. Implement to pass (green) +3. Refactor if needed + +This is about design quality, not test coverage metrics. + + No enterprise process. No approval gates. diff --git a/get-shit-done/workflows/plan-phase.md b/get-shit-done/workflows/plan-phase.md index 43003d09e..a1cb89b81 100644 --- a/get-shit-done/workflows/plan-phase.md +++ b/get-shit-done/workflows/plan-phase.md @@ -422,6 +422,18 @@ Each task must have: - **Verify**: How to prove it worked - **Done**: Acceptance criteria +**Assess TDD fit for each task:** + +TDD produces better design and catches bugs early. Use it when you can define expected behavior upfront. + +For each task, ask: Can I write `expect(fn(input)).toBe(output)` before writing `fn`? + +→ **Yes** (business logic, APIs, transformations, validation, state machines): + Structure test-first. Task action: "Implement X with TDD—write failing test, then implement to pass." + +→ **No** (UI layout, config, glue code, exploration): + Standard implementation. Add tests after if coverage needed. + **Identify checkpoints:** - Claude automated work needing visual/functional verification? → checkpoint:human-verify