tdd
Skill3 starsChanged 3 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.
Adopted by
Most recently taken up by
- F3-Nation/f3-nationtheir own version, first seen Nov 30, 2026
- quarkiverse/quarkus-reactive-messaging-nats-jetstreamtheir own version, first seen Nov 30, 2026
- Rain-kl/OpenFlaretheir own version, first seen Nov 30, 2026
- Forget-C/Jellyfishtheir own version, first seen Nov 29, 2026
- karanmrn/karanagentskillstheir own version, first seen Nov 29, 2026
- karanmrn/kstacktheir own version, first seen Nov 29, 2026
Used with
Projects with it also use capture-learning-tools, design-frontend-dev 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.
The-Vibe-CompanySkillcapture-learning-tools
Turn technical conversations, bugs, CI failures, review comments,
Also in 5 projects that use this
The-Vibe-CompanySkilldesign-frontend-dev
Clean Impeccable frontend design skill. Use when the user wants to
Also in 5 projects that use this
jaydubya818Skillfigure-it-out
Use when novel or multi-phase work needs an auditable workflow and no narrower playbook fits.
Also in 66 projects that use this
shiwenbin1617Skillketchup-video
Catch the user up like /ketchup, with a short subtitled video of slides for what happened and the waiting calls as text under it. Use for /ketchup-video.
Also in 24 projects that use this
simo97Skillrequest-refactor-plan
Use this skill when user wants to create a refactor plan.
Also in 47 projects that use this
jaydubya818Skillprinciple-minimize-reader-load
Apply when layers, wrappers, or hidden state make simple behavior hard to follow.
Also in 57 projects that use this
- +3 more from The-Vibe-Company
- +2 more from jaydubya818
Other versions193 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 193
- mattpocock/skills★ 335ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 41ksame name
- Yeachan-Heo/oh-my-claudecode★ 41ksame name
- trpc/trpc★ 41ksame name
- QuivrHQ/quivr★ 40ksame name
- The-Vibe-Company/quivr★ 40ksame name
- ccusage/ccusage★ 20ksame name
- ryoppippi/ccusage★ 20ksame name
- MODSetter/SurfSense★ 17ksame name
- open-metadata/OpenMetadata★ 16ksame name
183 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 189 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 189 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.

