tdd

tdd is a skill for Claude Code, Codex from hon454/grimoire. It costs 52 tokens per session (2,041 once invoked), scanned A, original, MIT.

A test-first development procedure called TDD, or test-driven development. You write a test, see it fail, write the smallest code that passes it, and then clean up the code.

In plain words
What is it for?
Use it before features, bug fixes, refactors, and other behaviour changes to guide implementation through a red-green-refactor loop.
Why use it?
It reduces the risk of writing code that does not test the intended behaviour. It also keeps tests focused on the public boundaries where users or other parts of the system observe results.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Part of the book-of-engineering plugin — 2 skills shipped together

Good fit Use it before features, bug fixes, refactors, and other behaviour changes to guide implementation through a red-green-refactor loop.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hon454/grimoire/tdd
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add hon454/grimoire --skill tdd
Clone the repo
git clone --depth 1 https://github.com/hon454/grimoire

Made for: Claude Code, Codex.

Or install book-of-engineering, the plugin that ships this one along with the rest of its 2 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/hon454/grimoire/tdd/github.svg)](https://agentmods.dev/skills/hon454/grimoire/tdd)
Your own site
<a href="https://agentmods.dev/skills/hon454/grimoire/tdd"><img src="https://agentmods.dev/badge/skills/hon454/grimoire/tdd/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tdd

Your own site · 80×15
<a href="https://agentmods.dev/skills/hon454/grimoire/tdd"><img src="https://agentmods.dev/badge/skills/hon454/grimoire/tdd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,041 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.02041
Opus 5.5 $0.00021 $0.00816
Sonnet 5.5 $0.00010 $0.00408
Haiku 4.5 $0.00005 $0.00204

Measured 26d ago against content hash a609b9762165, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tdd scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 26d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/book-of-engineering/skills/tdd/SKILL.md · 186 lines

How it starts

The opening of the file, as written. The whole thing — 186 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Test-driven development

Write the test first. Watch it fail. Write the minimal code that makes it pass. Clean up. Repeat.

Core principle: if you did not watch the test fail, you do not know that it tests the right thing.

When this applies

Always: new features, bug fixes, refactors, behaviour changes.

Exceptions, only with the user's agreement: throwaway prototypes, generated code, configuration files.

Thinking "skip TDD just this once"? That is a rationalization. See the table below.

The iron law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Wrote code before the test? Delete it and start over from the test. Do not keep it "as reference", do not adapt it while writing tests, do not look at it. Implement fresh from the tests.

Before the loop: agree the seams

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

Before the first test, write down which seams you will test and confirm them with the user when the interface is new or unclear. Give each proposed seam one line on what it catches and what it misses. Testing effort then lands on critical paths and real logic instead of every edge of every private function.

If the shape of the interface is itself in question, settle that first: a module that is hard to test is hard to use.

The loop: red, green, refactor

Work in vertical slices: one test, one minimal implementation, then the next test. Do not write all tests first and then all code. Bulk tests verify imagined behaviour and commit you to a structure before you understand the implementation. Each test is a tracer bullet that responds to what the last cycle taught you.

RED: write one failing test

One behaviour, a clear name that states the behaviour, real code rather than mocks wherever possible.

// Good: clear name, exercises real code, one behaviour
test('retries a failing operation up to 3 times', async () => {
  let attempts = 0;
  const operation = () => {
    attempts++;
    if (attempts < 3) throw new Error('fail');
    return 'success';
  };
  const result = await retryOperation(operation);
  expect(result).toBe('success');
  expect(attempts).toBe(3);
});

// Bad: vague name, asserts on the mock instead of the code
test('retry works', async () => {
  const mock = jest.fn().mockRejectedValueOnce(new Error()).mockRejectedValueOnce(new Error()).mockResolvedValueOnce('ok');
  await retryOperation(mock);
  expect(mock).toHaveBeenCalledTimes(3);
});

Read the full file on GitHub · 186 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 26d ago First seen · 186 lines · 52 tokens per session scan A a609b9762165

Subscribe to this mod's changes

tdd is a skill published in the GitHub repository hon454/grimoire (0 stars, last pushed 25d ago), licensed MIT. It adds 52 tokens to every session and 2,041 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-21.

Related

tdd compared with skills from other repositories

tdd next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
tddhon454/grimoireSkill025d agoMITA52Claude Code, Codex
engram-testing-coverageGentleman-Programming/engramSkill8.2k2d agoMITA25Claude Code, Codex
principle-test-behavior-not-implementationmichael-denyer/pstack-claudeSkill4.4k2d agoMITA50Claude Code
nw-ddd-eventsourcingnWave-ai/nWaveSkill635yesterdayMITA38Claude Code
nw-fp-clojurenWave-ai/nWaveSkill635yesterdayMITA25Claude Code
nw-leanux-methodologynWave-ai/nWaveSkill635yesterdayMITA37Claude Code
tddcodewithmukesh/dotnet-claude-kitSkill83611d agoMITA81Claude Code