agentleFS
poshan0126poshan0126/dotclaude/skills/tdd/SKILL.md

tdd

Skill871 starsChanged 5 months agoMITView on GitHub

Test-Driven Development loop. Write a failing test first, then the minimum code to pass it, then refactor. Repeat.

195 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

14 rules. 0 are common, 14 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 14

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

    Write ONE test for the smallest next behavior (not the whole feature)

    line 18
  2. Distinctive:

    Run the test. It MUST fail: If it passes, either:

    line 23
  3. Distinctive:

    Verify the failure message makes sense.

    line 26
  4. Distinctive:

    Write the simplest, most obvious code that makes the failing test pass

    line 30
  5. Distinctive:

    Don't generalize. Don't make it elegant.

    line 31
  6. Distinctive:

    Run the test. It MUST pass: If it doesn't, fix the code (not the test.

    line 33
  7. Distinctive:

    Run ALL tests. Nothing previously passing should break.

    line 34
  8. Distinctive:

    Look for: duplication, unclear names, functions doing too much, magic values

    line 38
  9. Distinctive:

    Run ALL tests after each change: If anything breaks, undo immediately.

    line 40
  10. Distinctive:

    Stop refactoring when the code is clean enough.

    line 41
  11. Distinctive:

    The test drives the design: If the code is hard to test, the design is wrong.

    line 59
  12. Distinctive:

    Don't mock what you own: If you need to mock your own code to test it, the code needs restructuring.

    line 60
  13. Distinctive:

    After each cycle, briefly state:

    line 65
  14. Distinctive:

    When the feature is complete, provide a summary of all behaviors covered and any gaps that would need integration or manual testing.

    line 70

“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

Build the following using strict Test-Driven Development:

Feature: $ARGUMENTS

The TDD Cycle

Repeat this cycle for each behavior. Never skip steps.

Red: Write a Failing Test

  1. Write ONE test for the smallest next behavior (not the whole feature)
  2. The test must:
    • Describe the behavior in its name: should return 0 for empty cart
    • Use Arrange-Act-Assert structure
    • Assert specific values, not vague truths
  3. Run the test. It MUST fail. If it passes, either:
    • The behavior already exists (skip to the next behavior)
    • The test is wrong (it's not testing what you think. Fix it)
  4. Verify the failure message makes sense. It should tell you what's missing

Green: Write the Minimum Code to Pass

  1. Write the simplest, most obvious code that makes the failing test pass
  2. Don't generalize. Don't make it elegant. Don't handle cases the test doesn't cover.
  3. Hardcoding is fine if only one test exists for that path. The next test will force generalization
  4. Run the test. It MUST pass. If it doesn't, fix the code (not the test. The test defined the behavior)
  5. Run ALL tests. Nothing previously passing should break.

Refactor: Clean Up Without Changing Behavior

  1. Look for: duplication, unclear names, functions doing too much, magic values
  2. Make ONE improvement at a time
  3. Run ALL tests after each change. If anything breaks, undo immediately.
  4. Stop refactoring when the code is clean enough. Don't gold-plate

Choosing What to Test Next

Work from simple to complex:

  1. Degenerate cases. Null input, empty collection, zero
  2. Happy path. The simplest valid input
  3. Variations. Different valid inputs that exercise different branches
  4. Edge cases. Boundary values, max sizes, special characters
  5. Error cases. Invalid input, failures, exceptions
  6. Integration. How this connects to the rest of the system

Each test should require a small code change. If you need to write more than ~10 lines of production code to pass a test, the test is too big. Split it.

Rules

  • Never write production code without a failing test that demands it.
  • Never write more than one failing test at a time. One red → green → refactor cycle at a time.
  • The test drives the design. If the code is hard to test, the design is wrong. Change the design, not the test approach.
  • Don't mock what you own. If you need to mock your own code to test it, the code needs restructuring.
  • Commit after each green+refactor cycle. Small, passing, meaningful commits.

Output

After each cycle, briefly state:

  • Test: what behavior was added
  • Code: what changed to make it pass
  • Refactor: what was cleaned up (or "none needed")

When the feature is complete, provide a summary of all behaviors covered and any gaps that would need integration or manual testing.

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.