tdd
Skill8 starsChanged 2 months agoMITView on GitHub
Implement features and bug fixes test-first using red-green-refactor cycles. Use when writing new functionality, adding regression tests, fixing bugs with test coverage, or designing behavior through test assertions — even if the user says \"write tests for this\". Do NOT use for throwaway exploratory prototypes.
We split this skill into the rules it gives an agent
6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 186 edited versions we read keep these.
6
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 18
Strict Red-First Execution: Never write production implementation code before seeing an automated test fail against a pre-agreed seam.
- Distinctive: line 50
Key Point: Verify the test fails specifically because the new behavior is absent, not due to syntax or setup errors.
- Distinctive: line 58
Action: Write the simplest, most direct code that makes the failing test pass.
- Distinctive: line 59
Key Point: Do not anticipate speculative requirements or write unexercised branches.
- Distinctive: line 63
Action: Run the full test suite to guarantee zero regressions.
- Distinctive: line 64
Key Point: All tests must be green before proceeding to the next vertical tracer slice.
“Common” is measured: kept by at least 6 in 10 of the 186 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 (TDD)
Implement robust, maintainable functionality through disciplined red → green → verify cycles. Verify behavior through public seams rather than private implementation details.
Core Principle
Write the failing test first, witness it fail for the right reason, and write only the minimal code needed to make it green.
Core Invariants
- Strict Red-First Execution: Never write production implementation code before seeing an automated test fail against a pre-agreed seam.
- Behavioral Testing Over Implementation Inspection: Tests must assert observable input/output behavior and public contracts, never private variables or internal call chains.
- Independent Expected Values: Assertions must compare against independent ground truth (fixtures, domain specs, known literals), never recomputed mirror logic.
- Vertical Tracer Slicing: Deliver one vertical slice at a time (one test → minimal code → green) rather than batching horizontal test suites upfront.
- Deterministic & Isolated Fixtures: Tests must execute in milliseconds without cross-test state leakage, unseeded random seeds, or unpinned clocks.
Architecture & Map of Content (MOC)
[ Agree Public Seam ] ──► [ Red: Write Failing Test ] ──► [ Green: Minimal Code ] ──► [ Refactor & Verify ]| Component | Responsibility | Reference |
| Public Seams | Identify module boundaries and observable behaviors | codebase-design |
| Test Examples | Concrete patterns for unit and integration assertions | tests.md |
| Mocking Guidelines | Safe boundary isolation rules without over-mocking | mocking.md |
| Review & Refactor | Clean code review after reaching green | code-review |
Step-by-Step Procedure (TWI)
Step 1: Identify & Confirm the Public Seam
- Action: State the public interface and observable contract you intend to test, and confirm alignment with domain conventions.
- Key Point: Anchor assertions at public boundaries; do not reach into internal private state.
- Why: Testing through private internals creates brittle tests that break during harmless refactoring.
Step 2: Write the Failing Test (RED)
- Action: Author a single focused test specifying the expected behavior and run the test runner to observe failure.
- Key Point: Verify the test fails specifically because the new behavior is absent, not due to syntax or setup errors.
- Inline Checklist:
- Test names the exact business capability (e.g.
returns_discounted_total_for_premium_member) - Test fails with expected assertion error
- Expected values derived from independent domain constants
- Test names the exact business capability (e.g.
- Why: A test that doesn't fail properly cannot be trusted to protect against regressions.
Step 3: Implement Minimal Code (GREEN)
- Action: Write the simplest, most direct code that makes the failing test pass.
- Key Point: Do not anticipate speculative requirements or write unexercised branches.
- Why: Minimal code keeps the change set tight and prevents unverified dead logic.
Step 4: Verify Suite & Cycle
- Action: Run the full test suite to guarantee zero regressions.
- Key Point: All tests must be green before proceeding to the next vertical tracer slice.
- Why: Catching regressions immediately keeps debugging costs near zero.
Anti-Rationalization Guardrails
| Tempting Rationalization | Binding Rule | Engineering Rationale |
| "I'll write the implementation first, then add tests." | Forbidden: test must be written and observed failing first. | Tests written after code tend to mirror implementation bias and miss edge-case failures. |
| "I can mock this internal helper to test the private method." | Test only through public seams. | Mocks on private internals cement architectural rigidity and hide real integration bugs. |
| "I will write all 15 test cases before writing any code." | Vertical tracer slicing: one test at a time. | Bulk tests lock in premature interface assumptions before real implementation learnings. |
| "The test passed on the first run without changes." | Investigate immediately: tautological or wrong test. | A test that passes without implementation changes is asserting something already true. |
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★ 309ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 40ksame name
- Yeachan-Heo/oh-my-claudecode★ 40ksame name
- QuivrHQ/quivr★ 40ksame name
- ccusage/ccusage★ 19ksame name
- ryoppippi/ccusage★ 19ksame name
- MODSetter/SurfSense★ 17ksame name
- GreyDGL/PentestGPT★ 16ksame name
- open-metadata/OpenMetadata★ 16ksame name
- prowler-cloud/prowler★ 15ksame 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.
Used alongsideProjects with it also use ketchup-video, principle-laziness-protocol 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.
3metaJunSkillketchup-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 10 projects that use this
jaydubya818Skillprinciple-laziness-protocol
Apply when a refactor is adding wrappers or abstractions instead of simplifying.
Also in 43 projects that use this
jaydubya818Skillprinciple-make-operations-idempotent
Apply when an operation must tolerate retries after partial completion.
Also in 43 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 25 projects that use this
- +8 more from jaydubya818
In this repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ai-data-remediationSkill
- ai-engineeringSkill
- codebase-designSkill
- code-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- engineering-workflow-guideSkill
- git-safety-guardrailsSkill
- goalSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- j-spaceSkill
- migrate-to-shoehornSkill
- ml-best-practicesSkill
- prototypeSkill
- researchSkill
- resolving-merge-conflictsSkill
- retroSkill
- scaffold-exercisesSkill
- setup-engineering-workflowsSkill
- setup-pre-commitSkill
- setup-ts-deep-modulesSkill
- skill-conductorSkill
- teachSkill
- to-questionnaireSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- wait-whatSkill
- wayfinderSkill
- wizardSkill
- workflow-designerSkill
- writing-beatsSkill
- writing-for-agentsSkill
- writing-fragmentsSkill
- writing-shapeSkill
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.

