Test-Driven Development

Use before implementing any feature or bug fix.

Iron Rule

No production code without a failing test first.

If you wrote implementation code first, delete it and restart with tests.

Red-Green-Refactor Loop

  1. Red

    • Write one failing test for one behavior.
    • Run it and confirm it fails for the expected reason.
  2. Green

    • Write minimal code to pass that test only.
    • Run the test and confirm pass.
  3. Refactor

    • Improve clarity/duplication while staying green.
    • Re-run tests.

Repeat for the next behavior.

Rules

Project Verification Commands

Use fast-first loop:

typecheck.sh <file>
bild --test <namespace>

Do not claim success until tests pass after your final code changes.