agentleFS
JuankCadavidJuankCadavid/akili-specs/.claude/skills/tdd/SKILL.md

tdd

Skill12 starsChanged 14 days agoMITView on GitHub

Trigger: test-driven development, TDD, red-green, test-first implementation of a logic-heavy task, 'red-green-refactor'. Red → green loop with tests worth keeping: seams, anti-patterns (implementation-coupled, tautological, horizontal slicing), vertical slices. In AKILI-SPECS the Leader assigns it per task; expected values come from the approved requirements.md scenarios and seams from design.md.

194 other projects use a version of this, 86 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 subtitled 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

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

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 1

    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, read CONTEXT.md (if it exists) so test names and interface vocabulary match the project's domain language, and …

    line 18
  2. Distinctive:

    Ask: "What's the public interface, and which seams should we test?"

    line 32

“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

TDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle — consult them before and during the loop, not after.

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

What a good test is

Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification — "user can checkout with valid cart" tells you exactly what capability exists — and survives refactors because it doesn't care about internal structure.

See tests.md for examples and mocking.md for mocking guidelines.

Seams — where tests go

A seam is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.

Test only at pre-agreed seams. Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything — agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.

Ask: "What's the public interface, and which seams should we test?"

Anti-patterns

  • Implementation-coupled — mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
  • Tautological — the assertion recomputes the expected value the way the code does (expect(add(a, b)).toBe(a + b), a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth — a known-good literal, a worked example, the spec.
  • Horizontal slicing — writing all tests first, then all implementation. Bulk tests verify imagined behavior: you test the shape of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in vertical slices instead — one test → one implementation → repeat, each test a tracer bullet that responds to what the last cycle taught you.
  • Inert fixture — the correct implementation and the most plausible wrong one read the same on the fixture, so the assertion cannot discriminate. The tell: mutate the logic the test claims to prove and the test stays green; the fix is a fixture row on which the readings diverge.
  • Plumbing test — the test renders or exercises a fragment authored in the test file (a copied template, a hand-built structure) instead of the real artifact, so it proves the test's own wiring. The tell: delete the feature from the real file and the test stays green; the fix is a lock on the real artifact (a static read of the shipped file or a rendered measurement of the shipped element).

Rules of the loop

  • Red before green. Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features. The red fails on the behavioral assertion — a red from setup, a missing dependency, an unmatched intercept, a timeout, or a mock that never reaches the timing under test is not a red.
  • One slice at a time. One seam, one test, one minimal implementation per cycle.
  • Refactoring is not part of the loop. It belongs to the review stage (see the code-review skill), not the red → green implementation cycle.

AKILI-SPECS Integration

In AKILI projects this skill runs inside the Implementer's inner loop, assigned per task — it changes how a task is built, never what the spec approved.

Upstream ruleHow it lands here
Assignment is the Leader's call (binding: conditional)The /akili-execute Leader assigns this skill in the brief for logic-heavy tasks (algorithms, business rules, data transformations, contract implementations). Never blanket: TDD on a copy tweak or a styling task is pure cost. When assigned, the Implementer loads it before writing any code.
Expected values come from the spec, not from the user mid-loopThe anti-tautological rule demands an independent source of truth — in AKILI that source already exists and is already approved: the Given/When/Then scenarios in requirements.md named by the task. Derive each red test's expected value from its scenario; if a scenario is too vague to yield one, that is a spec gap to report to the Leader, not a value to invent.
Seams are pre-agreed in design.md, not asked liveThe upstream "confirm seams with the user" question is already answered: the public interfaces in the spec's design.md (and the TRD's module boundaries) are the agreed seams — the Leader's brief points at them. Only when the design genuinely defines no interface for the task's area does the seam question go to the Leader (as a design ambiguity, per /akili-execute's error handling — never straight to the user).
Bug Mode is already TDD/akili-specify Bug Mode mandates a regression test red before the fix, green after — this skill generalizes that same discipline to feature tasks. On a bugfix task, the two are one loop: the mandatory regression test is the first red.
Refactoring belongs to reviewThe upstream rule maps 1:1 onto the AKILI harness: the Reviewer's 4R lenses and the simplify pass own refactoring. The Implementer's loop stays red → green; do not gold-plate inside it.
No duplication with /akili-testTDD tests are the author's tracer bullets at unit seams; /akili-test's Testers remain the independent proof (author ≠ tester): negative constraints, integration, E2E. Testers cite existing TDD coverage in their per-scenario matrix instead of rewriting it, and add what the author's loop does not cover.
Verification evidenceThe Implementer's completion report cites the red → green history as verification evidence: the test file(s), the scenario each test proves, and the final green run. A test that was never seen red is not TDD evidence — say so rather than implying it. Each cited red names the assertion it failed on; a red that failed in setup is reported as not-a-red rather than implied as TDD evidence. The red is a quoted artifact, not a description: per test name, quote the assertion's own expected/actual output (expected: 'outdated', actual: 'current'); a TypeError from a missing export, an ENOENT, or a stub that throws before the assertion is written as "not red" — in changes/persona-upgrade every code task lost a round or a continuation to reds of that kind reported as red.

One sentence to remember: the spec supplies the expected values, the design supplies the seams, the Leader supplies the assignment — the loop supplies only the discipline.

Authorship

TDD skill by Matt Pocock — github.com/mattpocock/skills, MIT License. Adapted for AKILI-SPECS by Juan Carlos Cadavid — jcadavid.com.

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.