agentleFS
fab-codesfab-codes/agent-workflow-template/.claude/skills/tdd/SKILL.md

tdd

Skill2 starsChanged 25 days agoMITView on GitHub

Steps 2 and 6 of AGENTS.md §12 — test first: every Acceptance item, or Codex finding, seen red before the code turns it green

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

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 2

    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. Very specific:

    Every Acceptance item checked by a test of deno task test.

    line 20
  2. Distinctive:

    Stop and ask, before writing the test, when an item cannot be observed from a public interface, or when the shape of the interface is still …

    line 32
  3. Distinctive:

    Red before green: Write the failing test first, then only the code that makes it pass.

    line 43
  4. Very specific:

    Within one turn: Every cycle closes in the turn it starts in: at the end of the turn the Stop hook runs deno task verify, and a red test …

    line 57

“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

Steps 2 and 6 of the cycle in AGENTS.md §12: the red → green loop, which writes every test before the code it checks. What makes a test worth keeping is written in §9; this skill is how to get there, one cycle at a time.

Source

At step 2, the Acceptance of the issue of the branch: gh issue view <n>, with <n> from feat/<n>-… or fix/<n>-…. Without an issue, stop and say why, without falling back on the conversation: after a /clear or on another PC the issue is the only record of what was agreed (§12, Rules).

At step 6, the scenario of each finding the user accepted (/codex-review).

What goes through the loop

Every Acceptance item checked by a test of deno task test. An item checked by hand, such as the behavior of a skill or a document, does not: say which ones, and why. In a mixed change only the testable items go through the loop.

On a fix/ branch the first red is the regression test that reproduces the bug on the current code (§9).

Seams

A seam is the public interface where a behavior is observed without reaching inside. Tests live at seams, never against internals.

The seams come from the Acceptance, which the user already agreed in the issue: they need no second confirmation. Stop and ask, before writing the test, when an item cannot be observed from a public interface, or when the shape of the interface is still open: that is a decision, and decisions are the user's.

At the seam of an item, add without asking the tests that §9 and §8.1 make mandatory: malformed and hostile inputs, one test for each rejected case. Do not open a seam that no item implies without asking.

Such a test can be green at its first run, when an earlier cycle already covers its case: it stays, because §9 requires it, and the report marks it green at first run. Never weaken the code to see it red.

The loop

  • Red before green. Write the failing test first, then only the code that makes it pass. Do not anticipate later tests and do not add speculative features (§4.2).
  • One slice at a time. One seam, one test, one minimal implementation per cycle. Never horizontal slicing, all the tests first and then all the code: tests written in bulk check imagined behavior, the shape of things instead of what a caller sees, and fix the structure of the tests before the implementation has taught anything. Each test is a tracer bullet that answers to what the last cycle taught.
  • Red at run time. Red is the test failing on what it asserts. A type error is not red: deno test type-checks first, and a missing name proves only that the name is missing, not that the assertion can fail. For a name that does not exist yet, write its signature first, with a body that compiles without the behavior, see the assertion fail, then implement. Under the compilerOptions of deno.json a parameter the body does not read yet is a type error: its name takes a leading _ until the implementation reads it.
  • Same permissions as the suite. Observe red and green with deno task test <file>, never with a deno test run with permissions of its own: a test green only thanks to extra permissions is what the invariant on the network rules out (§9).
  • Within one turn. Every cycle closes in the turn it starts in: at the end of the turn the Stop hook runs deno task verify, and a red test fails it. To stop and ask, stop before writing the test or after green, never on red.
  • No refactoring. Refactoring is not part of the loop: it comes from the /review findings the user accepts (§12, step 3), with deno task verify green afterwards.

Anti-patterns

The rules are in §9. These are the signs that a test breaks them:

  • Implementation-coupled: it tests a private function, or verifies through a side channel, such as the internal state of a fake instead of reading back through the interface. The tell: it breaks on a refactoring that does not change behavior.
  • Tautological: the expected value is recomputed the way the code computes it, as in assertEquals(add(a, b), a + b), so the test passes by construction and can never disagree with the code.
  • More than one behavior: a test with several logical assertions, which fails without saying which behavior broke. One logical assertion per test.

Step 6

The test that reproduces an accepted finding goes through the same loop: it is seen red on the reviewed SHA, before the fix. If it does not turn red, the finding is not reproduced: say so, with the output of the test, and stop. The user decides.

Report

At the end of step 2, for each Acceptance item: the name of its test and the failure line seen at red, or checked by hand for an item that does not go through the loop. Then each test added at the seam of an item, with its failure line or green at first run. At step 6 the failure line goes into the outcome of the finding, in the record of /codex-review.

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.