Add TDD guidance to planning workflow
- New <test_driven_when_beneficial> principle in references/principles.md - TDD assessment step in plan-phase.md break_into_tasks - Pragmatic approach: use TDD when behavior is definable upfront 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,39 @@ Plans are guides, not straitjackets. During execution:
|
|||||||
5. **Log enhancements** - Nice-to-haves, log to Issues, continue
|
5. **Log enhancements** - Nice-to-haves, log to Issues, continue
|
||||||
</deviation_rules>
|
</deviation_rules>
|
||||||
|
|
||||||
|
<test_driven_when_beneficial>
|
||||||
|
|
||||||
|
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.
|
||||||
|
</test_driven_when_beneficial>
|
||||||
|
|
||||||
<ship_fast>
|
<ship_fast>
|
||||||
|
|
||||||
No enterprise process. No approval gates.
|
No enterprise process. No approval gates.
|
||||||
|
|||||||
@@ -422,6 +422,18 @@ Each task must have:
|
|||||||
- **Verify**: How to prove it worked
|
- **Verify**: How to prove it worked
|
||||||
- **Done**: Acceptance criteria
|
- **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:**
|
**Identify checkpoints:**
|
||||||
|
|
||||||
- Claude automated work needing visual/functional verification? → checkpoint:human-verify
|
- Claude automated work needing visual/functional verification? → checkpoint:human-verify
|
||||||
|
|||||||
Reference in New Issue
Block a user