agentleFS
brokspacebrokspace/brok/skills/engineering/tdd/SKILL.md

tdd

Skill12 starsChanged 28 days agoApache-2.0View on GitHub

Test-driven development with a red-green loop, one vertical slice at a time. Use when building a feature or fixing a bug test-first, when the user mentions TDD, red-green, or regression tests, or when another skill asks for tests at agreed seams.

193 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

  • jaydubya818Skill

    figure-it-out

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

    Also in 66 projects that use this

  • shiwenbin1617Skill

    ketchup-video

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

    Also in 24 projects that use this

  • simo97Skill

    request-refactor-plan

    Use this skill when user wants to create a refactor plan.

    Also in 47 projects that use this

  • jaydubya818Skill

    principle-minimize-reader-load

    Apply when layers, wrappers, or hidden state make simple behavior hard to follow.

    Also in 57 projects that use this

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

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 189 edited versions we read keep these.

  • 4

    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:

    Read GLOSSARY.md if present: test names use the project's terms.

    line 12
  2. Distinctive:

    Never test below an agreed seam: no private functions, no internal collaborators.

    line 22
  3. Distinctive:

    Red: write one test for the next behavior.

    line 27
  4. Distinctive:

    Green: write the least code that makes it pass.

    line 30
  5. Distinctive:

    Use real collaborators that are fast and local (temp dirs, in-memory stores, a local socket).

    line 46

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

Red, then green, one small slice at a time, always through a public interface. The tests you keep should read like a specification of what the code does, and survive any refactor that keeps that behavior.

Read GLOSSARY.md if present: test names use the project's terms.

Seams first

A seam is the public boundary a test exercises: a function's signature, a CLI command, an HTTP route, a bus topic, a file format. Before the first test:

  1. List candidate seams, each with one line on what a test there catches and what it misses.
  2. Get the user's confirmation (unless another skill already agreed them).
  3. Never test below an agreed seam: no private functions, no internal collaborators.

The loop

  1. Red: write one test for the next behavior. Run it. It must fail, and for the reason you expect. A test that passes immediately proves nothing; rethink it.
  2. Green: write the least code that makes it pass. No extra branches, no future-proofing.
  3. Run everything that is fast. Keep the suite green before the next test.
  4. Next behavior. Each test is a tracer bullet: let what you learned shape the next one.

Refactoring is not part of this loop. It happens afterwards, during review.

Good tests

  • Assert observable outcomes (returned values, output, files written, events published), not which helpers were called.
  • Expected values come from an independent source: a literal, a worked example, the spec. Never recompute them the way the code does.
  • One reason to fail per test. Name it after the behavior: rejects_tokens_signed_with_unknown_keys.
  • Use real collaborators that are fast and local (temp dirs, in-memory stores, a local socket). Fake only what is slow, flaky or external, and fake it at the seam.

Anti-patterns

  • Writing all the tests first, then all the code: tests end up checking imagined shapes instead of behavior.
  • Mocking internals: the test breaks on refactors that keep behavior.
  • Tautologies: the assertion repeats the implementation, so it can never fail.
  • Snapshotting everything: big snapshots get approved without reading.

See tests.md for good and bad examples in Rust and TypeScript.

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.