What problem does it solve?
Test-Driven Development (TDD) prevents shipping incorrect code by forcing you to define expected behavior up front, then verify it repeatedly as you implement and refactor.
Core Features & Use Cases
- Failing-test-first workflow: Write a minimal test that demonstrates the missing behavior, then confirm it fails before any production code is written.
- Red-Green-Refactor discipline: Implement the smallest change to make the test pass, re-run the full test suite, then refactor without adding new behavior.
- Anti-rationalization guardrails: Detect and correct common shortcuts like writing tests after everything works, testing mock behavior, or skipping the “watch it fail” step.
Use case example: You’re adding a new API behavior—“reject empty email.” You start by writing a test that fails because the feature doesn’t exist yet, implement the smallest validation logic to make it pass, and only then refactor for clarity while ensuring the suite remains green.
Quick Start
Use sp-tdd when starting a new feature or bugfix so you can write a failing test first, then implement only enough code to make it pass.