Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification — "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
DO NOT write all tests first, then all implementation. This is "horizontal slicing" — treating RED as "write all tests" and GREEN as "write all code."
Correct approach: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle.
Guides test-driven development using a vertical-slice tracer bullet workflow. Use when implementing features, fixing bugs, or writing tests that should drive design. Enforces planning before coding, incremental red-green-refactor cycles, and behavior-based testing through public interfaces. Triggers: "TDD," "test first," "write tests," "tracer bullet," or incremental feature implementation with tests. Source: sadiksaifi/agents.