tdd-loop

tdd-loop is a command for Claude Code from MadeByTokens/claude-code-plugins-madebytokens. It costs 9 tokens per session (5,339 once invoked), scanned A, original, MIT.

A command that runs test-driven development, or TDD, in repeated rounds with three agents: tests are written, code is added, and the result is challenged.

In plain words
What is it for?
Use it to work from a written requirement, run unit or integration tests, track progress, and measure mutation score—the proportion of changed faulty versions that tests detect.
Why use it?
It creates a recorded process for checking whether code meets a requirement and whether tests catch deliberately introduced faults.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Part of the bon-cop-bad-cop plugin — 4 commands, 3 agents shipped together

Good fit Use it to work from a written requirement, run unit or integration…

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/madebytokens/claude-code-plugins-madebytokens/tdd-loop
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.

Clone the repo
git clone --depth 1 https://github.com/MadeByTokens/claude-code-plugins-madebytokens

Made for: Claude Code.

Or install bon-cop-bad-cop, the plugin that ships this one along with the rest of its 4 commands, 3 agents.

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-loop

README.md
[![agentmods](https://agentmods.dev/badge/commands/madebytokens/claude-code-plugins-madebytokens/tdd-loop.svg)](https://agentmods.dev/commands/madebytokens/claude-code-plugins-madebytokens/tdd-loop)
Your own site
<a href="https://agentmods.dev/commands/madebytokens/claude-code-plugins-madebytokens/tdd-loop"><img src="https://agentmods.dev/badge/commands/madebytokens/claude-code-plugins-madebytokens/tdd-loop.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,339 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.00009 $0.05339
Opus 5 $0.00005 $0.02669
Sonnet 5 $0.00002 $0.01068
Haiku 4.5 $0.00001 $0.00534

Measured 6d ago against content hash 432f6718e841, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

tdd-loop 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • tdd-loop — 100% identical, 0 lines differ
plugins/bon-cop-bad-cop/commands/tdd-loop.md · 556 lines

How it starts

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

/tdd-loop Command

When the user runs /tdd-loop "<requirement>" [options] or /tdd-loop --requirement-file <path> [options], follow these instructions:

Trail Log (REQUIRED) - Primary Record

The .tdd-loop.log file is the AUTHORITATIVE record of all loop activity.

This is critical for context management:

  • Agents write verbose output here, not to their responses
  • Full mutation survivor details go here, not in state file
  • Full feedback text goes here
  • Archived history entries go here when truncated from state
  • The state file and agent responses contain only summaries

Every significant action MUST be logged with timestamp. Use the Write tool to append entries.

Log format:

[YYYY-MM-DD HH:MM:SS] [PHASE] Message

What to log:

Event Log Entry
Plugin version [INIT] Bon Cop Bad Cop v{version}
Loop start [INIT] TDD loop started. Requirement: "<first 100 chars>..."
Language detected [INIT] Language detected: {language} ({testFramework})
State file created [INIT] State file created: .tdd-working/state.json
Phase start [ITER {n}] Starting phase: {WRITING_TESTS|WRITING_CODE|REVIEWING}
Agent invoked [ITER {n}] Invoking {agent} agent...
Agent completed [ITER {n}] {agent} completed. Files: {list}
Agent verbose output [ITER {n}] [{agent}] {detailed analysis, reasoning, progress}
Tests run [ITER {n}] Tests executed: {passed}/{total} passed
Flaky detected [ITER {n}] Flaky tests found: {list}
Cheating detected [ITER {n}] Cheating patterns found: {list}
Mutation score [ITER {n}] Mutation score: {score}% ({killed}/{total} mutants)
Mutation survivors [ITER {n}] Surviving mutants: {full list of survivors}
Verdict issued [ITER {n}] Verdict: {verdict}. Feedback: "{full feedback text}"
Iteration complete [ITER {n}] Iteration complete. Next phase: {phase}
History archived [HISTORY] Archived iteration {n}: verdict={v}, mutationScore={s}, survivors=[...]
Loop complete [COMPLETE] Loop finished: {reason}. Total iterations: {n}
Error [ERROR] {error description}

Read the full file on GitHub · 556 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 · 556 lines · 9 tokens per session scan A 432f6718e841

Subscribe to this mod's changes

tdd-loop is a command published in the GitHub repository MadeByTokens/claude-code-plugins-madebytokens (2 stars, last pushed 7mo ago), licensed MIT. It adds 9 tokens to every session and 5,339 once invoked, about $0.0000 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-31.