agentleFS
tejastn10tejastn10/workbench/skills/quality/tdd/SKILL.md

tdd

Skill1 starsChanged 2 months agoMITView on GitHub

Test-driven development — the red → green loop done so it produces tests worth keeping. Test behaviour through public seams (agreed with the user up front), one vertical slice per cycle, expected values from an independent source. Use when building a feature or fixing a bug test-first, or when the user says "red-green-refactor" / "write the test first".

194 other projects use a version of this, 58 of them edited.

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

3 rules. 0 are common, 2 are distinctive, and 1 is 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.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When exploring the codebase first, read CONTEXT.md if it exists so test names and interface vocabulary match the project's domain language, …

    line 11
  2. Distinctive:

    Test only at pre-agreed seams: Before writing any test, write down the seams under test and confirm them with the user.

    line 26
  3. Distinctive:

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

    line 37

“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

Test-driven development

Adapted from mattpocock/skills quality/tdd (MIT), inlined and trimmed to fit this repo's conventions.

When exploring the codebase first, read CONTEXT.md if it exists so test names and interface vocabulary match the project's domain language, and respect any ADRs in the area you're touching.

What a good test is

Verifies behaviour through a public interface, not implementation details. The code can change entirely; the test shouldn't. It reads like a specification — user can checkout with valid cart — and survives refactors because it doesn't care about internal structure.

Seams: where tests go

A seam is the public boundary you observe behaviour at without reaching inside.

Test only at pre-agreed seams. Before writing any test, write down the seams under test and confirm them with the user. Effort then lands on the critical paths and the complex logic, not every edge case. Ask: "what's the public interface, and which seams should we test?"

Match the project's test conventions (from CONTEXT.md / the pr-review skill for that stack): Go → table-driven _test.go beside the source; Python → _test.py beside the source with @pytest.mark.parametrize; NestJS → *.spec.ts.

The loop

  • Red before green. Write the failing test first, then only enough code to pass it. No speculative features, no anticipating the next test.
  • One slice at a time. One seam, one test, one minimal implementation per cycle. Each test is a tracer bullet that responds to what the last cycle taught you.
  • Refactoring is not part of the loop. It's a separate pass — see skills/pr-review/ and the /simplify skill.

Anti-patterns

  • Implementation-coupled — mocks internal collaborators, tests private methods, asserts through a side channel (querying the DB instead of the interface). Tell: the test breaks on a refactor when behaviour didn't change.
  • Tautological — the assertion recomputes the expected value the way the code does (expect(add(a,b)).toBe(a+b), a hand-derived snapshot, a constant equal to itself). Expected values must come from an independent source: a known-good literal, a worked example, the spec.
  • Horizontal slicing — all tests first, then all implementation. You end up testing the imagined shape of things; the tests go insensitive to real change. Work vertically: one test → one implementation → repeat.

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.