tdd

tdd is a skill for Claude Code, Codex from oprogramadorreal/optimus-claude. It costs 90 tokens per session (3,510 once invoked), scanned A, original, MIT.

A guide to test-driven development, a way of building software by writing a test before the code that should pass it.

In plain words
What is it for?
Use it to plan and run failing-test, implementation, and cleanup cycles for new features or fixes, with optional branches, commits, and pushes.
Why use it?
It turns a feature or bug fix into clearly testable behaviours and helps prevent unverified changes.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the optimus plugin — 19 skills, 15 agents, 3 hooks 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/oprogramadorreal/optimus-claude/tdd
Any agent
npx skills add oprogramadorreal/optimus-claude --skill tdd
Clone the repo
git clone --depth 1 https://github.com/oprogramadorreal/optimus-claude

Made for: Claude Code, Codex.

Or install optimus, the plugin that ships this one along with the rest of its 19 skills, 15 agents, 3 hooks.

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/oprogramadorreal/optimus-claude/tdd.svg)](https://agentmods.dev/skills/oprogramadorreal/optimus-claude/tdd)
Your own site
<a href="https://agentmods.dev/skills/oprogramadorreal/optimus-claude/tdd"><img src="https://agentmods.dev/badge/skills/oprogramadorreal/optimus-claude/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,510 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.00090 $0.03510
Opus 5 $0.00045 $0.01755
Sonnet 5 $0.00018 $0.00702
Haiku 4.5 $0.00009 $0.00351

Measured 5d ago against content hash 865f7e47f322, 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 5d 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 · 185 lines

How it starts

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

Test-Driven Development

Implement a feature or bug fix test-first: for each behavior, write a failing test (Red), write the minimum code to pass it (Green), then clean up while tests stay green (Refactor). This skill builds new behavior — for restructuring without behavior change, use /optimus:refactor.

The Iron Law: no production code without a failing test first. If implementation code is written before its test, delete it entirely and begin the cycle fresh — do not keep it as reference, do not adapt it; write the implementation from scratch once the failing test exists.

Coming from plan mode? TDD runs in normal mode in a fresh conversation; plan-mode iterations that feed it are review-only — see $CLAUDE_PLUGIN_ROOT/skills/brainstorm/references/plan-mode-handoff.md.

Step 1: Pre-flight

If the current directory has no .git/ directory, read $CLAUDE_PLUGIN_ROOT/skills/init/references/multi-repo-detection.md and apply it; if a multi-repo workspace is detected, work inside the repo the user is targeting — ask which one if ambiguous.

If .claude/CLAUDE.md or .claude/docs/coding-guidelines.md is missing, recommend /optimus:init first; on the user's choice, continue with general best practices. Load:

  • .claude/CLAUDE.md — project overview, tech stack, test runner command
  • .claude/docs/coding-guidelines.md — applied during Refactor
  • testing.md — test conventions: framework, file location, naming, mocking patterns. In a monorepo, load the target subproject's own docs/testing.md / docs/ files; shared guidelines come from root .claude/docs/
  • docs/product/tech-stack.md and docs/product/mvp-prd.md, only if present — low-priority steering that informs decomposition and Refactor but never overrides the task source (precedence: $CLAUDE_PLUGIN_ROOT/references/sdd-mapping.md)

Verify test infrastructure

Locate the test runner command (from testing.md, CLAUDE.md, or project manifests) and run it once:

  • Tests pass — proceed
  • Tests fail — stop and report; a failing baseline makes Red/Green indistinguishable
  • No runner found — stop and recommend /optimus:init to set up test infrastructure (its Scaffold option covers projects with no code yet)

Read the full file on GitHub · 185 lines

Files

What ships with it

3 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. 5d ago First seen · 185 lines · 90 tokens per session scan A 865f7e47f322

Subscribe to this mod's changes

tdd is a skill published in the GitHub repository oprogramadorreal/optimus-claude (73 stars, last pushed today), licensed MIT. It adds 90 tokens to every session and 3,510 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

testing-principles

Language-agnostic testing principles including TDD, test quality, coverage standards, and test design patterns. Use when writing tests, designing test strategies, or reviewing test quality.

shinpr/claude-code-workflows · 40 tokens

auto-loop

TDD-based autonomous development loop with checkpoint recovery and observability changelog.

claude-world/director-mode-lite · 17 tokens

workflow

Run the complete 5-step development workflow: focus problem → prevent over-development → test-first (TDD) → document → smart commit. Use when starting a new feature, or when the user runs /workflow or asks for the full development flow.

claude-world/director-mode-lite · 52 tokens

atdd-team

Use to orchestrate a team-based ATDD workflow — six phases (spec writing, spec review, pipeline generation, implementation, refine, verify & harden) each handled by a fresh agent so no role erodes across a long-running feature. Triggers — "build a feature with a team", "use ATDD with agents", "create an ATDD team"…

swingerman/engineer · 114 tokens

plan-create

Create structured implementation plans for autonomous TDD development. Use for new features, multi-file changes, or anything requiring multiple steps or tests. Triggers on aspirational openers ("let's build", "let's start building", "I want to make", "I want an app that", "help me build"), capability lists ("users…

markshust/hcf · 171 tokens

test-first

Drive one feature through a strict TDD Red-Green-Refactor cycle with checklists for each phase. Use when implementing new functionality test-first, or when the user runs /test-first.

claude-world/director-mode-lite · 42 tokens