test-driven-development
Skill216 starsChanged 6 months agoMITView on GitHub
Red-green-refactor cycle with meaningful coverage. Tests are written before implementation. Coverage is a side effect of good tests, not the goal.
We split this skill into the rules it gives an agent
13 rules. 0 are common, 13 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 179 edited versions we read keep these.
13
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 25
Write a test for the behavior you want — before writing implementation.
- Distinctive: line 29
Run the test. Confirm it fails for the right reason (not a syntax error — a missing implementation).
- Distinctive: line 31
Verify: Test runs and fails with a clear "not implemented" or "undefined" error.
- Distinctive: line 35
Write the minimum implementation to make the test pass.
- Distinctive: line 36
Do not write more than the test requires — resist the urge to add logic for future cases.
- Distinctive: line 37
Run the test. Confirm it passes.
- Distinctive: line 39
Verify: All tests pass. No new tests added yet.
- Distinctive: line 44
Run tests after every refactoring step — do not batch refactors.
- Distinctive: line 45
If tests break during refactor: revert immediately, refactor more carefully.
- Distinctive: line 52
Test pyramid: many unit tests, fewer integration tests, minimal end-to-end tests.
- Distinctive: line 56
Run coverage report. Flag any critical paths with 0% coverage.
- Distinctive: line 57
Do NOT chase a coverage number — write tests for behaviors that matter.
- Distinctive: line 59
Verify: All happy paths and key edge cases have tests.
“Common” is measured: kept by at least 6 in 10 of the 179 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
Overview
TDD is the discipline of writing a failing test before writing implementation code. It forces you to think about the interface before the internals, produces tests that actually test behavior (not just coverage), and gives you a safety net for every refactor.
AI agents skip tests constantly. This skill makes tests non-optional.
When to Use
- Starting any new feature or function
- Fixing any bug (write a test that reproduces the bug first)
- Refactoring existing code (ensure test coverage before you start)
Process
Step 1: Write a Failing Test (Red)
- Write a test for the behavior you want — before writing implementation.
- The test should describe what the code does, not how:
- ✅
test("returns 404 when user not found") - ❌
test("calls findById with the user id")
- ✅
- Run the test. Confirm it fails for the right reason (not a syntax error — a missing implementation).
Verify: Test runs and fails with a clear "not implemented" or "undefined" error.
Step 2: Write Minimum Code (Green)
- Write the minimum implementation to make the test pass.
- Do not write more than the test requires — resist the urge to add logic for future cases.
- Run the test. Confirm it passes.
Verify: All tests pass. No new tests added yet.
Step 3: Refactor (Refactor)
- Now clean up the implementation — no new behavior, only improved structure.
- Run tests after every refactoring step — do not batch refactors.
- If tests break during refactor: revert immediately, refactor more carefully.
Verify: Tests still pass after refactor. Code is cleaner.
Step 4: Repeat for Each Behavior
- Repeat steps 1–3 for each distinct behavior of the feature.
- Test pyramid: many unit tests, fewer integration tests, minimal end-to-end tests.
Step 5: Coverage Sanity Check
- Run coverage report. Flag any critical paths with 0% coverage.
- Do NOT chase a coverage number — write tests for behaviors that matter.
Verify: All happy paths and key edge cases have tests. Coverage report reviewed.
Common Rationalizations (and Rebuttals)
| Excuse | Rebuttal |
| "I'll add tests after" | After never comes. And after-the-fact tests test your implementation, not the behavior. |
| "This code is too simple to test" | Simple code breaks in unexpected ways when requirements change. |
| "Integration tests are enough" | Unit tests catch bugs faster, run faster, and localize failures better. |
| "We don't have time for TDD" | You have time for the bug investigation that comes without TDD? |
Red Flags
- Tests were written after the implementation
- Tests test internal implementation details (private methods, DB queries) rather than behavior
- "Happy path only" test coverage
- Tests pass even when you break the implementation (mocked away the real behavior)
- Coverage target hit by testing trivial getters/setters
Verification
- Tests written before implementation (or alongside for bug fixes)
- Each test describes a specific behavior
- Red-green-refactor cycle followed
- All tests pass
- Key edge cases covered (empty input, null, boundary values)
- Coverage report reviewed for critical path gaps
References
- debugging-methodology skill
- references/testing-patterns.md
Other versions190 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 190
- obra/superpowers★ 305ksame name
- NousResearch/hermes-agent★ 259ksame name
- addyosmani/agent-skills★ 112ksame name
- cloudflare/computer★ 9.8ksame name
- jnMetaCode/superpowers-zh★ 8.4ksame name
- openai/plugins★ 7.4ksame name
- farm-fe/farm★ 5.6ksame name
- microsoft/FluidFramework★ 5ksame name
- mikeyobrien/ralph-orchestrator★ 3.2ksame name
- crbnos/carbon★ 2.8ksame name
180 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 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.
GEd520Skillchinese-code-review
中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。
Also in 7 projects that use this
GEd520Skillchinese-commit-conventions
中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。
Also in 7 projects that use this
obraSkilldiagnosing-superpowers
Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.
Also in 12 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 44 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 36 projects that use this
10CGSkillworkflow-runner
十步循环轻量编排器,协调 Phase Skills 执行,支持灵活组合。
Also in 8 projects that use this
- +2 more from GEd520
- +3 more from LLl0k0laD
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-qa-run-reviewSkill
- ai-output-validationSkill
- api-designSkill
- ci-cd-pipelinesSkill
- citruscoastaiSkill
- code-explanationSkill
- code-reviewSkill
- context-loadingSkill
- debugging-methodologySkill
- documentationSkill
- error-handlingSkill
- frontend-engineeringSkill
- git-workflowSkill
- goal-driven-executionSkill
- hallucination-preventionSkill
- idea-to-specSkill
- incremental-codingSkill
- integration-testingSkill
- meeting-notes-to-tasksSkill
- multi-agent-orchestrationSkill
- observabilitySkill
- performance-optimizationSkill
- production-deploymentSkill
- prompt-injection-defenseSkill
- rag-and-memorySkill
- refactoringSkill
- research-and-summarizeSkill
- security-hardeningSkill
- simplicity-firstSkill
- surgical-changesSkill
- task-decompositionSkill
- think-before-codingSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

