What problem does it solve?
Test-driven development prevents shipping broken or unverified code by forcing you to define expected behavior in a failing test before writing implementation, reducing regressions and wasted rework.
Core Features & Use Cases
- RED-GREEN-REFACTOR discipline: Write a failing test first, implement the smallest change to make it pass, then refactor without adding new behavior.
- Mandatory verification loop: Explicitly run the specific test to confirm failure in RED and success in GREEN, then run the full suite to ensure no regressions.
- Behavior-focused testing: Prefer real behavior (not fragile implementation details), cover edge cases, and avoid rationalizations like “I’ll test after.”
Use Cases:
- New features, bug fixes, and refactors where you want reliable correctness and repeatable validation.
- Subagent development where you need the goal to enforce test-first implementation.
- Systematic debugging where a bug fix must be proven by a new failing test that reproduces the issue.
Quick Start
Tell the agent: “Implement this change using strict TDD: write the failing test first, verify it fails, write the minimal code to pass, verify it passes, then run pytest tests/ -q.”