test-driven-development
Installation
SKILL.md
Test-Driven Development
This skill governs how you work -- the rhythm of writing tests and code
together. For what makes a good test, see test-design. For design
principles that inform refactoring, see software-design.
Why Test-First
Tests written after implementation are biased by what you built. You unconsciously test the paths you remember and skip the ones you forgot. Tests written first force you to specify behavior before you know the implementation -- catching a different class of bugs. A test that passes immediately has never proven it catches anything.
Three Modes
- Feature Mode -- building new functionality (red-green-refactor cycle)
- Refactor Mode -- protecting existing behavior before restructuring
- Bug Fix Mode -- reproducing a defect before fixing it