/ceh-testing:review-test-suitefrom ceh-testing
Load this skill to find out whether a passing suite would catch a defect: assertion quality, mutation testing, flaky tests, tests that mirror the code. Trigger on "are these tests any good", "mutation testing", "flaky test", "tests pass but the bug shipped", or after generating tests.
Ships in ceh-testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Green means the tests ran, not that they check anything. A suite generated in bulk — by a person in a hurry or by a model — reliably contains tests that pass on broken code. This skill finds them.
The task is done when checks 1 and 2 have run, every later check has run or is named as unrun with its command, and each finding in the report quotes the code it is about.
Run the checks in order: each is cheaper than the one after it, and the cheap ones find most of it. Where a check names a fix, that is the right fix, applied only to the findings the user chooses, as Fixing findings says.
Checks 1 and 2 are fast and scoped, so they apply without being asked. The rest are slow runs and wait for a request: the mutation run (check 3), the repeated and parallel passes (check 4), the durations run (check 5), and the coverage run (check 6). When one of those would help and was not requested, name the command and what it would reveal, and state what stays unverified.
Grep the suite for the four shapes that pass on almost any bug:
Tests with no assertion at all (Python — exact, via the AST rather than a regex):
python - <<'PY'
import ast, pathlib
def checks(fn):
for n in ast.walk(fn):
if isinstance(n, ast.Assert):
return True
if isinstance(n, ast.Call):
f = n.func
name = f.attr if isinstance(f, ast.Attribute) else getattr(f, "id", "")
if name.startswith(("assert", "expect")) or name in ("raises", "warns"):
return True
return False
for p in pathlib.Path("tests").rglob("test_*.py"):
for n in ast.walk(ast.parse(p.read_text(encoding="utf-8"))):
if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef)) and n.name.startswith("test_"):
if not checks(n):
print(f"{p}:{n.lineno} {n.name}")
PY
Match on the node shape, not on ast.dump() text — a dump contains the function's own name, so a
test called test_assertion_shape looks like it asserts when it does not.
Assertions that are true for almost any value:
rg -tpy 'assert .* is not None$|assert .*len\(.*\) *>=? *0|assert True'
rg -tts -tjs 'toBeDefined\(\)|toBeTruthy\(\)|not\.toBeNull\(\)|toHaveBeenCalled\(\)$'
| Shape | Why it is worthless | Fix |
|---|---|---|
No assert in the test body | Only checks that nothing raised | Assert the value |
assert x is not None / toBeDefined() alone | True for every wrong value too | Assert the actual value |
toHaveBeenCalled() alone | Passes on wrong arguments | Assert the arguments |
assert len(result) > 0 | Passes on wrong contents | Assert the contents |
| Test asserts a value it computed with the code's own logic | Agrees with the code however wrong | Hard-code the literal expected value |
That last one is the signature defect of generated tests, and grep will not find it — read the assertions in any file you did not write by hand.
For each suspect test, try to write its value line: protects: <behavior>; fails_when: <the defect it catches>; why_new: <what no other test covers>. A test with no nameable fails_when is
worthless, and one whose why_new names another test is a duplicate. List both as deletion
candidates in the report.
Pick the three most important behaviors. For each, break the source deliberately — invert a comparison, return a constant, delete a line — and re-run.
A test suite that stays green while the code is broken has told you exactly what it is worth.
Do this by hand before reaching for mutation tooling; it takes two minutes and usually finds something.
The automated form of check 2: mutate the source, re-run the tests, report which mutations survived. A surviving mutant is a change to production code that no test noticed.
# Python — changed files only
mutmut run --paths-to-mutate "$(git diff --name-only main...HEAD -- '*.py' | tr '\n' ',')"
mutmut results
# TypeScript
bunx stryker run --mutate "$(git diff --name-only main...HEAD -- '*.ts' | tr '\n' ',')"
Always scope it to the diff. Whole-repo mutation runs take hours and produce a report nobody reads; that is why mutation testing gets adopted and abandoned. Diff-scoped, it finishes in minutes and every finding is about code you just wrote.
Reading the output: fix surviving mutants in code you care about, and ignore survivors in logging,
__repr__, and defensive branches that cannot be reached. The number is not a target — the list of
survivors is the deliverable.
If the tool is not installed, do not install it unprompted: report the one-line command
(uv add --dev mutmut, bun add -d @stryker-mutator/core) and continue with the other checks.
Installing edits the lockfile, which a review has no mandate to change.
Cap the run, for example timeout 900 mutmut run .... Run it after checks 1 and 2 so a timeout
still leaves the cheap findings intact, and if it does not finish, report partial results and say
the run was truncated.
For a large or slow suite, delegate the whole review to a background subagent with this skill loaded and tell it to use report-only mode (below) — the run is long and high-output, which is exactly what a background subagent is for.
pytest -p randomly --count=3 # random order + seed, three passes
pytest -n auto # parallel — shared state surfaces here
pytest tests/unit/test_one.py # each file alone
vitest run --sequence.shuffle
Any test that passes alone and fails in a suite (or vice versa) is sharing state: module-level
globals, a database row nobody rolled back, a patched clock, a cached singleton, Date.now(),
an unseeded RNG. Fix the sharing — never fix it by pinning the order or adding a sleep.
When the victim is known but the polluter is not, bisect for it. Run the victim after the first
half of the tests that precede it, then after whichever half reproduces the failure, until one
test is left. For a test that leaves stray files or rows rather than a failure, run each test
alone and check what exists afterwards (git status --porcelain, a row count) instead.
pytest tests/a.py tests/b.py tests/victim.py::test_x -p no:randomly # fails? polluter is in a or b
A flaky test is worse than no test: it trains everyone to re-run until green, which is how a real failure gets ignored.
pytest --durations=10
vitest run --reporter=verbose # prints each test's duration
A "unit" test taking hundreds of milliseconds is doing I/O — it is an integration test in the wrong directory, and it is slowing the loop that is supposed to be fast. Either mock the boundary or move the file.
Also check the shape of the pyramid: if E2E tests outnumber unit tests, failures will be slow and will not localize.
pytest --cov=app --cov-branch --cov-report=term-missing # branch, not line
vitest run --coverage # v8/istanbul report branches by default
Always pass --cov-branch. The default is line coverage, which counts an if with no else as
fully covered when only the true side ever ran — so the report is green exactly where the untested
half lives. Branch coverage is the cheapest upgrade available in this list.
Use it to find files and branches at zero, which are genuine blind spots. Do not use it as a score to raise: coverage rises fastest by executing code without asserting on it, so a chased target actively rewards worthless tests. Mutation survivors (check 3) are the metric with teeth.
Stronger structural criteria exist — condition coverage, MC/DC, def-use path coverage — and they are not worth reaching for here: they cost far more to satisfy than diff-scoped mutation testing and find less. Use them only under an external mandate (DO-178C, IEC 61508 and similar).
== 42 to is not None converts a real
failure into a permanent blind spot.xfail / .skip) without an issue reference and a
reason. Unexplained skips accumulate until nobody knows what the suite covers.List the findings blocking first, then question, then advisory, each with file and line, then ask
which to fix, as Fixing findings says. Label each by the conditions in the "Labels and severities"
bullet of references/test-review-schema.md: a test that passes on broken code, or a flaky test,
is blocking. End with a verdict: Done when the round raised no blocking finding, Not yet
when it raised one, Cannot judge when the suite could not be run or read. Quote or suppress:
every finding quotes the code it is about, as path:line plus the line itself. A finding you
cannot anchor to quoted code goes below the list as unverified, never in it.
blocking tests/unit/test_billing.py:41 no assertion — only checks no exception raised
blocking tests/unit/test_pricing.py:88 expectation computed with the code's own formula
blocking src/discount.py 3 surviving mutants (boundary `>=` → `>` unnoticed)
blocking tests/integration/test_orders.py fails under --random-order (shared session fixture)
advisory tests/unit/test_parse.py:12 1.4s in tests/unit — real filesystem I/O
Save the review to .agents_workspace/product/review/test/<YYYYMMDD-HHMMSS>-<target>.yaml, with
<target> the suite's folder named as a path, filling assets/test-review.template.yaml per the
test-review/v1 section of references/test-review-schema.md, and name the path in the reply.
Follow the schema's Review lifecycle: a later review of the same suite finds its file and adds a
round, re-checking each open finding first. Take <YYYYMMDD-HHMMSS> from one
date +%Y%m%d-%H%M%S call when the file is first saved. An older report in
.agents_workspace/product/audit/test/ is read, never edited. After the last edit, run
uv run --script ${CLAUDE_SKILL_DIR}/scripts/artifact.py render <file>.yaml, which writes the
.md beside it in the layout of assets/test-review.template.md, and fix the YAML for each error
it lists. Before editing a saved review, run it with check and stop on exit 1 with its errors.
Never edit the generated .md. On exit 2 or 3, or without uv, say in the reply that the review
went unchecked and unrendered.
Use it when the review is delegated to a subagent. A subagent cannot ask the parent anything, so
the report has to stand alone. It returns one round and its findings as test-review/v1 YAML,
never saved. Before the caller merges them into the review file, it reads the quoted line of every
finding it saves and drops one whose line does not say what it claims, recording it in the round's
unverified with the reason.
End by asking the user which findings to fix, once, after the report. Fix only the chosen ones,
directly, with no fix record or plan, because the work has not landed. A request that itself asks
for the change, such as "improve the error messages", counts as the yes for the findings it names.
Commit each fix on the current branch when it is a feature branch that fits the fix, otherwise on a
new fix branch, never on the default branch. Push nothing and open no pull request unless the user
asks, because landing is the user's call. Outside a git repository, make the edits and commit
nothing. For a subject inside .agents_workspace/, make no branch and leave the commit to the
workspace's own sync. With no user present, fix nothing and report the findings.
This skill fixes the blocking findings first, and records each fix in the review's fixed and
the finding's status.
What SKILL.md sets; muted values are Claude Code's defaults
9 skills in this plugin
/close-test-risk-gapsLoad this skill when a feature works and is about to be called done: triage what a passing suite misses (concurrency, contract drift, performance, authorization, migrations). Trigger on "is this ready", "before I open the PR", "race condition"./design-test-casesLoad this skill when deciding which inputs and scenarios a test should cover, not how to wire the runner: partitions, boundaries, state transitions, properties, fuzzing, failing dependencies. Trigger on "what should I test", "cover the edge cases", or a test file with only a happy path./explore-app-for-bugsOther plugins' skills for the same job
npx claudepluginhub cheneeheng/ceh-claude-code-library --plugin ceh-testing