tdd

Installation
SKILL.md

TDD

Before RED

Inspect existing tests, public interfaces, and project conventions. Choose the narrowest trustworthy seam yourself; do not ask the user to approve the test layer. A seam is the public boundary where behavior can be driven and observed: a function, API, CLI, UI interaction, or service interface.

The loop

  1. RED — Write one test for the next observable behavior. Run it and confirm it fails for the predicted reason.
  2. GREEN — Write only enough production code to pass that test. Run it, then run the nearest related tests.
  3. REFACTOR — Improve names, structure, and duplication without changing behavior. Keep tests green throughout.

Then choose the next behavior and repeat. Do not write a batch of tests followed by a batch of implementation. One test introduces one behavior; if its name needs and, split it unless those outcomes form one inseparable contract.

Pure refactors

Start from a green safety net. If existing tests do not protect the behavior being preserved, add a characterization test and watch it pass before refactoring. Do not invent a failing behavior test for a behavior-preserving change.

An extracted helper does not earn a test of its own; the behavior test that already covers it is the safety net. A process rule demanding a test per function does not change this. Say that the helper is covered through the existing seam, and never widen the public API to satisfy such a rule.

Installs
9
GitHub Stars
13
First Seen
Jul 13, 2026
tdd — astro-han/skills