tdd-cycle
Skill0 starsChanged 6 months agoMITView on GitHub
Implement one slice via strict red -> green -> refactor. Failing test first, smallest passing code, refactor only on green. Use in stage 7 (Implementation). Triggers "TDD", "red-green-refactor", "test-first".
4 other projects use a version of this.
Adopted by
Most recently taken up by
- Hakkadaikon/hymmetheir own version, first seen Oct 26, 2026
- modimihir07/agentic-ostheir own version, first seen Oct 25, 2026
- kitloomlk-stack/testing-debugging-kittheir own version, first seen Oct 15, 2026
- shuvamk/openbenchtheir own version, first seen Jul 2, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- modimihir07/agentic-os★ 209same name
- shuvamk/openbench★ 2same name
- Hakkadaikon/hymme★ 0same name
- kitloomlk-stack/testing-debugging-kit★ 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 repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- plugin-v2/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- plugin-v2/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/agents.mdcCursor rule
- agentic-security-reviewSkill
- arc42-baselineSkill
- caveman-commitSkill
- caveman-helpSkill
- caveman-reviewSkill
- cavemanSkill
- create-goalSkill
- design-twiceSkill
- discovery-sprintSkill
- domain-contextSkill
- github-project-setupSkill
- grillSkill
- improve-codebase-architectureSkill
- issue-breakdownSkill
- issue-draftSkill
- issue-pr-syncSkill
- new-adrSkill
- new-glossary-entrySkill
- orchestrateSkill
- portfolio-trackSkill
- product-pageSkill
- project-reviewSkill
- project-runSkill
- project-scaffoldingSkill
- quality-assuranceSkill
- quality-metricsSkill
- record-decisionSkill
- review-fixSkill
- roadmap-managementSkill
- sales-cycleSkill
- specorator-designSkill
- specorator-improvementSkill
- specorator-onboardSkill
- stock-takingSkill
- tackle-issueSkill
- token-budget-reviewSkill
- tracer-bulletSkill
- ubiquitous-languageSkill
- verifySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. 0 are common, 14 are distinctive, and 8 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
14
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
After Beck's TDD and Pocock's tdd.
- Distinctive: line 19
Read the task's acceptance criteria.
- Distinctive: line 21
Write a single failing test that asserts that behavior through the public interface the spec defines.
- Distinctive: line 22
Run the test. It must fail with a meaningful message — "expected X, got Y", not "ReferenceError: foo is not defined".
- Very specific: line 23
Commit (or mark as ready to commit if the user hasn't authorized commits) using the canonical task-ID format from …
- Distinctive: line 27
Write the smallest code change that makes the failing test pass.
- Distinctive: line 28
Run the whole test suite — not just this test.
- Distinctive: line 29
If something else turned red, you broke an invariant.
- Very specific: line 30
Commit with the task-ID format: feat(<area>): <T-AREA-NNN> green — <same behavior phrasing>.
- Distinctive: line 34
Look at the code you just wrote and the surrounding code.
- Distinctive: line 41
If no refactor needed, say so explicitly and move on.
- Very specific: line 42
Commit with the task-ID format: refactor(<area>): <T-AREA-NNN> <what you changed> (use refactor type rather than feat since no new behavior …
- Very specific: line 48
When the dispatched task is fully green and refactored, append an entry to specs/<slug>/implementation-log.md: task ID, behaviors covered, …
- Distinctive: line 54
Test after: If the test was written after the production code, it's not TDD.
- Distinctive: line 55
Horizontal slicing: Don't write all the tests then all the code.
- Distinctive: line 57
Refactor on red: Never. Refactoring without a green safety net is just changing code.
- Distinctive: line 58
Refactor without a refactor: Don't ship code that you yourself would have flagged in review.
- Very specific: line 62
Stop. Write a note in implementation-log.md describing what you tried, what you observed, and what you suspect is the root cause.
- Very specific: line 67
Prefer SDK-style fakes over generic mocks (a fake UserStore over a generic mock of a method).
- Distinctive: line 68
Never mock the system under test.
- Distinctive: line 73
All acceptance criteria have at least one passing test asserting the observable behavior.
- Very specific: line 84
No artifacts in specs/<slug>/ other than the log append — the design and spec are upstream-owned.
“Common” is measured: kept by at least 6 in 10 of the 3 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
TDD cycle
After Beck's TDD and Pocock's tdd. The cycle is the contract; if you skip a step, you've drifted from TDD into "tests after."
The cycle
This skill executes the currently dispatched task, not the whole backlog. /spec:implement is scoped to a single task per invocation (.claude/commands/spec/implement.md step 1); when this task is complete, return control to the orchestrator, which will dispatch the next ready task in a fresh /spec:implement call.
For the dispatched task <T-AREA-NNN>:
🔴 RED
- Read the task's acceptance criteria.
- Pick one observable behavior from the criteria — the smallest meaningful one.
- Write a single failing test that asserts that behavior through the public interface the spec defines. No private-method tests, no implementation peeking.
- Run the test. It must fail with a meaningful message — "expected X, got Y", not "ReferenceError: foo is not defined". If the failure is about missing scaffolding, write the minimum stubs to get a real assertion failure, then re-run.
- Commit (or mark as ready to commit if the user hasn't authorized commits) using the canonical task-ID format from
.claude/commands/spec/implement.md:feat(<area>): <T-AREA-NNN> red — <behavior in plain English>. Always include the task ID so the commit traces back to its task perdocs/traceability.md.
🟢 GREEN
- Write the smallest code change that makes the failing test pass. Resist generality. "The simplest thing that could possibly work."
- Run the whole test suite — not just this test. A green local with a red suite is a regression.
- If something else turned red, you broke an invariant. Revert and find a smaller change.
- Commit with the task-ID format:
feat(<area>): <T-AREA-NNN> green — <same behavior phrasing>.
🔵 REFACTOR
- Look at the code you just wrote and the surrounding code. Ask:
- Is there duplication? (extract)
- Is a method too long? (split)
- Is a module too shallow? (deepen — push more behavior behind a smaller interface)
- Is naming honest? (rename to match the canonical term in
docs/glossary/<slug>.md) - Is there feature envy / primitive obsession?
- Make at most one refactor per cycle. Run the suite after each change.
- If no refactor needed, say so explicitly and move on. Don't manufacture refactors.
- Commit with the task-ID format:
refactor(<area>): <T-AREA-NNN> <what you changed>(userefactortype rather thanfeatsince no new behavior is added).
Loop within the dispatched task only
Pick the next observable behavior from the same task's acceptance criteria. RED again. Continue until this task's acceptance criteria all pass.
When the dispatched task is fully green and refactored, append an entry to specs/<slug>/implementation-log.md: task ID, behaviors covered, tests added (count + names), files touched, commit SHAs (or "uncommitted").
Then return control to the orchestrator with a one-line summary. Do not pick up the next task — that's the orchestrator's job (it will dispatch a new /spec:implement for the next ready task per .claude/skills/orchestrate/PHASES.md Stage 7 loop).
Anti-patterns to refuse
- Test after. If the test was written after the production code, it's not TDD; rewrite the test first or delete the production code.
- Horizontal slicing. Don't write all the tests then all the code. Strict one-cycle-at-a-time.
- Mock the unit under test. Mocks belong at system boundaries (network, filesystem, time, randomness). Mocking the thing you're testing means the test is meaningless.
- Refactor on red. Never. Refactoring without a green safety net is just changing code.
- Refactor without a refactor. Don't ship code that you yourself would have flagged in review.
When you can't make the test pass within two attempts
Stop. Write a note in implementation-log.md describing what you tried, what you observed, and what you suspect is the root cause. Return control to the orchestrator with a blocked summary. Don't keep grinding — the spec or design probably has a gap.
Mocking guidance
- Mock at system boundaries: HTTP clients, database drivers, filesystem, clock, random.
- Prefer SDK-style fakes over generic mocks (a fake
UserStoreover a generic mock of a method). - Never mock the system under test. Never mock value objects.
- Inject dependencies; don't reach for globals to swap out.
Definition of done for a task
- All acceptance criteria have at least one passing test asserting the observable behavior.
- The whole test suite is green.
- Lint and type-check pass.
- An
implementation-log.mdentry was appended. - No
TODOleft in the code that wasn't already there.
Outputs
- Source code changes.
- Test additions.
- One
implementation-log.mdappend per task. - No artifacts in
specs/<slug>/other than the log append — the design and spec are upstream-owned.
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.

