agentleFS
wilstowilsto/claude-code-starter-kit/.claude/skills/tdd/SKILL.md

tdd

Skill0 starsChanged 8 months agoMITView on GitHub

Enforce Test-Driven Development workflow for bug fixes and features. Red-Green-Refactor cycle: write failing test FIRST, confirm RED, then implement, confirm GREEN. Triggers: "tdd", "test first", "red green refactor".

194 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use capture-learning-tools, design-frontend-dev 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.
  • The-Vibe-CompanySkill

    capture-learning-tools

    Turn technical conversations, bugs, CI failures, review comments,

    Also in 5 projects that use this

  • The-Vibe-CompanySkill

    design-frontend-dev

    Clean Impeccable frontend design skill. Use when the user wants to

    Also in 5 projects that use this

  • tristanphvnSkill

    ketchup-video

    Catch the user up like /keel:ketchup, with a short silent video of slides for what happened and the waiting calls as text under it. Use for /keel:ketchup-video.

    Also in 14 projects that use this

  • jaydubya818Skill

    figure-it-out

    Use when novel or multi-phase work needs an auditable workflow and no narrower playbook fits.

    Also in 54 projects that use this

  • jaydubya818Skill

    principle-laziness-protocol

    Apply when a refactor is adding wrappers or abstractions instead of simplifying.

    Also in 45 projects that use this

  • +2 more from The-Vibe-Company
  • +5 more from jaydubya818

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 17 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 17

    Distinctive

    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
  1. Distinctive:

    Before running tests, resolve the actual commands for this project:

    line 19
  2. Distinctive:

    Multi-stack: if CLAUDE.md has "Active Stacks", resolve per-stack commands based on the file path being tested

    line 32
  3. Distinctive:

    Use the resolved commands throughout all steps below.

    line 34
  4. Distinctive:

    Before writing any test, check if a functional spec exists for the domain:

    line 40
  5. Very specific:

    Look in docs/specs/ for a file matching the domain being modified

    line 42
  6. Distinctive:

    Write ONE test that describes the expected behavior

    line 50
  7. Distinctive:

    Run the project's test command (resolved in "Project Commands" above)

    line 51
  8. Distinctive:

    If the test passes immediately → the test is wrong OR the behavior already exists.

    line 53
  9. Distinctive:

    DO NOT proceed to GREEN until failure is confirmed and shown to the user

    line 54
  10. Distinctive:

    Write the MINIMUM code to make the failing test pass

    line 57
  11. Distinctive:

    CONFIRM: all tests pass

    line 59
  12. Distinctive:

    Do NOT add extra logic "while you're at it"

    line 60
  13. Distinctive:

    Coverage check: after GREEN, run the project's coverage command and show coverage for the modified file.

    line 61
  14. Distinctive:

    Only if there is clear duplication or code smell

    line 64
  15. Distinctive:

    Run tests after refactor → must still be green

    line 65
  16. Distinctive:

    Test PUBLIC behavior, not implementation details

    line 70
  17. Distinctive:

    Always show the user: RED output first, then GREEN output

    line 72
  18. Distinctive:

    Never skip RED confirmation

    line 73
  19. Very specific:

    If CLAUDE.md has an ## Active Stacks section, determine which stack the current file belongs to based on its path, then use that stack's …

    line 77

“Common” is measured: kept by at least 6 in 10 of the 186 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TDD Workflow — Red-Green-Refactor

When to use

  • Bug fixes: always (prove the bug exists with a failing test first)
  • New features in source directories: always
  • Config files, scripts, documentation: skip

Project Commands (auto-detected)

Before running tests, resolve the actual commands for this project:

  1. Read CLAUDE.md — look for explicit commands in "Workflow" or "Active Stacks" sections
  2. If not found, detect from project marker files:
Marker fileTestSingle testCoverage
package.jsonnpm testnpx jest <path> / npx vitest <path>npm test -- --coverage
pyproject.tomlpytestpytest <path>pytest --cov
go.modgo test ./...go test <path>go test -cover ./...
Cargo.tomlcargo testcargo test <name>cargo tarpaulin
Makefile (test target)make test—make coverage
  1. Multi-stack: if CLAUDE.md has "Active Stacks", resolve per-stack commands based on the file path being tested

Use the resolved commands throughout all steps below.

Cycle

0. SPEC — Read the functional spec

Before writing any test, check if a functional spec exists for the domain:

  1. Look in docs/specs/ for a file matching the domain being modified
  2. Spec exists → read User Stories / Behavior sections. Use acceptance criteria as test source. If spec conflicts with the requested change → flag to user before writing code.
  3. No spec exists → flag to user. For new features, run /spec-update first (advisory — user can proceed without).
  4. Behavior not in spec → spec gap. After GREEN, run /spec-update to document it.

Skip for: pure bug fixes contradicting spec, pure refactors (no behavior change), config/docs files.

1. RED — Write the failing test

  • Write ONE test that describes the expected behavior
  • Run the project's test command (resolved in "Project Commands" above)
  • CONFIRM the test FAILS (output must show FAIL/error)
  • If the test passes immediately → the test is wrong OR the behavior already exists. Investigate.
  • DO NOT proceed to GREEN until failure is confirmed and shown to the user

2. GREEN — Minimal implementation

  • Write the MINIMUM code to make the failing test pass
  • Run the project's test command (resolved in "Project Commands" above)
  • CONFIRM all tests pass
  • Do NOT add extra logic "while you're at it"
  • Coverage check: after GREEN, run the project's coverage command and show coverage for the modified file. Informational only — confirms the new test covers the new code.

3. REFACTOR (optional)

  • Only if there is clear duplication or code smell
  • Run tests after refactor → must still be green
  • Skip if the code is already clean

Rules

  • 1 test → 1 fix → repeat (vertical slicing, never batch tests)
  • Test PUBLIC behavior, not implementation details
  • Tests must survive refactoring — if they break during refactor, they test internals
  • Always show the user: RED output first, then GREEN output
  • Never skip RED confirmation

Multi-stack projects

If CLAUDE.md has an ## Active Stacks section, determine which stack the current file belongs to based on its path, then use that stack's test command. Read the corresponding .claude/stacks/<stack>.md for language-specific testing conventions.

Anti-patterns to avoid

Anti-patternWhy it's bad
Write fix first, add passing test afterNOT TDD — test doesn't prove anything
Batch 5 tests then implement allLoses RED-GREEN signal per test
Mock internal methodsTests break at refactor
Skip RED ("I know it will fail")Always run and show the output
Test private methods/implementationCouples tests to internals

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.