The loop is red → green, where red is a failing oracle case, not a hand-written expectation. This skill defines what makes an oracle case worth keeping, where oracle points go, the anti-patterns, and the loop rules. It assumes the repository method (spec/inventory, corpus, tools/) and the override rules of [integrations/skills/cleanroom-reimplementation](../cleanroom-reimplementation/SKILL.md).
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Tdd?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/climashscape-tdd)
<!-- Adapted from mattpocock/skills (MIT), path skills/engineering/tdd, retrieved 2026-10-09 -->
---
name: tdd
description: Test-driven development where the failing test is a failing oracle. Use when building or fixing behavior test-first under clean-room rules, when the user mentions "red-green-refactor", "golden master", "corpus case", "oracle first", or when working the implement step of the cleanroom-reimplementation loop.
---
# Oracle-first TDD
The loop is red → green, where red is a failing oracle case, not a
hand-written expectation. This skill defines what makes an oracle case
worth keeping, where oracle points go, the anti-patterns, and the loop
rules. It assumes the repository method (spec/inventory, corpus,
tools/) and the override rules of
[integrations/skills/cleanroom-reimplementation](../cleanroom-reimplementation/SKILL.md).
## What a good oracle case is
- It verifies observed behavior through the public surface: the output
file, the rendered frame, the CLI stdout. Never internals.
- Its expected value comes from an independent source of truth: a
reference-produced recording pinned with `tools/corpus.py`, or an
acceptance criterion in the feature spec. It is never recomputed by
the code under test, and never derived from the reference's source
(that would breach R1).
## Oracle points: where checks go
An **oracle point** is a pinned public boundary where behavior is
compared without reaching inside the implementation. Work only at
oracle points declared in the feature spec's testing decisions; give
each a one-line note on what it catches and what it misses. Prefer the
fewest, highest oracle points: one end-to-end golden beats five
internal snapshots. A new oracle point is a spec decision, not a
debugging convenience.
## Anti-patterns
- **Implementation-coupled**: asserting internal state or side channels
instead of public outputs, or taking expected values from the
reference's code or decompilation. Tell: the check breaks on refactor
while observed behavior is unchanged — or worse, it "passes" because
it encodes contamination.
- **Tautological**: recording goldens with your own implementation as
the runner, or recomputing expected bytes the way the code does. It
passes by construction and turns the ratchet into theater (failure
catalogue #12). Goldens are recorded from the reference once, then
read-only.
- **Horizontal slicing**: implementing the whole feature and running
all oracles at the end. Work in vertical slices instead: one EARS
requirement line → one oracle case red → minimal implementation →
green → next line.
## Rules of the loop
- **Red before green.** Run the comparison
(`tools/golden_master.py compare`, `tools/pixel_diff.py`, or a corpus
case) and watch this specific case fail before writing implementation
code.
- **One slice per cycle.** One requirement, one oracle case, one
minimal implementation.
- **Refactoring is not part of the loop.** It happens after green, and
a refactor may not lower any floor: re-run
`tools/inventory_parity.py check` and `tools/ratchet.py` after it.
## References
- Verification families and oracle table: `docs/05-verification.md`
- Spec idioms and EARS lines: `docs/03-specifications.md`
- Failure catalogue rows 1 (fake completion) and 12 (metric gaming):
`docs/10-failure-modes.md`
- Tool usage: `tools/README.md`