implement-tdd
Skill4 starsChanged 3 months agoMITView on GitHub
Implement each step from the plan using TDD — write failing test first, then minimal code to pass, then refactor. Run for each unchecked step in the Plan section of .ai/tasks/<name>.md.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- pierrebelin/claude-code-toolkittheir own version, first seen Oct 21, 2026
- ZAidBinAsif/flutter-ai-startertheir own version, first seen Jun 20, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- pierrebelin/claude-code-toolkit★ 7same name
- ZAidBinAsif/flutter-ai-starter★ 0same name
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 repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- clarify-scopeSkill
- create-pr-descriptionSkill
- debugSkill
- plan-tasksSkill
- review-prSkill
- setup-ai-contextSkill
- shipSkill
- sync-ai-contextSkill
- write-specSkill
- write-test-scenariosSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
29 rules. About 0 are common, 27 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈27
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Hard rule: Do not write implementation before having a failing test.
- Distinctive: line 16
Before the first step, run the full test suite to confirm the baseline is green:
- Distinctive: line 23
If the baseline is red → stop, report to user, do not implement on a red baseline.
- Distinctive: line 33
Read the step's "Done when:" to know what the test needs to assert
- Distinctive: line 34
Write the test — only test the behavior of this step, nothing more
- Distinctive: line 35
Run the test: it must be red
- Distinctive: line 50
If the test is red for the wrong reason → fix the test, do not write implementation.
- Distinctive: line 54
Write the smallest implementation that can make the test green
- Distinctive: line 55
Run the test: it must be green
- Distinctive: line 56
Run full suite: must not introduce any new red
- Distinctive: line 59
Do not add logic for cases that don't have a test yet
- Distinctive: line 60
Do not add abstractions that aren't needed yet
- Distinctive: line 61
Do not refactor related code outside the scope of this step
- Distinctive: line 63
If the full suite has new red → find the regression, fix it before continuing.
- Distinctive: line 67
Only refactor if the code just written has clear issues: bad names, duplicate logic, magic numbers
- Distinctive: line 68
After each refactor change → run tests again
- Distinctive: line 69
If tests go red during refactor → revert immediately, don't carry the debt
- Distinctive: line 82
Commit with a clear message:
- Very specific: line 101
Run the migration up: <migrate-command>
- Distinctive: line 102
Verify schema is correct (query or inspect)
- Distinctive: line 104
Run migration again → confirm idempotent Done when: both directions run cleanly.
- Distinctive: line 108
If the project has component tests (Storybook, Testing Library) → use them.
- Distinctive: line 109
Write a simple render test (snapshot or "renders without crash")
- Distinctive: line 111
If possible — test interaction (click, input) Do not skip tests entirely for UI — a minimal render test still has value.
- Distinctive: line 112
Do not skip tests entirely for UI — a minimal render test still has value.
- Distinctive: line 115
Test at the integration layer, not unit.
- Distinctive: line 118
Stop, ask the user, do not assume.
- Distinctive: line 132
Run the full suite one final time
- Very specific: line 133
Run lint and typecheck (get commands from .ai/commands.md)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Implement TDD
Implement each step in the ## Plan of the spec file following the TDD cycle.
Hard rule: Do not write implementation before having a failing test. No exceptions.
Setup
Before the first step, run the full test suite to confirm the baseline is green:
# Get the command from .ai/commands.md
<test-command>If the baseline is red → stop, report to user, do not implement on a red baseline.
Cycle for each step in the Plan
Take the next unchecked - [ ] step from ## Plan in the spec file. Execute:
🔴 Red — Write the test first
- Read the step's "Done when:" to know what the test needs to assert
- Write the test — only test the behavior of this step, nothing more
- Run the test: it must be red
Correctly red test:
FAIL: expected X but got undefined ← correct, function doesn't exist yet
FAIL: expected true but got false ← correct, logic not yet implementedIncorrectly red test (must fix before continuing):
SyntaxError / TypeError ← test has a syntax error
Cannot find module ← wrong import path
Expected 2 arguments but got 1 ← test itself is written incorrectlyIf the test is red for the wrong reason → fix the test, do not write implementation.
🟢 Green — Minimal code to pass
- Write the smallest implementation that can make the test green
- Run the test: it must be green
- Run full suite: must not introduce any new red
"Minimal" means:
- Do not add logic for cases that don't have a test yet
- Do not add abstractions that aren't needed yet
- Do not refactor related code outside the scope of this step
If the full suite has new red → find the regression, fix it before continuing.
🔵 Refactor — Clean up while green
- Only refactor if the code just written has clear issues: bad names, duplicate logic, magic numbers
- After each refactor change → run tests again
- If tests go red during refactor → revert immediately, don't carry the debt
Do not refactor in this step:
- Code belonging to other steps in the plan
- Code unrelated to the current step
- "Improvements" that are speculative (YAGNI)
✅ Tick and commit
- Mark the step as done in the spec file:
- [x] 1. Create `src/auth/reset-token.ts` ... - Commit with a clear message:
Or combine if small:test: <step just completed> feat: <step just completed>feat: <step just completed> (with tests)
Then take the next step and repeat.
Special cases
Step is a DB migration: Tests don't follow the normal Red/Green cycle. Instead:
- Write the migration
- Run the migration up:
<migrate-command> - Verify schema is correct (query or inspect)
- Run rollback:
<rollback-command> - Run migration again → confirm idempotent Done when: both directions run cleanly.
Step is a UI component: If the project has component tests (Storybook, Testing Library) → use them. If not:
- Write a simple render test (snapshot or "renders without crash")
- Implement the component
- If possible — test interaction (click, input) Do not skip tests entirely for UI — a minimal render test still has value.
Step is wiring/integration: Test at the integration layer, not unit. Mock external services (email, payment) if needed. Do not mock your own internal code.
Step has an Open question [BLOCKING]:
Stop, ask the user, do not assume. Do not implement a step with a blocking question.
Stop and report when
- Full suite is red after implementation and the cause is unknown → report immediately, do not continue implementing
- Scope has expanded beyond the spec → stop, update spec/plan, confirm with user
- You discover the plan has the wrong order (step N needs code from step N+2) → report it, do not reorder on your own
After all steps are done
- Run the full suite one final time
- Run lint and typecheck (get commands from
.ai/commands.md) - Move on to
/self-check(Phase 3 of task-flow)
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.

