tdd
Skill3 starsChanged 2 months agoMITView on GitHub
Use when implementing any feature, bug fix, refactor, or behavior change, before writing production code.
193 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- mattpocock/skillstheir own version, first seen Oct 8, 2026
- rafaelob/pragmatic-agent-skillstheir own version, first seen Oct 5, 2026
- AlexisBalayre/claude-code-configtheir own version, first seen Oct 5, 2026
- KroxiDev/engineering-skillstheir own version, first seen Oct 5, 2026
- gaia-react/gaiatheir own version, first seen Oct 5, 2026
- uzairansaruzi/p3-stacktheir own version, first seen Oct 5, 2026
Used with
Projects with it also use make-bot-ui, Poteto Mode and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
eryzerzSkillmake-bot-ui
Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.
Also in 8 projects that use this
jtarorehSkillPoteto Mode
poteto's agent style for concise, detailed responses, deliberate subagents, unslopped prose, simple code, and verified work. Use for poteto, /poteto-mode, or requests to work in this style.
Also in 5 projects that use this
risadamsSkillwhich-skill
Router over this pack's skills and flows. Ask it "which skill fits X" when you don't remember what's available.
Also in 7 projects that use this
TheOnlyFusionCubeSkillprinciple-attack-the-premise
Inventory who actually owns or exhibits the imbalance, then challenge the shared premise before writing another patch. Use when two or more fixes that share one premise have failed the same gate.
Also in 11 projects that use this
TheOnlyFusionCubeSkillprinciple-test-behavior-not-implementation
Call the system the way its consumer does and assert meaningful observable output; avoid mocks or assertions that only mirror internal calls. Use when when writing or evaluating tests.
Also in 11 projects that use this
shreyT19Skillprinciple-laziness-protocol
Apply when refactoring, evaluating diff size, or tempted to add abstractions, layers, or signal threading. Bias toward deletion and the smallest change that solves the problem.
Also in 22 projects that use this
Other versions193 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- Guild-Agents/guild★ 411% same
Wrote their own version · 192
- mattpocock/skills★ 335ksame name
- Yeachan-Heo/oh-my-claudecode★ 40ksame name
- open-metadata/OpenMetadata★ 15ksame name
- vinvcn/mattpocock-skills-zh-CN★ 4.6ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- rohitg00/pro-workflow★ 2.9ksame name
- crbnos/carbon★ 2.7ksame name
- codeaholicguy/ai-devkit★ 1.6ksame name
- backnotprop/pstack★ 991same name
- kdlbs/kandev★ 899same name
182 more not listed
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 repository11 other files it gives its agents.
- commit-and-pushSkill
- debugSkill
- exploreSkill
- grillSkill
- issueSkill
- reviewSkill
- solidSkill
- test-designSkill
- using-creedSkill
- write-planSkill
- write-specSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 12 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 177 edited versions we read keep these.
12
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
REQUIRED COMPANION: use test-design for *what* to feed, assert, and mock.
- Distinctive: line 36
Don't keep it as "reference"
- Distinctive: line 37
Don't "adapt" it while writing tests
- Distinctive: line 38
Don't look at it
- Distinctive: line 79
Run the targeted test. Confirm:
- Distinctive: line 83
If it passes immediately → you're testing existing behavior or asserting nothing real — fix the test
- Distinctive: line 84
If it errors → fix the harness, re-run until it fails correctly
- Distinctive: line 92
Run again. All related tests pass.
- Distinctive: line 96
Only after green: names, duplication, helpers.
- Distinctive: line 126
Test written after implementation
- Distinctive: line 127
Test passes on first run
- Distinctive: line 138
Test-only methods on production types
“Common” is measured: kept by at least 6 in 10 of the 177 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
Output language: answer and write artifacts in the user's own language (match their messages, not the repo's history).
Overview
Write the test first. Watch it fail. Write the minimal code to pass. Refactor.
Core principle: if you didn't watch the test fail, you don't know it tests the right thing.
REQUIRED COMPANION: use test-design for what to feed, assert, and mock. This skill is only the rhythm. Formalistic RED tests are still forbidden — a failing theater test proves nothing.
When to Use
Always: new features, bug fixes, refactoring, behavior changes.
Exceptions (ask the human first): throwaway prototypes, generated code, pure config with no behavior.
Thinking "skip TDD just this once"? Stop — that's rationalization.
The Iron Law (non-negotiable)
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRSTWrote code before the test? Delete it. Start over.
No exceptions:
- Don't keep it as "reference"
- Don't "adapt" it while writing tests
- Don't look at it
- Delete means delete
Violating the letter is violating the spirit.
Workflow (when invoked)
Announce "Using tdd to …", then one todo per cycle step:
- RED — one failing behavior test (apply test-design: contract, narrow asserts, hand-written
expected) - Verify RED — run it; confirm fail for the right reason (missing feature, not typo/error)
- GREEN — minimal production code to pass
- Verify GREEN — run it; all relevant tests pass; output pristine
- REFACTOR — clean up; stay green; no new behavior
- Repeat — next behavior → next RED
Bug found later? Write a failing reproduction test first, then the same cycle.
Red → Green → Refactor
RED — write one failing test
One behavior. Clear name (role + scenario + expectation). Real collaborators unless IO forces a Fake/Recording (see test-design).
test("retries failed operations 3 times", async () => {
let attempts = 0
const operation = () => {
attempts++
if (attempts < 3) throw new Error("fail")
return "success"
}
expect(await retryOperation(operation)).toBe("success")
expect(attempts).toBe(3)
})Bad: vague name, asserts only on mock call counts, or expected computed with production logic.
Verify RED — mandatory
Run the targeted test. Confirm:
- Fails (not errors out from typos/imports)
- Failure message matches the missing behavior
- If it passes immediately → you're testing existing behavior or asserting nothing real — fix the test
- If it errors → fix the harness, re-run until it fails correctly
GREEN — minimal code
Simplest code that passes. No extra features, no drive-by refactors, no YAGNI options objects.
Verify GREEN — mandatory
Run again. All related tests pass. No new warnings/errors ignored.
REFACTOR
Only after green: names, duplication, helpers. Keep tests green. Don't add behavior (new behavior → new RED).
Good vs bad tests (rhythm lens)
| Good | Bad | |
| Size | One behavior; "and" in the name → split | Kitchen-sink test |
| Name | Describes observable behavior | test1 / works |
| Proof | You saw RED for the right reason | Passed on first run |
| Depth | Asserts contract (test-design) | Only toHaveBeenCalled / coverage lighting |
Rationalization Table
| Excuse | Reality |
| "I'll test after to verify" | Passes immediately prove nothing. You never saw it catch the bug. |
| "Tests after achieve the same goals" | After = "what does this do?" First = "what should this do?" |
| "Already manually tested" | Ad-hoc, no record, can't re-run. |
| "Too simple to test" | Simple code breaks. A focused test is cheap. |
| "Deleting X hours is wasteful" | Sunk cost. Unverified code is debt. Delete and restart. |
| "Keep as reference / adapt while testing" | That's testing after. Delete means delete. |
| "Need to explore first" | Explore, then throw away exploration; start TDD clean. |
| "TDD slows me down" | Debugging in prod is slower. Pragmatic = test-first. |
| "Hard to test" | Design smell. Simplify the interface (test-design § hard-to-test). |
| "Existing code has no tests" | You're changing it — add the failing test for the behavior you touch. |
| "Just this once / spirit not ritual" | Letter = spirit. No exceptions without the human. |
Red Flags — delete code and restart
- Production code before a failing test
- Test written after implementation
- Test passes on first run
- Can't explain why RED failed
--no-verify/ skipping the test run "to save time"- Keeping pre-test code as "reference"
- "Pragmatic shortcut" / "this is different because…"
Any hit → delete the production code. Start over at RED.
Anti-patterns (quick)
- Testing mock behavior instead of the unit
- Test-only methods on production types
- Mocking a pile of neighbors (usually glue → prefer integration, or redesign — test-design §1/§5)
Checklist (per behavior)
- Worth a real test? (test-design ROI) — else don't fake TDD on glue
- RED written from contract; watched fail for the right reason
- GREEN is minimal; verify pass
- REFACTOR stays green; no new behavior smuggled in
- Mocks only for external world; asserts are narrow and hard
Hand-off
Transition gate — when a feature slice is done (or before leaving tdd), ask the user (one AskUserQuestion; never auto-advance):
A) Recommended: Proceed → review (then commit-and-push)
B) Review first — run **review** on the code slice (`references/code.md`; upstream = plan tasks / spec), then return to this gate
C) Adjust — back into a tdd RED→GREEN cycle for the issue, then return to this gate
D) Something else (I will type it)- Case quality unclear → test-design
- Boundaries / mock piles → solid
- Feature shape unclear → grill → write-spec first, then TDD
- To ship → review then commit-and-push
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.

