agentleFS
daniel-kindldaniel-kindl/dkstack/skills/tdd-loop/SKILL.md

tdd-loop

Skill1 starsChanged 8 days agoMITView on GitHub

Use when you add or change behavior in code, or fix a bug. Runs the red, green, refactor cycle with a failing test first.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 9

    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:

    Use when you implement behavior.

    line 8
  2. Distinctive:

    Follow the red-green-refactor cycle from tdd/index.md.

    line 10
  3. Distinctive:

    If the feature has an active plan, read its next item that is not blocked first.

    line 12
  4. Distinctive:

    Write a failing test that describes the desired behavior.

    line 16
  5. Distinctive:

    Write the smallest amount of production code that makes the test pass.

    line 17
  6. Distinctive:

    Do not implement without a verified claim.

    line 25
  7. Distinctive:

    Do not write production code before a failing test exists.

    line 33
  8. Distinctive:

    Do not skip the failing step.

    line 35
  9. Distinctive:

    Keep each cycle small.

    line 36

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

Use when you implement behavior.

Follow the red-green-refactor cycle from tdd/index.md.

If the feature has an active plan, read its next item that is not blocked first. After you implement and verify the item, record the real evidence, the commit identifier and the status. Follow feature plans.

Steps

  1. Write a failing test that describes the desired behavior. Confirm it fails for the right reason.
  2. Write the smallest amount of production code that makes the test pass.
  3. Confirm the test passes and existing tests still pass.
  4. Refactor only while tests are green.
  5. Repeat for the next behavior.

Rules

  • Read claims.md. Do not implement without a verified claim.
  • You must not implement a mapped issue in the session that mapped it. A fresh session does that work. See work.md.
  • In the refactor step, stay inside the task scope. Do not change unrelated code. Keep every existing test green. Do not limit the refactor to code that a test already executes. When no test checks a behavior that this refactor can change, write a test for that behavior first. That test must pass before you change the code. See stewardship.
  • Do not write production code before a failing test exists.
  • Tests must prove behavior, not implementation details.
  • Do not skip the failing step.
  • Keep each cycle small.

See also coding/testing.md.

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.

Reviews can't be read right now.

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.