tdd
Test-Driven Development
TDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.
When exploring the codebase, read GLOSSARY.md (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
What a good test is
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, and it survives refactors because it doesn't care about internal structure.
For game or simulation rules, rule tests prove the rules correct, not balanced. Write at least one test that drives the rules through the production movement or interaction model with degenerate strategies (do nothing, camp the best spot, sweep mechanically, one active Player with the rest idle) and assert each scores clearly below an attentive strategy. The driver takes its inputs from the production helpers rather than restating them, and is no better than a real player: it travels, and it does not act everywhere on one tick.
See tests.md for examples and mocking.md for mocking guidelines.
Seams: where tests go
A seam is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.
Test only at pre-agreed seams. Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. Under a plan the user approved, the seams the module's existing specs already test at count as agreed: state them in one line before the first test and go ahead. Ask only for a new seam, or when the module has no spec. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.