agentleFS
PeanutGTPeanutGT/NutsSkills/skills/tdd/SKILL.md

tdd

Skill3 starsChanged 20 days agoApache-2.0View on GitHub

Use before writing any implementation code for a feature, bugfix, or behavior change. Drives the work with one failing test at a time (red, green, refactor) at an agreed public seam.

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, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 3

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

    Iron law: No production code without a test that you watched fail first.

    line 14
  2. Distinctive:

    Before the first test, name the seams you will test and what each catches.

    line 27
  3. Very specific:

    If no clean seam exists, the design is the problem: see design.

    line 28
  4. Distinctive:

    Run the relevant suite: All green.

    line 35

“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

Iron law: No production code without a test that you watched fail first.

A test you never saw fail proves nothing. It may test the wrong thing, or nothing at all.

When to use

  • New features and behavior changes
  • Bug fixes (the failing test reproduces the bug; see debug)
  • Refactors of untested code (write characterization tests first)

Skip only with the user's OK: throwaway prototypes, generated code, pure config.

Choose the seam first

A seam is the public boundary where you observe behavior: a function's signature, an HTTP endpoint, a CLI command. Tests live at seams, never against internals.

  • Before the first test, name the seams you will test and what each catches. For non-trivial work, confirm them with the user.
  • If no clean seam exists, the design is the problem: see design.

The cycle

  1. Pick one behavior: the smallest next thing. Start simple: zero, empty, one.
  2. RED: one test, named for the behavior (rejects passwords shorter than 8 chars).
  3. Watch it fail for the expected reason (an assertion, not an import error or typo).
  4. GREEN: the minimum code that passes. Hardcoding is fine until a test forbids it.
  5. Run the relevant suite. All green.
  6. REFACTOR: names and duplication only, tests green after every change. Larger cleanup goes to simplify.
  7. Repeat until the acceptance criteria are covered.

Order of cases: zero → one → many → boundaries → errors and invalid input.

Edge-case tests that pass on the first run are fine — write them anyway. They guard against regressions. To prove one can fail, briefly break the code (or the expected value), watch it go red, then restore.

Anti-patterns

  • Implementation-coupled: mocks internal collaborators, tests private methods, or checks a side channel (querying the database instead of the interface). Tell: it breaks on a refactor that changed no behavior.
  • Tautological: the expected value is computed the same way the code computes it (assert add(a, b) == a + b), so it can never disagree. Expected values come from an independent source: a literal, a worked example, the spec.
  • Horizontal slicing: writing all the tests first, then all the code. Work in vertical slices: one test, one implementation, learn, repeat.
  • Weak assertions: "not null", "no exception". Assert specific values.

Good tests

  • One reason to fail per test; clear arrange / act / assert.
  • Mock only at system boundaries (network, clock, filesystem, third-party APIs).
  • Deterministic: no real time, randomness, or ordering dependence.

Rationalizations to reject

ExcuseAnswer
"Too simple to test"Then the test takes 30 seconds. Write it.
"I'll add tests after"Tests written after pass on the first run, so they never proved anything.
"I tested it manually"Manual checks don't repeat. The next change breaks it silently.
"I already wrote the code, I'll keep it as reference"Delete it and start from the test, or the test will be shaped to fit the code.
"This test is hard to write"The design is hard to use. Fix the seam (design).

Done when

  • Every acceptance criterion has at least one test at an agreed seam
  • Edge cases covered: empty, boundaries, invalid input
  • Each test was seen failing at least once (first run, or by briefly breaking the code)
  • Full relevant suite passes (output seen; see verify)

Related: debug, verify, design, simplify.

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.