test-driven-development

test-driven-development is a skill for Claude Code, Codex from fmind/dot. It costs 42 tokens per session (949 once invoked), scanned A, original, MIT.

A testing method for making a change by first writing a test that exposes the missing behavior, then implementing the change and cleaning up the code.

In plain words
What is it for?
Use it for isolated bug fixes, behavior changes, and refactors that need proof they still work.
Why use it?
It shows that the test detects the actual bug and helps prevent the same problem from returning during later refactoring.

Skill for Claude CodeCodex

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/fmind/dot/test-driven-development
Any agent
npx skills add fmind/dot --skill test-driven-development
Clone the repo
git clone --depth 1 https://github.com/fmind/dot

Made for: Claude Code, Codex.

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 test-driven-development

README.md
[![agentmods](https://agentmods.dev/badge/skills/fmind/dot/test-driven-development.svg)](https://agentmods.dev/skills/fmind/dot/test-driven-development)
Your own site
<a href="https://agentmods.dev/skills/fmind/dot/test-driven-development"><img src="https://agentmods.dev/badge/skills/fmind/dot/test-driven-development.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 949 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.00042 $0.00949
Opus 5 $0.00021 $0.00475
Sonnet 5 $0.00008 $0.00190
Haiku 4.5 $0.00004 $0.00095

Measured yesterday against content hash ac6738930b98, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-driven-development 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 yesterday.

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/test-driven-development/SKILL.md · 42 lines

How it starts

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

Test-Driven Development

Prove a change with an honest red-green-refactor cycle: a failing test that detects the missing or broken behavior, then the smallest trustworthy change; quality-assurance owns the broader campaign and systematic-debugging owns failures not yet understood.

Workflow

  1. Discover the harness: Read repository instructions, existing tests, task definitions, and nearby patterns; find the smallest command that exercises the target behavior.
  2. State the contract: Name the production change that would make the test pass and a plausible regression that would make it fail.
  3. RED: Write one minimal test for one observable behavior; run it and confirm it fails for the missing behavior, not for a syntax, fixture, environment, or setup error.
  4. GREEN: Implement only enough production code to satisfy that test; run the focused test and read the full output.
  5. Protect the neighborhood: Run the package or subsystem tests; fix production code when the new behavior breaks a valid existing contract and revisit the spec when contracts conflict.
  6. REFACTOR: Improve names, structure, duplication, and types only while everything stays green; add no behavior.
  7. Repeat: Take the next smallest behavior, edge case, or failure path through a new red cycle.
  8. Prove the regression test: For a bug fix, temporarily reverse the fix when safe, confirm the test fails, then restore it and confirm green.
  9. Gate the candidate: Run the full gate (mise run all); if the tree carries unrelated changes and the gate write-formats, run it in a temporary git worktree or fall back to mise run check and mise run test (see mise).
  10. Report evidence: Give the red command and expected failure, the focused green command, the wider suite, the full gate, and any boundary still covered only manually or not at all.

Gotchas

  • Never weaken an existing test: do not loosen a type, add a skip, or mock away the defect to manufacture green.
  • Implementation came first: Never delete or overwrite user work because it preceded the test; preserve it, add a red-capable test, and disclose the sequence.
  • Test-first does not fit: For a spike, generated code, or configuration-only change, say why and define another failing validation signal; do not call tests written afterward TDD.
  • Test level: Fast unit or contract tests first; integration, property, concurrency, or browser tests only where the boundary demands them; characterize legacy behavior before changing it.
  • Real collaborators: Prefer real parsers, databases, filesystems, and HTTP handlers at lightweight boundaries over mocks of the unit under test; fake only paid, destructive, slow, or unreliable systems behind a narrow owned interface.
  • Readable failures: Keep fixtures readable and assertions on outcomes; a little duplicated setup beats hidden intent, and a failure should explain the broken contract without a debugger.

Read the full file on GitHub · 42 lines

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. yesterday First seen · 42 lines · 42 tokens per session scan A ac6738930b98

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository fmind/dot (4 stars, last pushed today), licensed MIT. It adds 42 tokens to every session and 949 once invoked, about $0.0002 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-09-03.