Testing
10,287 installs
Test-Driven Development (TDD)
by obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
Skill content
Write tests first, watch them fail, then implement minimal code to pass. - Follows the red-green-refactor cycle: write a failing test, verify it fails correctly, implement minimal code to pass, then refactor while keeping tests green - Requires deleting any production code written before tests exist; no exceptions for "reference" or "adaptation" - Emphasizes watching tests fail as proof they actually test the right thing; tests that pass immediately prove nothing - Covers common rationalizations (testing after, manual verification, sunk cost) with concrete rebuttals and a verification checklist to confirm TDD was followed Test-Driven Development (TDD) Overview Write the test first. Watch it fail. Write minimal code to pass. Core principle: If you didn't watch the test fail, you don't know if it tests the right thing. Violating the letter of the rules is violating the spirit of the rules. When to Use Always: - New features - Bug fixes - Refactoring - Behavior changes