tdd
Skill246 starsChanged 46 days agoApache-2.0View on GitHub
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
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 174 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 47
When exploring the codebase, use the project's domain glossary so that test names and interface vocabulary match the project's language, …
- Distinctive: line 49
Before writing any code:
- Distinctive: line 58
Ask: "What should the public interface look like?
- Distinctive: line 64
Write ONE test that confirms ONE thing about the system:
- Distinctive: line 85
Only enough code to pass current test
- Distinctive: line 86
Don't anticipate future tests
- Distinctive: line 87
Keep tests focused on observable behavior
- Distinctive: line 91
After all tests pass, look for refactor candidates:
“Common” is measured: kept by at least 6 in 10 of the 174 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
Test-Driven Development
Philosophy
Core principle: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
Good tests are integration-style: they exercise real code paths through public APIs. They describe what the system does, not how it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
Bad tests are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
See tests.md for examples and mocking.md for mocking guidelines.
Anti-Pattern: Horizontal Slices
DO NOT write all tests first, then all implementation. This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
This produces crap tests:
- Tests written in bulk test imagined behavior, not actual behavior
- You end up testing the shape of things (data structures, function signatures) rather than user-facing behavior
- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
- You outrun your headlights, committing to test structure before understanding the implementation
Correct approach: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
WRONG (horizontal):
RED: test1, test2, test3, test4, test5
GREEN: impl1, impl2, impl3, impl4, impl5
RIGHT (vertical):
RED→GREEN: test1→impl1
RED→GREEN: test2→impl2
RED→GREEN: test3→impl3
...Workflow
1. Planning
When exploring the codebase, use the project's domain glossary so that test names and interface vocabulary match the project's language, and respect ADRs in the area you're touching.
Before writing any code:
- Confirm with user what interface changes are needed
- Confirm with user which behaviors to test (prioritize)
- Identify opportunities for deep modules (small interface, deep implementation)
- Design interfaces for testability
- List the behaviors to test (not implementation steps)
- Get user approval on the plan
Ask: "What should the public interface look like? Which behaviors are most important to test?"
You can't test everything. Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
2. Tracer Bullet
Write ONE test that confirms ONE thing about the system:
RED: Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passesThis is your tracer bullet - proves the path works end-to-end.
3. Incremental Loop
For each remaining behavior:
RED: Write next test → fails
GREEN: Minimal code to pass → passesRules:
- One test at a time
- Only enough code to pass current test
- Don't anticipate future tests
- Keep tests focused on observable behavior
4. Refactor
After all tests pass, look for refactor candidates:
- Extract duplication
- Deepen modules (move complexity behind simple interfaces)
- Apply SOLID principles where natural
- Consider what new code reveals about existing code
- Run tests after each refactor step
Never refactor while RED. Get to GREEN first.
Checklist Per Cycle
[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Test would survive internal refactor
[ ] Code is minimal for this test
[ ] No speculative features addedOther versions235 projects use a version of this.
Word for word · 53
- amazingloft999-droid/mattpocock-skills★ 422100% same
- letehaha/moneymatter★ 201100% same
- alex-on-ai/WebReaper★ 149100% same
- aurorasoft2/Matt_Pocock_Skills★ 133100% same
- VisualxIntelligence/mattpocok-skills★ 55100% same
- javimosch/supercli★ 53100% same
- Vepricov/claude-brainlab★ 35100% same
- VoDaiLocz/kilo-kit-mcp★ 28100% same
- metrogg/AgentHub★ 19100% same
- adrianfernandezalv/skills★ 14100% same
- uwvwko-zzz/mattpocock-skills-openclaw★ 9100% same
42 more not listed
Edited · 71
- mattpocock/skills★ 309k13% same
- MODSetter/SurfSense★ 17k13% same
- GreyDGL/PentestGPT★ 16k91% same
- formbricks/formbricks★ 13k13% same
- sanity-io/sanity★ 6.4k99% same
- ArcReel/ArcReel★ 6k13% same
- withcoral/coral★ 4.9k13% same
- bestofjs/bestofjs★ 3.1k13% same
- crbnos/carbon★ 2.8k13% same
- openstatusHQ/data-table-filters★ 2.3k99% same
61 more not listed
Wrote their own version · 111
- Yeachan-Heo/oh-my-claudecode★ 40ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 40ksame name
- QuivrHQ/quivr★ 40ksame name
- ryoppippi/ccusage★ 19ksame name
- ccusage/ccusage★ 19ksame name
- open-metadata/OpenMetadata★ 16ksame name
- prowler-cloud/prowler★ 15ksame name
- FastLED/FastLED★ 7.5ksame name
- vinvcn/mattpocock-skills-zh-CN★ 5.5ksame name
- parcadei/Continuous-Claude★ 3.9ksame name
101 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.
Used alongsideProjects with it also use poteto-mode, setup-pstack 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.
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
bnemaSkillsetup-pstack
Configure which Pi models pstack uses per role. Detects available provider/model specs and writes pstack's user configuration. Use for /setup-pstack, "configure pstack models", or changing pstack model choices.
Also in 22 projects that use this
jaydubya818Skillprinciple-laziness-protocol
Apply when a refactor is adding wrappers or abstractions instead of simplifying.
Also in 38 projects that use this
jaydubya818Skillprinciple-make-operations-idempotent
Apply when an operation must tolerate retries after partial completion.
Also in 38 projects that use this
- +8 more from jaydubya818
In this repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- cavemanSkill
- design-an-interfaceSkill
- diagnoseSkill
- docouture-authoring-guidesSkill
- docouture-docs-internalsSkill
- docouture-docs-versioningSkill
- docouture-documenting-changesSkill
- docouture-getting-startedSkill
- docouture-writing-docs-pagesSkill
- edit-articleSkill
- git-guardrails-claude-codeSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- improve-codebase-architectureSkill
- migrate-to-shoehornSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- openspec-sync-specsSkill
- openspec-update-changeSkill
- openspec-verify-changeSkill
- prototypeSkill
- qaSkill
- request-refactor-planSkill
- reviewSkill
- scaffold-exercisesSkill
- setup-matt-pocock-skillsSkill
- setup-pre-commitSkill
- teachSkill
- to-issuesSkill
- to-prdSkill
- triageSkill
- ubiquitous-languageSkill
- write-a-skillSkill
- writing-beatsSkill
- writing-fragmentsSkill
- writing-shapeSkill
- zoom-outSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- openspec-sync-specsSkill
- openspec-update-changeSkill
- openspec-verify-changeSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- openspec-sync-specsSkill
- openspec-update-changeSkill
- openspec-verify-changeSkill
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.

