test-driven-development
Skill6 starsChanged 8 months agoMITView on GitHub
Testing discipline that adapts to user tier and task type. Rigorous RED-GREEN-REFACTOR for critical code. Invisible testing for Builder-tier users. Pragmatic skip for trivial changes. The goal is confidence that the code works, not ceremony.
- Installs packages
191 other projects use a version of this.
Adopted by
Most recently taken up by
- NousResearch/hermes-agenttheir own version, first seen Nov 13, 2026
- andreymudri/fleetmatestheir own version, first seen Oct 5, 2026
- Jacobinwwey/notemdprotheir own version, first seen Oct 5, 2026
- crbnos/carbontheir own version, first seen Oct 4, 2026
- L-X-T/ng-agentic-skillstheir own version, first seen Oct 4, 2026
- GuillemRoca/agent-skills-androidtheir own version, first seen Oct 3, 2026
Used with
Projects with it also use diagnosing-superpowers, api-and-interface-design 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.
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 6 projects that use this
LLl0k0laDSkillapi-and-interface-design
Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.
Also in 32 projects that use this
MorningStar0709Skillworkflow-runner
Run an agency-orchestrator style YAML workflow inside the current Trae conversation by simulating or coordinating multiple roles. Use when the user provides a `.yaml` or `.yml` workflow, asks for multi-role collaboration, says things like “用多个角色一起评审这个 PRD”“多角色协作”“先生成工作流再执行”“让产品经理、架构师、QA 一起看一下”, or wants roles such as product manager, architect, reviewer, or QA to work together. Supports layered execution, role prompting, variable interpolation, document-backed inputs, and parallel steps only when the current environment has a clear subagent mapping. Do not use for ordinary implementation plans, simple code changes, or tasks already covered by `writing-plans`, `executing-plans`, `subagent-driven-development`, or single-purpose review/debug skills.
Also in 5 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 25 projects that use this
MorningStar0709Skillchinese-git-workflow
Configure Git for domestic platforms and manage branching strategies suitable for Chinese teams. Use when the user asks to configure remotes, set up SSH, or manage Git workflows for Gitee, Coding, Jihu GitLab, or CNB, including requests like "配置国内 Git", "设置 Gitee 远程仓库", "推荐适合小团队的 Git 流程".
Also in 4 projects that use this
vinvcnSkillconstraint-driven-development
把一个项目的质量线确立为书面契约,并阻止 agent 悄悄降低它。通过访谈确定用户在意哪些维度,当用户心里没有数字时提供合理的默认阈值,把一切记录进 CONSTRAINTS.md,并盯住 diff 中质量线被削弱的迹象——新增的 @ts-ignore 或 eslint-disable 抑制注释、被跳过或删除的测试、被剥掉的断言、未实现的 stub、被调低的阈值。当没有任何质量线被写下来时使用;当用户说 "set up constraints" 或 "define our standards" 时;当用户希望把他们在意的维度——无障碍性、Web 性能、覆盖率——设置成被强制执行的约束时;当 agent 为了变绿不断静默检查或跳过测试时;当你需要一个覆盖率或性能阈值却不知道该选什么数字时;或者当 agent 写下的代码超出任何人会读的体量时。
Also in 4 projects that use this
- +5 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★ 101ksame name
- cloudflare/computer★ 9.5ksame name
- jnMetaCode/superpowers-zh★ 8.3ksame name
- openai/plugins★ 7.3ksame name
- microsoft/FluidFramework★ 4.9ksame name
- mikeyobrien/ralph-orchestrator★ 3.2ksame name
- crbnos/carbon★ 2.7ksame name
- NeoLabHQ/context-engineering-kit★ 1.7ksame 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 repository64 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-backward-compatibilitySkill
- api-design-standardsSkill
- api-versioningSkill
- database-designSkill
- distributed-systemsSkill
- observability-by-defaultSkill
- performance-budgetsSkill
- resilience-patternsSkill
- twelve-factor-appSkill
- codex-cross-reviewSkill
- dispatching-parallel-agentsSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- architecture-awarenessSkill
- intent-to-specSkill
- project-diagnosisSkill
- using-shipworthySkill
- systematic-debuggingSkill
- documentation-as-codeSkill
- accessibilitySkill
- frontend-standardsSkill
- retrospectiveSkill
- writing-skillsSkill
- ci-cd-awarenessSkill
- context-managerSkill
- environment-setupSkill
- feature-flag-disciplineSkill
- finishing-a-development-branchSkill
- guardrail-audit-logSkill
- incident-responseSkill
- mcp-integrationSkill
- migration-strategiesSkill
- production-readinessSkill
- scope-creep-detectionSkill
- session-memorySkill
- slo-sli-definitionSkill
- tech-debt-trackingSkill
- using-git-worktreesSkill
- zero-downtime-migrationsSkill
- brainstormingSkill
- decision-frameworksSkill
- design-documentsSkill
- executing-plansSkill
- writing-plansSkill
- code-complexitySkill
- confidence-based-strictnessSkill
- error-handling-patternsSkill
- feedback-driven-adaptationSkill
- quality-gatesSkill
- response-schema-validationSkill
- verification-before-completionSkill
- adaptive-securitySkill
- bias-detectionSkill
- compliance-awarenessSkill
- container-securitySkill
- dependency-managementSkill
- pii-detectionSkill
- secrets-managementSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 18 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 177 edited versions we read keep these.
18
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
- Distinctive: line 26
Write tests. Always write tests for anything meaningful.
- Distinctive: line 27
Run them. Make sure they pass.
- Distinctive: line 29
If something breaks, say: "I found an issue with how refunds were handled and fixed it."
- Distinctive: line 80
Write a test that asserts the expected behavior
- Distinctive: line 81
Run the test — it MUST fail
- Distinctive: line 82
If it passes, your test is wrong or the feature already exists
- Distinctive: line 85
Write the MINIMUM code to make the test pass
- Distinctive: line 86
Do not write elegant code — write working code
- Distinctive: line 87
Do not add features the test doesn't require
- Distinctive: line 88
Run the test — it MUST pass
- Distinctive: line 93
Run tests after EVERY refactor step — they must still pass
- Distinctive: line 94
If tests break during refactoring, your refactor changed behavior — undo it
- Distinctive: line 100
No matter who the user is or how small the task seems, these ALWAYS get tested:
- Distinctive: line 121
Create operations validate required fields
- Distinctive: line 122
Update operations don't overwrite unrelated fields
- Distinctive: line 123
Delete operations handle cascading correctly
- Distinctive: line 157
Before writing any test, ensure the test infrastructure exists:
- Very specific: line 161
Add scripts to package.json:
- Very specific: line 167
If supertest is needed for API tests: npm install -D supertest @types/supertest
- Very specific: line 171
Add pytest.ini or pyproject.toml config with coverage settings
- Very specific: line 174
Use stdlib testing — no install needed
- Very specific: line 194
Read architecture.md to determine:
- Distinctive: line 200
Follow whatever the architecture spec says.
“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
The Iron Rule
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST — for code that matters.
This rule applies absolutely to: business logic, authentication, payments, data mutations, API endpoints, and calculations. No exceptions, no matter who's asking or how small the change seems.
For everything else, the approach adapts to the situation.
Tier-Adapted Testing Modes
Invisible TDD (Builder-Tier Users)
Builder-tier users care that things work, not how you verified they work. When working with Builder-tier users:
Do this:
- Write tests. Always write tests for anything meaningful.
- Run them. Make sure they pass.
- Report results in outcome language: "I built the payment flow and verified it works correctly — handles successful charges, declined cards, and network errors."
- If something breaks, say: "I found an issue with how refunds were handled and fixed it."
Don't do this:
- "I wrote 3 failing tests to establish the RED state..."
- "Achieved GREEN state on all test cases..."
- "Now entering the REFACTOR phase..."
- "Test coverage is at 87.3% across 12 test suites..."
The tests still exist. The discipline still happens. The user just doesn't need a play-by-play of your testing methodology. They need to know their product works.
How to report:
| Instead of | Say |
| "Wrote 5 unit tests for the auth module" | "Built the login system and verified it handles email/password, Google sign-in, and invalid credentials correctly" |
| "RED: 3 failing tests for payment processing" | "Working on the payment flow now" |
| "All 12 tests passing, 94% coverage" | "Payment processing is working — tested with successful charges, declines, and edge cases" |
| "Added regression test for bug #234" | "Fixed the bug and made sure it won't come back" |
Pragmatic TDD (Quick Fixes, Any Tier)
Some changes don't need formal TDD. Applying RED-GREEN-REFACTOR to a CSS color change is like wearing a hard hat to check the mailbox.
Skip formal TDD for:
- CSS and styling changes (spacing, colors, fonts, layout tweaks)
- Copy and text updates (labels, messages, placeholder text)
- Configuration changes (env vars, feature flags, build config)
- Simple UI tweaks (reordering elements, showing/hiding existing components)
- Static content updates (about pages, marketing copy)
- Dependency version bumps (with no API changes)
Instead, verify these by:
- Building the project (confirms no syntax errors)
- Visually checking the result when possible
- Running the existing test suite (confirms nothing broke)
But NEVER skip tests for "quick fixes" that touch:
- Authentication or authorization logic
- Payment or billing code
- Database queries or migrations
- API request/response handling
- Business rules or calculations
- Data validation or sanitization
A "quick" auth fix without tests is how breaches happen.
Full TDD (Engineer-Tier Users, All Critical Code)
The complete RED-GREEN-REFACTOR cycle. Engineer-tier users appreciate and expect this rigor.
RED: Write a Failing Test
- Decide what the code should DO (not how it should work internally)
- Write a test that asserts the expected behavior
- Run the test — it MUST fail
- If it passes, your test is wrong or the feature already exists
GREEN: Make It Pass
- Write the MINIMUM code to make the test pass
- Do not write elegant code — write working code
- Do not add features the test doesn't require
- Run the test — it MUST pass
REFACTOR: Clean Up
- Now that it works, make it clean
- Extract common patterns, improve naming, simplify logic
- Run tests after EVERY refactor step — they must still pass
- If tests break during refactoring, your refactor changed behavior — undo it
What ALWAYS Gets Tests Regardless of Tier
No matter who the user is or how small the task seems, these ALWAYS get tested:
Auth Flows
- Login with valid credentials succeeds
- Login with invalid credentials fails with appropriate error
- Session expiry is handled correctly
- Protected routes reject unauthenticated requests
- Role-based access controls are enforced
- Password reset flow works end-to-end
- OAuth callback handling works correctly
Payment Processing
- Successful charge processes correctly
- Declined card is handled gracefully
- Webhook signature verification works
- Refund flow processes correctly
- Subscription creation, update, and cancellation work
- Price calculation is accurate (tax, discounts, currency)
- Idempotency keys prevent duplicate charges
Data Mutations
- Create operations validate required fields
- Update operations don't overwrite unrelated fields
- Delete operations handle cascading correctly
- Concurrent writes don't cause data corruption
- Invalid data is rejected with clear errors
- Database transactions roll back on failure
API Endpoints
- Correct status codes for success and error cases
- Request validation rejects malformed input
- Response shape matches the contract
- Rate limiting works (if applicable)
- Authentication is enforced on protected endpoints
- Pagination works correctly
Business Calculations
- Pricing calculations are accurate
- Rounding is handled correctly (especially for currency)
- Edge cases: zero amounts, negative values, overflow
- Time zone handling is correct
- Unit conversions are accurate
Testing Anti-Patterns to Avoid
- Testing implementation, not behavior — test WHAT it does, not HOW it does it
- Mocking everything — mocks that diverge from reality give false confidence
- Testing the framework — don't test that React renders a div
- No assertions — a test without assertions is not a test
- Flaky tests — fix or delete; a flaky test is worse than no test
- Testing trivial getters/setters — this adds maintenance, not confidence
- Ceremonial tests — writing tests to hit a coverage number rather than to verify behavior
Test Infrastructure Setup (Do This First)
Before writing any test, ensure the test infrastructure exists:
TypeScript/JavaScript
- Install vitest if not present:
npm install -D vitest @vitest/coverage-v8 - Add scripts to package.json:
"test": "vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage" - If supertest is needed for API tests:
npm install -D supertest @types/supertest
Python
- Install pytest if not present:
pip install pytest pytest-cov - Add pytest.ini or pyproject.toml config with coverage settings
Go
- Use stdlib
testing— no install needed - Run with:
go test -cover ./...
This is a one-time setup. Do it on the FIRST test, not every test.
TypeScript-Specific Rules
- NEVER use
catch (err: any)— usecatch (err: unknown)and narrow:catch (err: unknown) { if (err instanceof Error) { // handle Error } throw err; } - NEVER use
: anyin test files either — tests should be as strictly typed as production code
Integration with Architecture Spec
Read architecture.md to determine:
- Which testing framework to use (Jest, Vitest, pytest, Go testing, etc.)
- Where test files should live (co-located,
__tests__/,tests/) - Naming conventions for test files
- Coverage thresholds (if specified)
Follow whatever the architecture spec says. If it doesn't specify, default to Vitest for TypeScript, pytest for Python, stdlib testing for Go.
Rationalization Pressure Test
These are excuses you might generate to skip testing. Each one is wrong.
| Rationalization | Why It's Wrong | What To Do Instead |
| "This change is too small to test" | Small changes cause big bugs. A one-line auth fix without tests is how breaches happen | If it's small, the test is small too — write it |
| "I'll add tests later" | Later never comes. Untested code breeds more untested code | Write the test FIRST. That's what TDD means |
| "The test would be trivial" | If it's trivial, it takes 30 seconds. If it's not trivial, you definitely need it | Write the "trivial" test and move on |
| "Testing this would require too much setup" | Complex test setup signals complex code that needs testing the most | Simplify the code or invest in test fixtures. Either way, test it |
| "The user didn't ask for tests" | Production code gets tests. That's not optional. Your human partner is paying for working software | Write tests. Report results, not methodology |
| "This is just a prototype" | Shipworthy exists to prevent prototypes from becoming unmaintainable production code | Test the prototype. It's faster than debugging it later |
| "I can verify this manually" | Manual verification misses edge cases and regressions. Run the command | Write an automated test. Run it. Trust the output |
| "The existing tests already cover this" | If they do, adding one more is cheap insurance. If they don't, you need it | Check coverage. If covered, great. If not, add a 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.

