principle-tdd
Installation
SKILL.md
Test-Driven Development
The loop
- Red — one failing test describing the next slice of behavior. Run it; confirm it fails for the right reason.
- Green — simplest production code that passes. Hard-coding is allowed — it will be driven out by the next test.
- Refactor — with all tests green, improve the code and the tests. Never refactor on red.
Each cycle is minutes, not hours.
Rule of three
Duplication triggers refactor on the third occurrence. Two is coincidence; three is pattern.
F.I.R.S.T.
- Fast — milliseconds.
- Isolated — independent of order and other tests.
- Repeatable — deterministic anywhere.
- Self-validating — automatic pass/fail.
- Timely — written just before the production code.