tdd-loop
Skill1 starsChanged 3 months agoMITView on GitHub
Red-green-refactor procedure for this project. Use when implementing any feature or bugfix, before writing any production code. Trigger on "TDD", "red phase", "green phase", "refactor", "failing test", "make test pass", "tdd loop".
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
- 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
- HM-IT-CODE/forge-skillstheir own version, first seen Jun 9, 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
- HM-IT-CODE/forge-skills★ 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 repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-reviewSkill
- clean-architectureSkill
- decision-recordingSkill
- design-system-checkSkill
- feature-branchingSkill
- finding-dispositionSkill
- git-recoverySkill
- gotcha-recordingSkill
- human-checkpointSkill
- plan-reviewSkill
- plan-writingSkill
- pr-createSkill
- spec-writingSkill
- update-toolkitSkill
- wiki-updateSkill
- worker-dispatchSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Run Red → Green → Refactor → Finish for one Behavior case, then start the next.
- Very specific: line 24
Write one focused test for the case, named after the behavior so it maps back to the case ID (B3 in the name or its description).
- Distinctive: line 25
Run the test command. Confirm the new test fails.
- Distinctive: line 34
Write the smallest code that makes the test pass.
- Very specific: line 35
Place it in the layer architecture.md § Layers assigns, and depend only in the allowed direction.
- Distinctive: line 41
Only while green. One structural change at a time, re-running the tests after each.
- Distinctive: line 46
Leave everything as plain files — you run no git.
“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
Read first
docs/wiki/commands.md— the test command, and the architecture check if the project has one.docs/wiki/architecture.md—## Testing strategy, and## Layersfor where new code goes.docs/wiki/gotchas.md— known test pitfalls.- The entity page — its
## Behaviorsection is the contract.
One case at a time
Run Red → Green → Refactor → Finish for one Behavior case, then start the next. Five tests then five implementations is a change that cannot be bisected, reverted per case, or reviewed without manufacturing findings.
Case states on the entity page: [ ] not started · [~] test written and confirmed failing · [x] passing.
Red
- Write one focused test for the case, named after the behavior so it maps back to the case ID (
B3in the name or its description). - Run the test command. Confirm the new test fails.
- Confirm it fails for the right reason: the behavior is missing — an assertion, or the not-yet-written function or module the case introduces. Not a typo, a fixture error, or an import of something that should already exist. Wrong reason → fix the test and re-run.
- Mark the case
[ ]→[~]. - Quote the failing assertion in your report, not a pass/fail count. "12 tests, 1 failed" is not Red evidence.
The conductor re-proves the case after you finish: your tests must pass with your changes in place, and fail once every non-test file you changed is reverted to the base commit. A test that passes against the unchanged code, or fails with your implementation, is rejected no matter what the report says — so keep every test file, fixture and test helper inside your test paths.
Green
- Write the smallest code that makes the test pass. No future-proofing, no helpers or abstractions the test does not force.
- Place it in the layer
architecture.md § Layersassigns, and depend only in the allowed direction. - Re-run the test command (and the architecture check, if the project has one). The new test passes; nothing else breaks.
- Broke another test → you over-reached. Narrow the change and retry.
Refactor
Only while green. One structural change at a time, re-running the tests after each. Stop at "good enough for this entity's current scope"; never refactor neighbours.
Finish
- Tick the case
[~]→[x]and update the entity page's## Implementationand## Testssections. - Leave everything as plain files — you run no git. The conductor stages exactly the paths you report and commits them as one case.
- Report, for this case: test paths, implementation paths, any wiki paths, the Red assertion, and the final suite result. Call out a refactor separately so it can be committed separately.
Then start the next case at Red.
Stop and report instead of guessing
- The test seems to encode wrong behavior. Never change the test to fit — report that the spec needs changing.
- Green needs code outside the current entity's scope, or a dependency the architecture forbids.
- A design fork the wiki doesn't pre-decide.
- A second attempt on the same mechanism has failed (broken green, refactor explodes, unsolvable test). Stop; describe both attempts and what each ran into. Recovery — a checkpoint, a reset, a re-spec — is the conductor's and the human's call.
Anti-patterns
- Modifying tests to make them pass. Spec → test → code, in that order.
- Bulk green. One test, one change.
- Refactor before green.
- Skipping the failure-reason check. A test that fails on a broken import is not Red.
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.

