tdd

tdd is a skill for Claude Code, Codex from aethrox/doctrine. It costs 93 tokens per session (1,560 once invoked), scanned A, original, MIT.

A test-first development discipline built around the red-green-refactor cycle: write a failing test, make it pass with the smallest change, then improve the code. TDD means test-driven development.

In plain words
What is it for?
Use it when adding features or fixing bugs to guide interface design, choose suitable unit, integration, or end-to-end tests, and assess test doubles and test quality.
Why use it?
It makes the intended behavior explicit before implementation and helps avoid building unneeded behavior or changing existing behavior accidentally.

Skill for Claude CodeCodex

Part of the doctrine plugin — 33 skills shipped together

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.

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

Made for: Claude Code, Codex.

Or install doctrine, the plugin that ships this one along with the rest of its 33 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/aethrox/doctrine/tdd.svg)](https://agentmods.dev/skills/aethrox/doctrine/tdd)
Your own site
<a href="https://agentmods.dev/skills/aethrox/doctrine/tdd"><img src="https://agentmods.dev/badge/skills/aethrox/doctrine/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 93 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,560 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00093 $0.01560
Opus 5 $0.00046 $0.00780
Sonnet 5 $0.00019 $0.00312
Haiku 4.5 $0.00009 $0.00156

Measured 4d ago against content hash feccd1f27f7e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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.

skills/tdd/SKILL.md · 65 lines

How it starts

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

Test-Driven Development

TDD is a design discipline, not a testing habit. Kent Beck's rule is absolute: no production code is written except to make a failing test pass, and no more of it than the test requires. The test comes first because it forces the interface to be designed from the caller's side before an implementation exists to bias the design.

Phase 1: The cycle

One cycle, repeated, never skipped:

  1. Red. Write the smallest test that expresses one new piece of behaviour, for code that does not yet support it. Run it. Confirm it fails, and fails for the reason you expect; a test that fails on a typo or a missing import isn't red for the right reason.
  2. Green. Write the minimum production code that makes the test pass. Resist the urge to generalize or handle a case the test didn't ask for; a case not yet demanded by a test is a case not yet designed, and designing it now is a guess.
  3. Refactor. With the suite green, improve the internal structure, naming, and duplication; behaviour does not change, only shape. Run the suite after every small edit; if it goes red, the refactor introduced a real change, not just a cleanup, and needs to be undone or reconsidered.

Each cycle is a vertical slice: one behaviour, one test, one minimal implementation, then the next cycle picks the next behaviour. Writing a batch of tests up front for behaviour that doesn't exist yet is not TDD; it's testing an imagined shape, and the tests go insensitive to what implementation actually teaches you as you build.

Phase 2: What makes a test worth keeping (FIRST)

  • Fast. A slow suite gets run less often, which defeats the purpose of a tight feedback loop: milliseconds, not seconds, for the unit layer.
  • Isolated / Independent. Any test can run alone or in any order, with no shared mutable state leaking from another test. A test that only passes after a specific other test ran first is not a test, it's a trap.
  • Repeatable. Same result every run, in any environment: no dependence on wall-clock time, network availability, or random seed unless pinned.
  • Self-validating. Pass or fail, with no human reading output to decide: an assertion, not a console.log someone has to eyeball.
  • Timely. Written just before the code that makes it pass, not after. A test written after the implementation tends to assert what the code happens to do, not what it should do.

Read the full file on GitHub · 65 lines

Files

What ships with it

1 file 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. 4d ago First seen · 65 lines · 93 tokens per session scan A feccd1f27f7e

Subscribe to this mod's changes

tdd is a skill published in the GitHub repository aethrox/doctrine (18 stars, last pushed 23d ago), licensed MIT. It adds 93 tokens to every session and 1,560 once invoked, about $0.0005 per session on Opus 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-08-30.

Related

Other skills, from other repositories

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code.

obra/superpowers · 17 tokens

bug-fix-tdd

Reproduce and fix bugs using TDD. Use when analyzing a bug report, writing a regression test, or applying a minimal fix. Covers test placement, mock patterns, and the red-green-refactor workflow for automated bug fixing.

stacklok/toolhive-studio · 52 tokens

absolute-work

End-to-end, phase-gated SDLC for AI coding agents: relentless design interview → reviewed spec → dependency-graphed task board → safe-wave TDD execution → verification → converge. Handles features, bugs, refactors, greenfield projects, planning breakdowns, and migrations. Triggers on "absolute work", "build this…

maddhruv/absolute · 104 tokens

tdd

Use test-driven development for behavior-changing feature or fix work, and whenever the user mentions TDD, test-first, red-green-refactor, tracer bullets, integration tests, or public-interface behavior tests. Skip for docs-only, path-only rename, formatting-only, or purely mechanical chores unless explicitly…

youdotcom-oss/agent-skills · 63 tokens

dev-pipeline

Full feature-development pipeline for this repo — isolated worktree, spec, implementation plan, TDD build, quality gates, then a review→fix loop that only stops when review passes. Each stage delegates to a named project subagent (spec-researcher, pattern-scout, pipeline-implementer, pipeline-simplifier…

devemberx/mcp-server-polarion · 161 tokens

sumo-qa-implementing-with-tdd

Use after sumo-qa-deciding-approach picks tdd-scaffold, regression-first, or coverage-first-then-refactor — e.g. "write a regression test for this bug" or "scaffold the failing tests first". Walks plan → name-the-risk-and-test-idea → confirm → red → hand off → green → review, one section per turn with confirmation…

sumithr/sumo-qa · 103 tokens