tdd-loop
Skill3 starsChanged 3 months agoMITView on GitHub
The canonical RED-GREEN-REFACTOR inner loop. Enforces behavioral, structure-insensitive tests and prohibits horizontal slicing. Use when writing any new code test-first, managing TDD phase transitions, or as the inner loop for qrspi-implement, qraspi-implement, or any other implementation skill. Do NOT use to audit existing test suites — use evaluate-tests instead.
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
- 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
- qyndex/claude-inittheir own version, first seen Oct 13, 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
- OrionArchitekton/orion-skills★ 2same name
- qyndex/claude-init★ 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 repository86 other files it gives its agents.
- AGENTS.mdAGENTS.md
- project-templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- project-templates/CLAUDE.mdCLAUDE.md
- alembic-migration-managerSkill
- architecture-journalSkill
- architecture-reviewSkill
- automated-code-reviewSkill
- axum-scaffolderSkill
- capture-consolidateSkill
- cargo-package-scaffoldSkill
- code-review-coachSkill
- confluence-guide-writerSkill
- dependency-mapperSkill
- doc-syncSkill
- dotnet-architecture-checklistSkill
- dotnet-controller-api-scaffolderSkill
- dotnet-security-reviewSkill
- dotnet-vertical-sliceSkill
- ef-migration-managerSkill
- email-captureSkill
- environment-healthSkill
- evaluate-testsSkill
- fastapi-scaffolderSkill
- fitness-functionsSkill
- jira-comment-writerSkill
- legacy-migration-analyzerSkill
- minimal-api-scaffolderSkill
- nuget-package-scaffoldSkill
- oss-vettingSkill
- pattern-tradeoff-analyzerSkill
- php-api-scaffolderSkill
- php-architecture-checklistSkill
- php-feature-sliceSkill
- php-migration-managerSkill
- php-package-scaffoldSkill
- php-security-reviewSkill
- pr-feedback-writerSkill
- pypi-package-scaffoldSkill
- python-architecture-checklistSkill
- python-feature-sliceSkill
- python-modernization-analyzerSkill
- python-security-reviewSkill
- qraspi-architectureSkill
- qraspi-graduateSkill
- qraspi-implementSkill
- qraspi-planSkill
- qraspi-questionsSkill
- qraspi-researchSkill
- qraspi-skeletonSkill
- qrspi-implementSkill
- qrspi-planSkill
- qrspi-questionsSkill
- qrspi-researchSkill
- qrspi-specSkill
- react-app-scaffolderSkill
- react-architecture-checklistSkill
- react-component-scaffolderSkill
- react-feature-sliceSkill
- react-modernization-analyzerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Every test must satisfy both before leaving RED:
- Distinctive: line 53
Write ONE failing test for the next smallest observable behavior
- Distinctive: line 54
Run the suite — the new test must fail for a semantic reason (not import/syntax)
- Distinctive: line 55
All other tests must still pass
- Distinctive: line 58
Write the minimum code to pass the failing test — nothing it does not require (no unrequested error handling, config, edge cases, or "while …
- Distinctive: line 59
Prefer: Fake It (hardcode) → Obvious Implementation → Triangulation
- Distinctive: line 60
Run the suite — all tests must pass
- Distinctive: line 65
Run tests after every change — revert immediately if red
“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 (Red-Green-Refactor)
"Write tests that are sensitive to behavior changes, insensitive to structure changes." — Kent Beck
Two Critical Properties
Every test must satisfy both before leaving RED:
| Property | A compliant test... | A violation looks like |
| Behavioral | fails when the observable outcome breaks | assert repo.save.called — verifies a method was called, not what the system produced |
| Structure-insensitive | survives a rename-only or extract-method refactor | assert order._total == 100 — reads internal state; breaks on any rename |
The Failure Mode: Horizontal Slicing
The most common TDD failure in AI-generated code:
# WRONG — horizontal slice
def test_register(): ...
def test_login(): ...
def test_logout(): ...
# ... then all implementation
class Auth: ...# RIGHT — vertical slice
def test_register(): ... # one test
class Auth: # minimal code to pass it
def register(): ...
# refactor → commit → next test
def test_login(): ...Horizontal slicing produces tests that were never red, implementations that were never minimal, and refactoring that was never constrained by a safety net. Never accumulate unimplemented tests.
The Cycle — One test → one implementation → repeat
RED
- Write ONE failing test for the next smallest observable behavior
- Run the suite — the new test must fail for a semantic reason (not import/syntax)
- All other tests must still pass
GREEN
- Write the minimum code to pass the failing test — nothing it does not require (no unrequested error handling, config, edge cases, or "while I'm here" features)
- Prefer: Fake It (hardcode) → Obvious Implementation → Triangulation
- Run the suite — all tests must pass
- Strategies & per-language idioms (.NET/Python/PHP/TS): green idioms on demand; for .NET test structure see
test-scaffold
REFACTOR
- One structural change at a time — behavior must not change (no bug fixes, no new features; those start a new RED)
- Run tests after every change — revert immediately if red
- Smell→refactoring recipes: code smells · refactoring catalog on demand
Per-Cycle Self-Check
- This test was red before I wrote any implementation
- This test asserts an observable outcome, not a method call or internal state
- A rename-only refactor would NOT break this test
- My implementation passes this test and no others I have not written yet
- All tests are green entering REFACTOR
State Block
<tdd-state>
phase: RED | GREEN | REFACTOR
iteration: N
current_test: [test name]
failure_reason: [semantic description — not "syntax error"]
tests_passing: true | false
</tdd-state>Modes & Companions
The one canonical loop (GREEN/REFACTOR depth in references/ above). Companions are modes and audits, not alternatives:
| Need | Skill |
| AI drives all phases autonomously (defers here for mechanics) | tdd-agent |
| Audit test quality or TDD compliance after the fact | evaluate-tests |
| .NET test conventions — xUnit / AAA / mocks | test-scaffold |
| RED before/after examples | Behavioral Examples |
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.

