tdd-loop
Skill2 starsChanged 5 months agoMITView on GitHub
The strict red→green→refactor loop, mechanically enforced. Write a failing test FIRST (red), capture the failure as a durable artifact, implement minimally (green), capture the pass, then refactor. Round 10 A — the skill 5 files referenced that did not exist.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- milad-ahmd/agent-skillstheir own version, first seen Nov 8, 2026
- OrionArchitekton/orion-skillstheir own version, first seen Nov 2, 2026
- michaelalber/ai-toolkittheir own version, first seen Nov 1, 2026
- daniel-kindl/dkstacktheir own version, first seen Nov 1, 2026
- sbradl/claude-skillstheir own version, first seen Oct 15, 2026
- dagarre00/claude-code-templatetheir own version, first seen Oct 15, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- khuynh22/agent-dev-team★ 9same name
- ramboz/jig★ 7same name
- milad-ahmd/agent-skills★ 5same name
- michaelalber/ai-toolkit★ 3same name
- OrionArchitekton/orion-skills★ 2same name
- dagarre00/claude-code-template★ 1same name
- daniel-kindl/dkstack★ 1same name
- itsmuskanagarwal/claude-pack★ 0same name
- sbradl/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository60 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- analyzeSkill
- animation-disciplineSkill
- api-versioningSkill
- autopilotSkill
- browser-e2eSkill
- characterizeSkill
- clarifySkill
- codemodSkill
- constitution-compactSkill
- constitutionSkill
- context-budgetSkill
- creative-webSkill
- db-migrationSkill
- debugSkill
- detect-stackSkill
- dispatch-criteriaSkill
- dreamSkill
- experimentSkill
- fastapiSkill
- flag-cleanupSkill
- flag-rolloutSkill
- flask-realtimeSkill
- framework-detectorSkill
- front-end-designSkill
- grill-meSkill
- handoffSkill
- image-generationSkill
- implementSkill
- initiativeSkill
- instinctSkill
- loopSkill
- nextjsSkill
- observabilitySkill
- okr-alignSkill
- parallel-swarmSkill
- pivotSkill
- planSkill
- pr-bodySkill
- prime-disciplineSkill
- prod-observabilitySkill
- react-nodeSkill
- react-viteSkill
- release-trainSkill
- researchSkill
- reviewSkill
- security-guardSkill
- self-healSkill
- shipSkill
- skill-creatorSkill
- specifySkill
- tailwind-disciplineSkill
- tasksSkill
- token-budgetSkill
- typographySkill
- verify-loopSkill
- verifySkill
- wip-checkpointSkill
- <kebab-case-skill-name>Skill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 8 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
No production code without a failing test that demanded it.
- Very specific: line 19
Write the test that encodes the spec's acceptance criterion.
- Very specific: line 20
Run the task's accept: command (or the specific test).
- Distinctive: line 22
If the test passes on first run, the test is wrong (asserts nothing, or the behavior already exists).
- Distinctive: line 26
Write the minimum code to make the test pass.
- Distinctive: line 27
Run the same command.
- Distinctive: line 34
Never add behavior here — that needs a new red test.
- Distinctive: line 50
One test, one behavior: Don't batch 5 behaviors into one test.
- Distinctive: line 51
AC-tagged: Every test that proves an acceptance criterion carries its AC id.
- Distinctive: line 53
Minimal green: Don't implement beyond what the red test demands.
- Distinctive: line 71
Test is AC-tagged and contains ≥1 real assertion
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TDD Loop — red → green → refactor, enforced
Mandate
No production code without a failing test that demanded it. The transition from red to green is captured as a durable artifact (verify/<date>/<task>/red.log + green.log), not just pasted in the transcript — so the factory can PROVE the test went red before it went green.
The loop
1. RED — write the failing test first
- Write the test that encodes the spec's acceptance criterion. Tag it with the AC id, UNPADDED (
@AC-1/{ tag: ['@AC-1'] }/ docstringAC-1) — matching the spec template's**AC-1**:form (e2e-audit e2e-rig-3). - Run the task's
accept:command (or the specific test). - Capture the failure:
bash .claude/scripts/tdd-ledger.sh red <task-id> "<accept-command>"→ writesverify/<date>/<task-id>/red.logwith the command + exit code (MUST be non-zero) + output excerpt. - If the test passes on first run, the test is wrong (asserts nothing, or the behavior already exists). Fix the test until it fails for the RIGHT reason.
2. GREEN — implement minimally
- Write the minimum code to make the test pass. No speculative features (CLAUDE.md §I.2 Simplicity First).
- Run the same command.
- Capture the pass:
bash .claude/scripts/tdd-ledger.sh green <task-id> "<accept-command>"→ writesverify/<date>/<task-id>/green.log(exit code MUST be 0).
3. REFACTOR — clean up, stay green
- Improve names, remove duplication, extract helpers.
- Re-run; confirm still green (the green.log timestamp updates).
- Never add behavior here — that needs a new red test.
Enforcement (what makes this real, not honor-system)
| Mechanism | What it catches |
tdd-ledger.sh writes red.log + green.log | Proof the test went red before green; both committed under verify/ |
verify.sh requires both logs for any [x] task | A task marked done without a red→green transition fails the gate |
assert-density.sh (verify.sh + CI) | Assertion-free tests (expect(true).toBe(true)) |
validate.sh accept-is-a-test gate | accept: echo done — accept must invoke a test runner |
story-test-map.sh (wired into verify.sh) | User story without an E2E test |
mutation.yml on critical paths | Tests that pass but don't actually constrain behavior |
Hard rules
- Red before green, always. The ledger proves it. Skipping red = the task fails verify.
- One test, one behavior. Don't batch 5 behaviors into one test.
- AC-tagged. Every test that proves an acceptance criterion carries its AC id.
- Assertions required. A test with no
expect/assertis not a test. - Minimal green. Don't implement beyond what the red test demands.
- Refactor stays green. New behavior in refactor → stop, write a new red test.
The honest ceiling
Tooling proves a test ran red-then-green, contains assertions, and kills mutants. It does NOT prove the test asserts the RIGHT behavior — that the test maps to spec intent rather than to the implementation. That judgment stays with the agent's discipline (this skill) + the reviewer agent reading the diff against the spec. Tooling raises the floor; the reviewer certifies the ceiling.
References
- obra/superpowers:
test-driven-developmentskill (the discipline) - Kent Beck, TDD By Example (red/green/refactor origin)
- Ledger:
.claude/scripts/tdd-ledger.sh - Gate:
.claude/scripts/verify.sh+assert-density.sh
Done means
verify/<date>/<task-id>/red.logexists (exit ≠ 0)verify/<date>/<task-id>/green.logexists (exit = 0)- Test is AC-tagged and contains ≥1 real assertion
- Code is minimal for the test
- Refactor left it green
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

