TDD Skill Review: What Test-First Discipline Actually Costs in Tokens
The tdd skill in Matt Pocock's skills repo is 3,549 bytes of markdown, shipped with two reference files — tests.md and mocking.md — that push the loaded footprint to 7,331 bytes. The repo crossed 235,000 stars this month. No scripts, no dependencies. It's a discipline, written down, that the agent re-reads on every turn.
Test-first coding is a good habit. The question nobody publishes is whether wrapping it in a skill costs you more than it saves. Skills are prompt injection by design, and a loop skill re-sends its own instructions plus the growing conversation on every round. So we ran it against a real feature, ran the same feature with no skill, and logged every token.
TL;DR / Key Takeaways
- The
tddskill in the mattpocock/skills repository is a 3,549-byte SKILL.md; with itstests.mdandmocking.mdreference docs the loaded set is 7,331 bytes of markdown, no executable code. - A complete five-round red-green session adding a coupon feature to a billing function used 26,020 net input tokens and 2,194 output tokens, totalling 28,214 tokens.
- That session cost $0.074 on Claude Sonnet 5, $0.185 on Claude Opus 5, and $0.037 on Claude Haiku 4.5 at published list pricing.
- The same feature with no skill loaded finished in two rounds at 14,012 net tokens and $0.046 on Claude Sonnet 5 — so the tdd skill cost roughly 2x, not less.
- The mattpocock/skills repository is MIT licensed by Matt Pocock and contains 37 skills across engineering, productivity and misc directories.
What the skill actually says
The whole thing is built on one concept it calls a seam: the public boundary you test at, never internals. The rule that follows is the load-bearing one:
"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."
Then the loop itself, stated flatly:
"Red before green. Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features. One slice at a time. One seam, one test, one minimal implementation per cycle."
The two reference files carry the taste. tests.md draws the line between behavior tests and implementation-detail tests, including a sharp warning about tautological tests where "the assertion recomputes the expected value the way the code does" so it "passes by construction." mocking.md says mock only at system boundaries — external APIs, databases, time, randomness — and never your own collaborators. It's opinionated in the right places.
The measured run
We ran claude-sonnet-5 through an OpenAI-compatible endpoint with usage accounting on. The task was realistic and small, the kind you'd actually reach for TDD on: add percentage coupons with expiry dates to an existing calculateInvoice function, with the current source and one passing test pasted in. Coupon applies before tax, rounds the discount down, expired coupon adds a warning line item. We answered the skill's questions substantively and drove it round by round until it declared the loop done.
One methodology note, because it changes the numbers a lot. Our test client adds a fixed system preamble to every request. We measured it with a two-token control prompt before the run — 6,479 prompt tokens for the word "ok" — and subtracted that baseline from every turn. Every net figure below has that overhead removed. Skip this step and you overstate a five-round session by roughly 32,000 tokens, which is where inflated skill-cost claims come from.
| Round | Raw prompt tokens | Net prompt tokens | Output tokens | Response size |
|---|---|---|---|---|
| 1 — confirm seam, ask questions | 10,968 | 4,489 | 556 | 1,846 chars |
| 2 — first red test | 11,509 | 5,030 | 255 | 784 chars |
| 3 — minimal green | 11,279 | 4,800 | 303 | 964 chars |
| 4 — red test, expired coupon | 11,978 | 5,499 | 356 | 1,139 chars |
| 5 — green + stop summary | 12,681 | 6,202 | 724 | 2,399 chars |
| Total | 58,415 | 26,020 | 2,194 | 28,214 net tokens |
Round one is pure discipline: the agent refused to write a test and instead asked four pointed questions — coupon field shape, whether "now" should be an injected value rather than Date.now() so expiry tests aren't flaky, the shape of the warning line item, and whether the coupon reduces the tax base. That last one is a genuine design decision the feature brief left ambiguous, and it surfaced it before writing a line. Rounds two through five walk the loop: one failing test, minimal code, next failing test, minimal code, stop. Net input climbs every round because the transcript re-sends; output stays small because each turn does one thing.
Cost across models
Same 28,214 net tokens, priced against current published rates. Anthropic confirmed Claude Sonnet 5 stays at $2 and $10 per million tokens — the increase to $3 and $15 scheduled for September 1, 2026 was cancelled.
| Model | Input price | Output price | Context window | Cost per tdd session |
|---|---|---|---|---|
| Claude Haiku 4.5 | $1 per 1M tokens | $5 per 1M tokens | 200,000 tokens | $0.037 |
| Claude Sonnet 5 | $2 per 1M tokens | $10 per 1M tokens | 1,000,000 tokens | $0.074 |
| Claude Opus 5 | $5 per 1M tokens | $25 per 1M tokens | 1,000,000 tokens | $0.185 |
Under twenty cents on Opus 5 for a full test-first feature. In absolute terms the skill is not the expensive part of your day. The interesting number is the relative one.
Compared to just asking
We ran the identical feature — same pasted source, same requirements — with no skill loaded, just "help me add this feature test-first." That's the honest baseline, because the alternative to the skill isn't nothing, it's a competent agent that already knows what TDD is.
| Approach | Rounds | Net input | Output | Sonnet 5 cost | What you get |
|---|---|---|---|---|---|
| No skill, "test-first" | 2 | 11,750 tokens | 2,262 tokens | $0.046 | Both slices written in round one with its own field-name assumptions; done by round two |
tdd skill | 5 | 26,020 tokens | 2,194 tokens | $0.074 | Seam confirmed and four design questions raised before code; one slice per round |
So the skill cost about 1.6x the tokens and 60% more dollars, and it took five rounds where the unguided agent finished in two. That's the honest headline: the tdd skill does not save tokens, it spends them on discipline. The control agent went straight to writing both tests and a full implementation, picking its own field names (percentBps, a -1000 discount line item) without asking. The skill stopped and asked whether the coupon should reduce the tax base, caught the injected-time-vs-Date.now() flakiness trap, and only committed once the seam was confirmed. Same feature, different amount of thinking done out loud.
How to install it
Two routes, and the repo tells you to pick one. The plugin gives you a managed read-only bundle that updates when the author ships. The installer copies editable files into your project.
# Claude Code, managed bundle, auto-updates
claude plugins install mattpocock-skills
# Codex and other agents, or editable local copies
npx skills@latest add mattpocock/skills
Install both and you get every skill twice. Invoke it by asking the agent to work test-first, or naming the tdd skill directly. Worth knowing: the SKILL.md tells the agent that when the interface shape itself is in question it should "call the Skill tool with codebase-design" — so on a fresh design the skill can pull in a second skill for its vocabulary. Loading both is more context again.
Where it earns its keep, and where it doesn't
Use it when the design isn't settled and a wrong seam costs you a rewrite: new modules, ambiguous interfaces, logic with rounding and boundary conditions that deserve locked-in expected values. The tautological-test warning alone is worth having in context if your agent has a habit of writing expect(add(a,b)).toBe(a+b) and calling it a test. On this coupon feature the skill caught a real time-injection flakiness issue the control arm didn't mention.
Skip it on features you've already specced, mechanical changes, and anything a competent agent will one-shot correctly. Here's the honest criticism: on a small, well-understood feature the skill turned a two-round job into five and roughly doubled the cost, and round five was largely a summary of what it had already done. The seam-confirmation round is the skill working as designed — and it's pure overhead when you already know the seam is calculateInvoice and you'd have accepted the agent's default field names anyway. The "one slice per cycle" rule compounds this: every extra round re-sends the whole transcript, so the token cost of discipline is front-loaded input, not output. On a genuinely gnarly feature that's a bargain. On a trivial one you're paying for ceremony.
Run the numbers on your own workload
We measured this session through an OpenAI-compatible endpoint that exposes per-request token accounting across Claude, GPT-5.6, and other model families, so switching models to compare is a one-line change. Useful if you want to reproduce these figures or benchmark your own skills.
Get an API keyFAQ
What does the tdd skill do?
It enforces a red-green-refactor loop. The agent confirms the public seam to test before writing anything, then works one vertical slice at a time: one failing test, minimal code to pass it, repeat. It ships a 3,549-byte SKILL.md plus tests.md and mocking.md, 7,331 bytes loaded.
How much does a tdd skill session cost in tokens?
Our five-round session used 26,020 net input tokens and 2,194 output tokens, 28,214 total. That's $0.074 on Claude Sonnet 5, $0.185 on Claude Opus 5, $0.037 on Claude Haiku 4.5.
Does the tdd skill save tokens?
No. In our test the same feature with no skill finished in two rounds at 14,012 net tokens and $0.046 on Sonnet 5. The skill took five rounds and 28,214 tokens, about double, trading tokens for seam confirmation and one-slice-per-turn discipline.
Is the tdd skill safe to install?
The files in this repo are plain markdown with no executable code, and the repository is MIT licensed. We read every file before running it. Still, treat any third-party skill as untrusted input and read it yourself — a skill is instructions handed to an agent that has your tools.
Skill by Matt Pocock, MIT licensed. Source: github.com/mattpocock/skills. Quoted lines are short excerpts for review purposes. Measurements taken August 25, 2026 against claude-sonnet-5; your token counts will vary with prompt and codebase.