What problem does it solve?
It prevents unclear requirements and fragile code by guiding you to define behavior as failing tests first, then implement the smallest change to make them pass, and finally improve structure without breaking correctness.
Core Features & Use Cases
- RED phase (Write failing tests): Capture expected behavior, edge cases, and error states so the test genuinely fails before implementation.
- GREEN phase (Minimal passing code): Implement only the simplest production code needed to satisfy the failing test, following the RED→GREEN goal of fast feedback.
- REFACTOR phase (Improve safely): Remove duplication, clarify naming, and simplify structure while keeping all tests green.
- AAA test pattern: Keep tests readable and maintainable by structuring them as Arrange, Act, Assert.
- When to use: Best for new features, bug fixes, and complex logic; less suitable for purely exploratory spikes and mostly UI layout work.
Quick Start
Ask your AI to help you write a failing test first for the behavior you want, then implement the minimal code to make that test pass, and finally refactor while keeping the tests green.