tdd-loop
Skill0 starsChanged 6 months agoMITView on GitHub
Drives a strict test-driven development loop for any new behavior or bug fix. Use when the user asks to implement a feature, add functionality, fix a bug, or says "use TDD" / "write tests first". Forbids writing production code before a failing test exists.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- sbradl/claude-skillstheir own version, first seen Sep 10, 2026
- dagarre00/claude-code-templatetheir own version, first seen Sep 7, 2026
- khuynh22/agent-dev-teamtheir own version, first seen Aug 31, 2026
- michaelalber/ai-toolkittheir own version, first seen Jul 30, 2026
- adityaarakeri/senior-agent-skillstheir own version, first seen Jul 22, 2026
- ramboz/jigtheir own version, first seen Jun 22, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- khuynh22/agent-dev-team★ 9same name
- ramboz/jig★ 7same name
- adityaarakeri/senior-agent-skills★ 2same name
- michaelalber/ai-toolkit★ 2same name
- dagarre00/claude-code-template★ 1same 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 repository5 other files it gives its agents.
- ci-pipelineSkill
- dockerizeSkill
- pr-readySkill
- vertical-sliceSkill
- rust-cli-scaffoldSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 11 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
11
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 16
Write the test before any implementation.
- Distinctive: line 17
Run the suite. Confirm the new test fails, and that it fails because the behavior is missing — not because of a typo, import error, or …
- Distinctive: line 20
Write the minimum production code to pass the failing test.
- Distinctive: line 21
Run the full suite. All tests must pass before you continue.
- Distinctive: line 25
Run the suite again after each change.
- Distinctive: line 31
Never: write production code that isn't demanded by a failing test.
- Distinctive: line 33
If a test is hard to write, that's a design signal — the unit under test is probably doing too much.
- Distinctive: line 34
Don't delete or weaken a test to get green.
- Distinctive: line 35
Keep tests fast and isolated.
- Distinctive: line 39
Before the first test, identify the test runner from the project:
- Distinctive: line 45
Use the existing convention in the repo.
“Common” is measured: kept by at least 6 in 10 of the 6 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
You are pairing with an engineer who wants behavior built test-first. Follow the loop below without skipping steps. Do not write production code until a test for it fails for the right reason.
The loop
For each unit of behavior, run Red → Green → Refactor:
- Red — write one failing test.
- Pick the smallest next behavior. One assertion's worth of new intent.
- Write the test before any implementation. It must describe what the code should do, not how.
- Run the suite. Confirm the new test fails, and that it fails because the behavior is missing — not because of a typo, import error, or compile error. Read the failure message out loud (in your reasoning) and verify it's the expected one.
- Green — make it pass with the least code.
- Write the minimum production code to pass the failing test. Hardcoding a return value is acceptable at this stage if it's genuinely the simplest thing.
- Run the full suite. All tests must pass before you continue.
- Refactor — clean up under green.
- With every test passing, improve names, remove duplication, and clarify structure.
- Run the suite again after each change. Never refactor on a red bar.
Then repeat for the next behavior. Small loops beat big ones — aim for cycles of minutes, not hours.
Rules
- Never write production code that isn't demanded by a failing test.
- One failing test at a time. Don't write five tests then implement.
- If a test is hard to write, that's a design signal — the unit under test is probably doing too much. Pause and tell the user before forcing it.
- Don't delete or weaken a test to get green. If a test is wrong, say so explicitly and explain why before changing it.
- Keep tests fast and isolated. No network, no real clock, no shared mutable state unless the behavior under test is that integration.
Detect the stack first
Before the first test, identify the test runner from the project:
- Node/TS:
vitest,jest,node:test— checkpackage.json. - Python:
pytest,unittest. - Rust:
cargo test(#[cfg(test)]modules ortests/). - Go:
go testwith_test.gofiles and table-driven cases.
Use the existing convention in the repo. If none exists, propose one and wait for confirmation.
Output discipline
At each step state which phase you're in (RED / GREEN / REFACTOR), show the test or diff, and report the suite result. End the task only when the suite is fully green and you've offered the next behavior to drive.
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.

