tdd
Skill13 starsChanged 2 months agoMITView on GitHub
Enforces strict Test-Driven Development with RED-GREEN-REFACTOR cycles. Writes one failing test at a time, implements minimal code to pass, then refactors. Delegates to the `test-provenance-guard` skill during REFACTOR to detect tests-by-construction (static + mutation checks). Pairs with the `code-quality` skill: invokes `Skill('code-quality')` during the REFACTOR phase to apply the full code-quality rule set against the GREEN output, and cites refactor recipes (R1–R20) by ID when reporting changes. Triggers on: "tdd", "write tests", "test this", "add test coverage", "test driven", "red green refactor", "/tdd".
193 other projects use a version of this.
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 · 0
None found.
Wrote their own version · 193
- 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
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 repository53 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- skills/workflow/autonomous-workflow/CLAUDE.mdCLAUDE.md
- holistic-analysisSkill
- ideateSkill
- interviewSkill
- playwright-trace-analyzerSkill
- profile-optimizerSkill
- rum-trackingSkill
- screen-recorderSkill
- video-analyserSkill
- create-skillSkill
- docsSkill
- handoffSkill
- optimize-claude-mdSkill
- persistent-memorySkill
- changelogSkill
- ci-auto-fixSkill
- create-prSkill
- github-actions-authorSkill
- resolve-conflictsSkill
- animations-nativeSkill
- animationsSkill
- behavioral-designSkill
- chartingSkill
- storybookSkill
- uxSkill
- visual-designSkill
- ai-engineeringSkill
- code-qualitySkill
- confidenceSkill
- criticalSkill
- dxSkill
- eval-iterateSkill
- jev-assertSkill
- measurableSkill
- observe-runSkill
- optimize-approachSkill
- polishSkill
- pr-reviewSkill
- review-branchSkill
- review-loopSkill
- severitySkill
- test-provenance-guardSkill
- verify-behaviorSkill
- e2e-pr-stabilizerSkill
- e2e-testing-mobileSkill
- e2e-testingSkill
- ui-verifySkill
- autonomous-workflowSkill
- aw-create-planSkill
- aw-create-walkthroughSkill
- fix-bugSkill
- implement-suggestionSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 15 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 177 edited versions we read keep these.
15
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Check $ARGUMENTS for the feature or behavior description.
- Very specific: line 44
If $ARGUMENTS contains a feature description, use it directly.
- Very specific: line 45
If $ARGUMENTS contains "after" (e.g., /tdd after), run in Test-After Mode — write tests for existing code.
- Very specific: line 46
If $ARGUMENTS is empty, ask the user what behavior they want to implement or test.
- Distinctive: line 52
Before writing any tests:
- Distinctive: line 59
If no tests exist yet, ask the user which framework to use before proceeding.
- Distinctive: line 65
Before diving into implementation, identify what matters most:
- Distinctive: line 82
Write exactly ONE failing test.
- Distinctive: line 87
Write the MINIMUM code to make the failing test pass.
- Distinctive: line 102
After each RED-GREEN-REFACTOR cycle:
- Distinctive: line 104
Run the full relevant test suite (not just the new test).
- Distinctive: line 105
If all tests pass, move to the next item on the test list.
- Distinctive: line 106
If a test fails, stop and fix it before proceeding.
- Distinctive: line 107
After every 3 cycles, briefly report progress to the user.
- Distinctive: line 113
After all items in the test list are complete:
- Distinctive: line 115
Run the full test suite one final time.
- Distinctive: line 116
Check test coverage if the project has coverage tooling — report any critical paths that are uncovered.
- Distinctive: line 137
Follow the project's existing convention.
- Very specific: line 147
Guard clauses + early returns: instead of nested ifs — flat code is easier to read and easier to test.
- Distinctive: line 151
Validate at boundaries, trust internally: No defensive null checks for impossible states.
“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
Test-Driven Development
Enforce strict RED-GREEN-REFACTOR discipline. One test at a time. Tests describe WHAT the system does, never HOW.
Input
Check $ARGUMENTS for the feature or behavior description.
- If
$ARGUMENTScontains a feature description, use it directly. - If
$ARGUMENTScontains "after" (e.g.,/tdd after), run in Test-After Mode — write tests for existing code. Seerules/test-after.md. - If
$ARGUMENTSis empty, ask the user what behavior they want to implement or test.
Step 0: Discover Project Test Setup
Before writing any tests:
- Find existing tests — glob for
**/*.test.*,**/*.spec.*,**/*_test.*,**/test_*.*,**/tests/**to identify the test framework, naming conventions, and directory structure. - Find the test runner — check
package.jsonscripts,Makefile,pyproject.toml,Cargo.toml,go.mod, or similar for the test command. - Adopt existing patterns — match the project's test style exactly: same imports, same assertion library, same file naming, same directory placement. Never introduce a new test framework or pattern.
- Identify the run command — store it mentally as
TEST_CMDfor use throughout the cycle. If you can run a single test file or test case, prefer that over the full suite.
If no tests exist yet, ask the user which framework to use before proceeding.
Step 1: Prioritize by Business Criticality
Before diving into implementation, identify what matters most:
- Core user flows first — what are the primary actions users perform? Test those before edge cases.
- Ask if unclear — if the feature has multiple behaviors, ask the user to rank them or list the critical paths.
- Build a test list — write a numbered list of behaviors to test, ordered by importance. Each item should be a single, specific behavior (not "test the login flow" but "reject login with expired password").
Present the test list to the user for confirmation before starting the cycle.
Step 2: RED-GREEN-REFACTOR Cycle
For each item in the test list, execute one full cycle. Follow the rules strictly:
RED Phase
See rules/red.md
Write exactly ONE failing test. Run it. Confirm it fails with the expected error. Do NOT write implementation code.
GREEN Phase
See rules/green.md
Write the MINIMUM code to make the failing test pass. No more. Run the test. Confirm it passes. Run the full relevant test suite to check for regressions.
Even in this phase, apply the basic readability primitives while you write: meaningful names, guard clauses for the cases the test forces, no nesting beyond 2 levels. These cost almost nothing during authoring but are expensive to bolt on later. Don't optimize, abstract, or add unrequested features — REFACTOR will handle deeper improvements via Skill('code-quality').
REFACTOR Phase
See rules/refactor.md
Evaluate whether refactoring is needed. If yes, refactor while keeping all tests green. If no, move to the next cycle.
Invoke Skill('code-quality') for this phase. The code-quality skill is the source of truth for what "clean" means — guard clauses, low cognitive complexity, single-responsibility functions, intent-revealing names, single source of truth for union-type metadata, schema-first validation with type inference, total functions, type-driven design, functional core / imperative shell, and the named refactor recipes catalog (R1–R20). Routing through the skill — rather than reading individual rule files — picks up its Review Mode procedure, the structured output contract, and any rules added since this skill was written. Cite recipes by ID in commit messages and PR descriptions (e.g., "R1 Consolidate Parallel Maps", "R10 Total-ise the Function") so reviews are reproducible.
Step 3: Cycle Completion Check
After each RED-GREEN-REFACTOR cycle:
- Run the full relevant test suite (not just the new test).
- If all tests pass, move to the next item on the test list.
- If a test fails, stop and fix it before proceeding. Never accumulate broken tests.
- After every 3 cycles, briefly report progress to the user.
Step 4: Final Verification
After all items in the test list are complete:
- Run the full test suite one final time.
- Check test coverage if the project has coverage tooling — report any critical paths that are uncovered.
- Provide a summary of what was tested and what was implemented.
Critical Rules (apply to ALL phases)
Test Quality
- Test behavior, not implementation — tests must exercise public interfaces only. A test must survive a complete internal refactor unchanged.
- One behavior per test — each test should verify exactly one thing. The test name should describe that behavior.
- No testing framework internals — never test that
setTimeoutworks, that React renders, or that Go'shttp.ListenAndServestarts. Test YOUR code. - Maximum 10-15 tests per file — if you need more, split by behavior group.
- Factory functions for test data — use
buildUser(overrides?)patterns instead of inline object literals scattered across tests.
Mocking Strategy
- DO mock: external HTTP APIs, third-party services, file system (when testing logic, not I/O), time/dates, randomness.
- DO NOT mock: your own code, framework features, database (prefer test DB or in-memory), internal modules (unless crossing a major boundary).
- Never mock what you don't own — if you don't control the interface, write an adapter and mock that.
- If the test needs more than 3 mocks, the design is wrong — refactor the code under test first.
Naming Convention
Follow the project's existing convention. If none exists, use:
- describe block: the unit under test (function, class, component)
- it/test block:
should [expected behavior] when [condition] - Example:
describe('createOrder')→it('should reject order when inventory is zero')
Code Quality (during GREEN and REFACTOR)
The code-quality skill is the source of truth for what "well-written code" means in this workflow. Apply during GREEN as inline primitives; invoke as a full pass during REFACTOR via Skill('code-quality').
GREEN-phase primitives (apply inline while writing the minimal implementation):
- Guard clauses + early returns instead of nested
ifs — flat code is easier to read and easier to test. - Cognitive complexity ≤ 15 per function (SonarSource scoring). If the function feels hard to test (lots of mocks, complex setup), that is the metric warning you the function does too much.
- Names that describe intent, not types or position.
pendingOrdersbeatsarr2. - One responsibility per function — if you cannot name it without "and", split it.
- Validate at boundaries, trust internally. No defensive null checks for impossible states.
For REFACTOR, invoke Skill('code-quality') so the skill's Review Mode procedure runs against the GREEN output. The skill returns findings under the High / Medium / Low / Maintainability / Correctness / Testability headings; address each as a separate refactoring move (one change at a time per the "Procedure" below). Cite recipe IDs (R1–R20) in commit messages.
Anti-Patterns to Avoid
| Anti-Pattern | Why It's Bad | What to Do Instead |
| Writing tests in bulk | Tests imagined behavior, not observed | One test per cycle |
| Testing and implementing together | Unconsciously designs tests around implementation | Strict phase separation |
| "Make sure tests pass" prompt | Encourages implementation-first thinking | "Write a FAILING test" |
| Changing test expectations to pass | Masks real bugs | Fix the source code |
| Testing private methods | Couples tests to implementation | Test through public API |
| Copy-pasting mock setup | Brittle, hard to maintain | Extract shared fixtures |
When Things Go Wrong
- Test won't fail (RED phase): The behavior already exists or the test is wrong. Investigate before proceeding.
- Can't make test pass without large changes (GREEN phase): The test step is too big. Break it into smaller behaviors.
- Refactoring breaks tests: The tests were testing implementation details. Rewrite the test to test behavior, then refactor.
- After 2 failed attempts to fix: Clear context and start the cycle fresh with a better-scoped test.
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.

