afb-tdd
An interactive Claude Code skill to do red-green-refactor style TDD. The robit writes one failing test at a time with explicit pauses for the human to review.
Two skills:
| Skill | What it does |
|---|
| afb-tdd | The red-green-refactor loop, with an adversarial sceptic on every cycle. The one you use daily. |
| afb-tdd-setup | Run once per repo. Detects your stack and commands, audits your test suite, and tunes the loop to the project. |
The loop's SKILL.md does a pretty good job of explaining the logic.
How to do the thing:
Install
As a plugin:
claude plugin marketplace add afbreilyn/afb-tdd
claude plugin install afb-tdd@afbreilyn
Skills are then /afb-tdd:afb-tdd and /afb-tdd:afb-tdd-setup — plugin skills keep the
plugin name as a prefix.
For development, clone and symlink instead, which gives unprefixed /afb-tdd and
/afb-tdd-setup:
git clone [email protected]:afbreilyn/afb-tdd.git ~/workspace/afb-tdd
~/workspace/afb-tdd/scripts/link-skills.sh
The clone has to live outside ~/.claude/skills/, or the symlink target and the clone
collide on the same path.
Project-local — tune the loop to your conventions and domain logic
/afb-tdd-setup
It detects your stack, commands, conventions, architecture and docs, audits your existing
test suite, and writes .claude/afb-tdd/ — committed resources the loop reads:
.claude/afb-tdd/
├── manifest.json what was generated, when, against which commit
├── project.md facts: stack, commands, layout, slice order
└── practices.md taste: how this team tests, with gold-standard exemplars
Commit them. They mean the same thing on every teammate's machine, and /afb-tdd prefers
them over its built-in conventions. It is a soft dependency: the loop works fine in a
repo that never ran setup.
These files are yours once written. A second run refuses to clobber them; --refresh
regenerates alongside for you to diff and merge.
In a polyrepo, every member repo gets its own .claude/afb-tdd/; there is no top-level
index, since a container usually isn't a git repo and nothing there could be committed.
See ADR 0001.
/afb-tdd in that project then reads those files before its first cycle and prefers them
over its built-ins. Same command, same skill, tuned to the repo.
Writing them by hand
The files are plain markdown with no required schema; setup just saves you the detection
and the audit. A minimal .claude/afb-tdd/project.md:
# afb-tdd: project profile
## Commands
- Full suite: `make test` # or whatever you use
## Architecture: where a feature lives
- `svc/` — what lives here, and its entry points
## Domain gotchas
- DB setup/teardown, auth/tenancy, time control, external stubs, isolation
And practices.md for house style: how this team writes tests, gold-standard files to
copy with file:line, known deviations that are not precedent.
Keep every path repo-relative. These files are committed and read on other people's
machines, so a ~/.claude/... path in one is a bug.
The Sceptic (the gremlins!)
Every cycle gets adversarially reviewed twice — after Red (is the test tautological, weak, mock-testing, mispredicted?) and after Green (over-implementation, untested code, cheating vs declared Fake It, tests bent to fit) — by a read-only subagent applying the closed rubric in sceptic.md. It runs on the session's model and may search the repo to settle a check, so "is this already tested?" gets answered by the suite rather than by the author's say-so. When a blocker or concern gets fixed, the sceptic reviews the fix in another round, up to three per checkpoint. Findings appear in the report at the existing pause points, each answered with FIXED / REBUTTED / YOUR CALL. On by default; /afb-tdd --no-sceptic turns it off for the session — skips are always visible in the report, never silent.
Evals
evals/ measures the quality of what the skill actually produces — fixture repos, headless runs, deterministic gates (suite green, revert check, red-before-code from the transcript, convention greps), plus optional mutation testing and an LLM judge that scores against the same sceptic rubric. See evals/README.md for how to run them and track quality over time.
Feedback
Like any TDD-er, I would love feedback! If you have examples / tweaks / conventions / patterns / anti-patterns / pirate jokes to share, please fork the repo and open up a PR!
License

Acknowledgments