tdd

tdd is a skill for Claude Code from genai-io/san. It costs 73 tokens per session (634 once invoked), scanned A, original, Apache-2.0.

A test-first development method called TDD: write a test that describes the intended behavior, see it fail, add the smallest code change that makes it pass, then improve the code.

In plain words
What is it for?
Use it for new features, bug fixes, and behavior changes, including success cases, edge cases, and expected errors.
Why use it?
It exposes missing behavior and bugs early, while giving each change a clear check for completion.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

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/genai-io/san/tdd
Any agent
npx skills add genai-io/san --skill tdd
Clone the repo
git clone --depth 1 https://github.com/genai-io/san

Made for: Claude Code.

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/genai-io/san/tdd.svg)](https://agentmods.dev/skills/genai-io/san/tdd)
Your own site
<a href="https://agentmods.dev/skills/genai-io/san/tdd"><img src="https://agentmods.dev/badge/skills/genai-io/san/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 634 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.1 $0.00073 $0.00634
Opus 5 $0.00036 $0.00317
Sonnet 5 $0.00015 $0.00127
Haiku 4.5 $0.00007 $0.00063

Measured 6d ago against content hash 949f986e0619, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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.

.san/personas/software-engineer/skills/tdd/SKILL.md · 69 lines

How it starts

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

TDD: red, green, refactor

Write the test before the code. A test written first specifies the behavior, fails for a known reason, and gives you a definition of done you can run. A test written after tends to describe whatever the code happens to do — bugs included.

Step 1: Find the test runner

Don't assume the command. Detect how this project runs and writes tests: look at existing test files for the framework and conventions, and at the build/config for the invocation (go test ./..., npm test, pytest, cargo test, …). Match what's already there — same framework, same layout, same style.

Step 2: Name the behavior as tests (RED)

State the change as concrete cases before writing any implementation:

  • The main success path — the behavior actually requested.
  • The edges — empty, zero, boundary, maximum, unexpected input.
  • The failures — what should error, and how it should error.

Write these as tests. For a bug fix, the first test reproduces the bug. Keep each test focused on one behavior with a clear name.

Step 3: Watch them fail

Run the tests and confirm they fail — and fail for the right reason (the behavior is missing), not a typo or an import error. A test you never saw fail proves nothing. This is the gate: do not write implementation until you've seen red.

Step 4: Implement to green

Write the minimum code that makes the tests pass. No features the tests don't demand, no speculative abstraction. Run the tests until they're green.

Step 5: Refactor on green

Now improve the shape — naming, duplication, structure — with the tests staying green the whole way. The tests let you clean up without fear; if one goes red, the last change altered behavior, so undo it.

Test what callers see, not how it's built

  • Assert on observable behavior and return values, not private internals — tests bound to implementation break on every refactor and defeat Step 5.
  • Keep tests isolated: no shared mutable state, no ordering dependency, each runs alone. Prefer real behavior; mock only what you can't run (network, clock, external services).
  • Cover the edges and error paths, not just the happy case — that's where the bugs the persona is trying to prevent actually live.

Read the full file on GitHub · 69 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. 6d ago First seen · 69 lines · 73 tokens per session scan A 949f986e0619

Subscribe to this mod's changes

tdd is a skill published in the GitHub repository genai-io/san (76 stars, last pushed yesterday), licensed Apache-2.0. It adds 73 tokens to every session and 634 once invoked, about $0.0004 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

tdd

Test-driven development — write the failing test first, then the code. Triggers on TDD, test first, write tests, test-driven.

AyushParkara/syntra · 32 tokens

sesion

Ejecuta la sesión de implementación que marca el puntero ▶ de docs/plan/estado.md con el ciclo BDD→TDD→juicio→DoD, y cierra moviendo puntero y worklog en el mismo commit. Úsala cuando la tarea sea construir (no diseñar) y exista una sesión abierta en el plan; si la feature no está en el plan, antes va…

dbareagimeno/enu · 92 tokens

agent-builder

Design and build AI agents for any domain. Use when users: (1) ask to "create an agent", "build an assistant", or "design an AI system" (2) want to understand agent architecture, agentic patterns, or autonomous AI (3) need help with capabilities, subagents, planning, or skill mechanisms (4) ask about Claude Code…

wulawulu/learn-claude-code-rs · 125 tokens

code-review

Perform thorough code reviews with security, performance, and maintainability analysis. Use when user asks to review code, check for bugs, or audit a codebase.

wulawulu/learn-claude-code-rs · 35 tokens

mcp-builder

Build MCP (Model Context Protocol) servers that give Claude new capabilities. Use when user wants to create an MCP server, add tools to Claude, or integrate external services.

wulawulu/learn-claude-code-rs · 38 tokens

pdf

Process PDF files - extract text, create PDFs, merge documents. Use when user asks to read PDF, create PDF, or work with PDF files.

wulawulu/learn-claude-code-rs · 32 tokens