A Claude Code skill that enforces the Red → Green → Refactor TDD cycle for new feature implementations.
/tdd <feature description>
Example:
/tdd implement a modularized Calculator class in JavaScript that adds two numbers
How It Works
The skill locks you into one TDD phase per response — it will never write a test and its implementation at the same time.
Phase 1: RED
Claude writes a failing test file only. No production code is touched.
You run the suite and confirm it fails before moving on.
Phase 2: GREEN
Claude writes the minimum production code to make the failing test pass.
No extra logic, no future-proofing, no speculative methods.
You run the suite and confirm it is green before moving on.
Phase 3: REFACTOR
Claude proposes a cleaned-up version of the code.
The test suite must remain green after every refactor.
Rules
- Tests are written before any production code
- Only external system boundaries are mocked (databases, network APIs) — never internal logic
- Each response does exactly one phase
- Production code does only what the current test demands