test-writer

test-writer is an agent for Claude Code from MadeByTokens/bon-cop-bad-cop. It costs 20 tokens per session (2,848 once invoked), scanned A, a copy of test-writer, MIT.

An agent that writes tests from a requirement before seeing the implementation. Its tests are designed to check the required behavior thoroughly and resist implementations that only appear to work.

In plain words
What is it for?
Use it in the Bon Cop Bad Cop TDD loop to read a requirement and create test files, status, state updates, and progress logs.
Why use it?
It separates the requirements from the code writer, making it harder for the implementation to pass by copying assumptions or comments instead of meeting the behavior.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

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

Good fit Use it in the Bon Cop Bad Cop TDD loop to read a requirement and create test files, status, state updates, and progress logs.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/madebytokens/bon-cop-bad-cop/test-writer
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/bon-cop-bad-cop

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 test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/madebytokens/bon-cop-bad-cop/test-writer/github.svg)](https://agentmods.dev/agents/madebytokens/bon-cop-bad-cop/test-writer)
Your own site
<a href="https://agentmods.dev/agents/madebytokens/bon-cop-bad-cop/test-writer"><img src="https://agentmods.dev/badge/agents/madebytokens/bon-cop-bad-cop/test-writer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-writer

Your own site · 80×15
<a href="https://agentmods.dev/agents/madebytokens/bon-cop-bad-cop/test-writer"><img src="https://agentmods.dev/badge/agents/madebytokens/bon-cop-bad-cop/test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,848 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 100% copy Near-identical to another mod 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.00020 $0.02848
Opus 5 $0.00010 $0.01424
Sonnet 5 $0.00004 $0.00570
Haiku 4.5 $0.00002 $0.00285

Measured 9d ago against content hash 736b4bafdd5c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

test-writer 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 9d 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

This is a copy

100% identical to test-writer — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

agents/test-writer.md · 357 lines

How it starts

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

Test Writer Agent (The Bad Cop) 🚨

You are the Bad Cop in the Bon Cop Bad Cop system. Your role is to write comprehensive, hard-to-cheat tests.

File-Based I/O (CRITICAL)

You MUST read your inputs from files, not from the prompt.

Reading Inputs

  1. Read the requirement from .tdd-working/inputs/requirement.md

    • This is the ORIGINAL REQUIREMENT - your PRIMARY focus
    • This file NEVER changes
  2. Read state/config from .tdd-working/state.json

    • Get: iteration, maxIterations, language, testFramework, testScope
    • Get: history array for context on previous iterations
  3. Read feedback (if iteration > 1) from .tdd-working/reviewer/feedback.md

    • Only if this file exists
    • Contains feedback from the Reviewer about your tests

Writing Outputs

  1. Write test files to project root (e.g., test_parse_duration.py)
  2. Write status to .tdd-working/test-writer/status.md:
    • Write "DONE" if successful
    • Write "BLOCKED: " if you cannot proceed
  3. Update state in .tdd-working/state.json:
    • Set testFilePaths to array of test files created
    • Set phase to "WRITING_CODE"
  4. Append to log .tdd-loop.log with your progress

GROUNDING: Original Requirement is PRIMARY

Every iteration, your PRIMARY goal is testing the ORIGINAL REQUIREMENT.

┌─────────────────────────────────────────────────────────────┐
│                    PRIORITY ORDER                           │
├─────────────────────────────────────────────────────────────┤
│  1. ORIGINAL REQUIREMENT (in your prompt)      ← PRIMARY    │
│     - This NEVER changes                                    │
│     - ALL tests must trace back to this                     │
│                                                             │
│  2. Feedback & mutation survivors              ← SECONDARY  │
│     - Improvements to HOW you test the requirement          │
│     - Must NOT cause drift from original requirement        │
└─────────────────────────────────────────────────────────────┘

Read the full file on GitHub · 357 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. 9d ago First seen · 357 lines · 20 tokens per session scan A 736b4bafdd5c

Subscribe to this mod's changes

test-writer is an agent published in the GitHub repository MadeByTokens/bon-cop-bad-cop (1 stars, last pushed 8mo ago), licensed MIT. It adds 20 tokens to every session and 2,848 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to test-writer, differing in 0 lines, and is treated as a copy.

Related

Other agents, from other repositories

quality-fixer

Specialized agent for verifying software projects and fixing quality failures within the current task scope. Use proactively after code changes or for quality, test, build, lint, format, correctness, or fix requests.

shinpr/claude-code-workflows · 44 tokens

verification-runner

Run project-aware verification loop. Reads mix.exs to discover tools (credo, dialyzer, sobelow, excheck), test commands, and custom aliases. Use proactively after code changes.

oliver-kriska/claude-elixir-phoenix · 44 tokens

edge-case-explorer

Systematically discovers and catalogs edge cases that should be covered by tests for a given piece of code. Traces input sources, call chains, and integration boundaries to find boundary values, type coercion traps, external input messiness, state-dependent failures, and error propagation gaps. Use when exploring how…

testdouble/han · 135 tokens

verify-app

Verification expert. Proactively runs tests after code changes, analyzes failures, and suggests fixes.

sd0xdev/sd0x-harness · 21 tokens

developer

Use when execute-round's Phase 3 (dev body) needs to implement BA design exactly. Writes source + tests per file decomposition, runs pre-audit quality gates, registers forward-debts, and reports diff summary.

Arch1eSUN/Arcgentic · 47 tokens

codebase-explorer

Explores a codebase to discover implementation details for a specific feature or system. Finds entry points, core logic, data models, configuration, tests, and feature-type-specific artifacts. Use when thorough, multi-angle codebase discovery is needed for documentation or understanding. Does not research options or…

testdouble/han · 75 tokens