test-driven-development
Installation
SKILL.md
Essential Principles
Every behavior starts with a failing test. No exceptions — because a test that has never been red cannot confirm it detects the right failure.
- RED first. Write a failing test before any implementation. The test must fail for the right reason (missing behavior, not syntax error). Run it. See it fail.
- GREEN minimally. Write the minimum code to pass the failing test. Nothing more.
- REFACTOR safely. Clean up code while tests stay green. No new behavior during REFACTOR.
- Small cycles. One behavior per RED-GREEN-REFACTOR cycle. If the cycle takes more than a few minutes, the step is too big.
- Run tests constantly. After every RED, GREEN, and REFACTOR step — silent phases hide regressions, so running tests at each boundary proves the phase achieved its goal.
Quick Start
| Situation | First Action |
|---|---|
| No test runner configured | Set one up first — install framework, create test directory, verify runner with a trivial test |
| New feature | Identify the simplest behavior → write a failing test → implement |
| Bugfix | Write a test that reproduces the defect → confirm it fails → fix it |