test-driven-development
Skill4 starsChanged 15 days agoMITView on GitHub
Test-first development that produces tests worth keeping. Use when implementing a feature, fixing a bug, or changing behavior that can be tested, when the user mentions TDD, red-green-refactor, regression tests, or test coverage, and whenever a bug fix needs a test proving it stays fixed. Works in vertical slices (one failing test, minimal code, repeat), tests behavior through public interfaces, and avoids mock-heavy, tautological, and implementation-coupled tests.
191 other projects use a version of this.
Adopted by
Most recently taken up by
- Blandskron/agents-first-repo-docstheir own version, first seen Nov 29, 2026
- ctaxnagomi/agent-kd-skilltheir own version, first seen Nov 29, 2026
- aakash1552005/universal-agent-skillstheir 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
- Dannykkh/skill-olympustheir own version, first seen Nov 29, 2026
Used with
Projects with it also use chinese-code-review, chinese-commit-conventions 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.
Leodorareluctant259Skillchinese-code-review
中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈
Also in 8 projects that use this
Leodorareluctant259Skillchinese-commit-conventions
中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化
Also in 8 projects that use this
steven123397Skillaccessibility-engineering
Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.
Also in 4 projects that use this
LLl0k0laDSkillusing-agent-skills
Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.
Also in 46 projects that use this
MrCipherSmithSkillconstraint-driven-development
Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.
Also in 21 projects that use this
LLl0k0laDSkillgit-workflow-and-versioning
Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.
Also in 54 projects that use this
- +3 more from Leodorareluctant259
- +2 more from LLl0k0laD
Other versions191 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 191
- obra/superpowers★ 314ksame name
- NousResearch/hermes-agent★ 267ksame name
- addyosmani/agent-skills★ 121ksame name
- cloudflare/computer★ 10ksame name
- mdiri-ai/SoduWork★ 9.1ksame name
- jnMetaCode/superpowers-zh★ 8.6ksame name
- openai/plugins★ 8.4ksame name
- farm-fe/farm★ 5.6ksame name
- microsoft/FluidFramework★ 5ksame name
- mikeyobrien/ralph-orchestrator★ 3.2ksame name
181 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 repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-ready-repoSkill
- bug-triageSkill
- ci-auditorSkill
- deep-modulesSkill
- evidence-before-claimsSkill
- finish-the-jobSkill
- parallel-agentsSkill
- plan-before-codeSkill
- prior-art-scoutSkill
- security-auditSkill
- senior-engineerSkill
- staff-reviewSkill
- state-machine-hunterSkill
- systematic-debuggingSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 182 edited versions we read keep these.
7
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
Red: Write one small test for the next piece of behavior.
- Distinctive: line 17
Green: Write the minimum code that makes it pass.
- Distinctive: line 29
One reason to fail: When it fails, the name and message tell you what broke.
- Distinctive: line 30
Fast and deterministic: No real network, wall-clock time, or shared global state.
- Distinctive: line 49
Prefer the lowest test level that can observe the behavior: unit for pure logic, integration for boundaries (database queries, HTTP …
- Distinctive: line 54
Visual layout: Use screenshots or visual review, and test the logic behind the view.
- Distinctive: line 55
Legacy code without seams: Start with characterization tests that pin current behavior at the highest practical level, then refactor toward …
“Common” is measured: kept by at least 6 in 10 of the 182 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
A test written first proves two things a test written later can't: that the test can fail, and that the code you wrote is what made it pass. TDD is not about coverage numbers. It is about building in small steps where each step is proven before the next one starts.
The loop
- Red. Write one small test for the next piece of behavior. Run it and watch it fail for the right reason: an assertion about the missing behavior, not a typo, import error, or missing fixture.
- Green. Write the minimum code that makes it pass. Hard-coding is allowed if the next test will force generality.
- Refactor. With tests green, clean up names, duplication, and structure. Run the tests after each change.
- Repeat with the next behavior.
Work in vertical slices: one test, one implementation, repeat. Writing all the tests first commits you to a design before you've learned anything from implementing it, and produces tests of imagined behavior.
For a bug fix, the first test reproduces the bug. It must fail before the fix and pass after. If you can't make it fail, you haven't reproduced the bug yet (see systematic-debugging).
What makes a test worth keeping
- Tests behavior through the public interface. It reads like a specification ("rejects checkout when cart is empty") and survives refactoring, because it doesn't know how the code is structured inside.
- Independent expected values. Expected results come from the spec, a worked example, or a known-good literal, never from recomputing them the way the code does.
- One reason to fail. When it fails, the name and message tell you what broke.
- Fast and deterministic. No real network, wall-clock time, or shared global state. Inject a clock, seed randomness, and use in-memory or containerized dependencies.
- Mocks only at real boundaries. Mock what you don't own and can't run cheaply (payment APIs, email, time). Don't mock your own internal collaborators; use the real ones.
Anti-patterns
| Anti-pattern | Tell | Fix |
| Implementation-coupled | Breaks on refactor while behavior is unchanged | Assert on outputs and observable effects at the interface |
| Tautological | expect(add(a, b)).toBe(a + b) | Use independent known values |
| Mock theater | The test mostly verifies that mocks were called | Use real collaborators; mock only external boundaries |
| Snapshot dumping | Huge snapshots nobody reads, updated blindly | Assert the few properties that matter |
| Testing the framework | Asserting that the ORM saves or the router routes | Test your logic, not the library's |
| Flaky by design | Sleeps, real time, order-dependent tests | Inject time, await conditions, isolate state |
| Green without red | Test never seen failing | Break the code (or revert the fix) and confirm the test fails |
Choosing what to test
You can't test everything, so put tests where bugs are likely and expensive: business rules, state transitions, parsing and validation, money and time calculations, permission checks, and anything that has broken before. Thin glue code and pure configuration rarely earn dedicated tests.
Prefer the lowest test level that can observe the behavior: unit for pure logic, integration for boundaries (database queries, HTTP handlers), end-to-end for a few critical user journeys.
When test-first doesn't fit
- Exploratory spikes. Prototype freely to learn, then throw the spike away and rebuild test-first, or at least add tests before calling it done.
- Visual layout. Use screenshots or visual review, and test the logic behind the view.
- Legacy code without seams. Start with characterization tests that pin current behavior at the highest practical level, then refactor toward testable seams.
In every case, behavior changes ship with tests, and the tests have been seen to fail.
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.

