Test-Driven Development
Read CONTEXT.md when present; match domain terms and respect relevant ADRs. See tests.md and mocking.md.
Test Surface
Test behavior through public interfaces, never internals. Tests must read as specifications and survive refactors.
A seam is a public boundary where behavior is observed. Before testing, list proposed seams and confirm them with user. Write no test at an unconfirmed seam.
Reject
- Implementation-coupled tests: private methods, internal mocks, side-channel verification.
- Tautologies: expected value recomputed like production code. Use independent literals, worked examples, or spec facts.
- Horizontal slicing: all tests before all code. Use vertical tracer bullets.
Loop
- Pick one confirmed seam and behavior.
- Write one failing test; observe red.
- Add only enough implementation for green. Avoid speculative behavior.
- Repeat one vertical slice at a time.
Keep refactoring outside red-green cycles; perform it during review after tests pass.