ccppccpp home
Browse the documentation

Plugins · CCPP Tester

CCPP Tester

ccpp-tester is the only agent allowed to write tests. CPO refuses test writes to every other agent, so Claude never tests its own code.

When Claude writes code and its tests together, the tests share the code's assumptions. When a test goes red, Claude tends to change the test: it flips the expectation to what the code returned, swaps the failing input, narrows the assertion, raises the timeout, or skips it. The suite turns green and the defect stays.

ccpp-tester removes that option. It is a Claude Code agent shipped in the cpo plugin, and CPO rules make it the only agent that can create, change or delete a test-side file (tests, helpers, fixtures, snapshots). The main agent asks it for tests; it writes them without reading the code under test, as an adversary whose job is to catch the code doing something other than what the user asked.

ccpp-tester is plain software: an agent prompt, a skill and CPO policies. It runs on your own Claude Code session. CCPP calls no model.

ccpp-tester is in alpha (0.2). Its rules recognize TypeScript and JavaScript test files (bun test, Vitest, Jest), and its mutation testing covers them only.

How it works

  1. CPO blocks. The main agent writes src/quote.test.ts. CPO undoes the write and tells it to launch cpo:ccpp-tester with what the code must do.
  2. ccpp-tester reads what the user asked. It extracts the steps of the parent session's transcript (the user's words, what the agent did and said, never its reasoning) and treats the main agent's task message as a claim to check, not as the specification.
  3. It writes the tests blind. It reads the repository for conventions (existing tests, runner config, docs, types) but CPO refuses it the source files other agents wrote this session. Every expected value has a source: a user message, a document, a spec.
  4. It runs them. A red test is a finding about the code and stays red.
  5. It attacks its own tests with mutation testing (StrykerJS for TypeScript): every mutant that survives is a wrong implementation the suite accepts.
  6. It reports to the main agent: the tests, the source of each expectation, the red tests, the mutation score. The main agent fixes the code, not the test.

Quick start

  1. Install the cpo plugin (CPO quick start). The agent and its skill come with it.

  2. Add the enforcement policies to the project's .claude/policies/. They are not a published profile yet: copy the tests-by-ccpp-tester* and ccpp-tester-* policies from the CCPP repository. Without them the agent works, but nothing stops the main agent from writing its own tests.

  3. Ask for a behavior, not for a test:

    Add a 10% discount from 100 units in quote(). Have ccpp-tester cover it.

    Claude launches cpo:ccpp-tester. When it writes a test itself, CPO refuses and points it there.

Reference

Page
EnforcementThe CPO policies: who may write tests, what the tester may read.
Writing testsSources, dictation, mutation testing.
Reports and contestsThe report format, and what happens when a test is disputed.

Edit this page on GitHub