tdd

Installation
SKILL.md

TDD — Test-First Execution

The Iron Law

No behavior repair without a failing behavioral case first. A captured failure that proves the same defect on the same code counts. A new test that passes on arrival characterizes existing behavior; it proves nothing about a missing one until you have seen it fail against a relevant counterexample.

The loop

One loop per increment of behavior, each small enough to throw away without grief.

  1. Frame the smallest reversible move. One caller-visible increment, smaller than feels natural. If you can't state its outcome in a sentence, split it. Say it while choosing: "the smallest reversible move here is…".
  2. Red. Write the test from the caller's side, predict the failure out loud, run it. A different failure has already taught you something.
  3. Green. The least code that passes; naive is fine. Design waits.
  4. Refactor under green. Fix a concrete design problem, naming its smell (clean-code), and rerun the affected tests before the next behavior change. Assert invariants that must hold: an assertion is executable documentation, and its failure is a bug, never a condition to swallow.
  5. Integrate each coherent, passing increment. When the design needs to turn, steer green-to-green in small refactoring steps.

Control the variables

Installs
62
GitHub Stars
2
First Seen
Jul 30, 2026