Skip to content
Back to skills

Test Audit

ASecurity

This skill should be used when the user runs "/house-rules:test-audit", or asks to "audit the tests", "prune the test suite", "find redundant tests", or "speed up the test suite" for the current repo.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 9, 2026
developmentgotestinggit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 28, 2026

npx -y skills add dubbl-a/house-rules --skill test-audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Test Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dubbl-a-test-audit/badge)](https://www.skillsdirectory.com/skills/dubbl-a-test-audit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: test-audit
description: This skill should be used when the user runs "/house-rules:test-audit", or asks to "audit the tests", "prune the test suite", "find redundant tests", or "speed up the test suite" for the current repo.
disable-model-invocation: true
---

# Test audit

Audits the current repo's tests with the house-rules method (#363): a survey of the suites and the
CI critical path, auditors over batches of test files, one merged candidate list, an Opus refuter
that plants a defect against every removal and merge claim, a builder that applies the confirmed
list as one commit in a worktree, and an Opus review with a bounded rework loop. The method is a
Workflow script, `test-audit.js` beside this file, which the steps below run. The skill writes a
branch and spends a lot of agent time, so it never fires on its own.

The agents apply the testing rules shipped with the plugin
(`${CLAUDE_PLUGIN_ROOT}/modules/testing/rules/testing.md`), not the repo's vendored copy, which
can lag until the next sync.

## Default path

1. Confirm the working directory is a git repo with a GitHub remote and name its default branch
   (`git symbolic-ref --short refs/remotes/origin/HEAD`). Stop if there is no remote: the CI
   survey and the PR step need one. The audit reads the default branch at origin, not the working
   tree.
2. State the agent count and a rough cost before starting. The count is about 12 to 16 (survey,
   up to 4 auditors and their re-reads, merge, up to 4 refuters, builder, reviewer, and 2 agents
   per rework round, at most 2 rounds), fewer for a small suite: auditors number one per about
   1500 test lines, capped at `maxAuditors` and the test-file count. Give a token range of about
   75k to 350k per agent, so roughly 1M to 5M tokens for a full 4-auditor run, scaled down by
   agent count for a smaller one. Label it rough: it is extrapolated from one adopter run (56 test
   files), where each finished agent left a 0.3 to 1.4 MB transcript, counted at 4 bytes per
   token. Say which agents run on Opus: the merge, every refuter, the reviewer, and the
   re-reviewer in each rework round. The survey, auditors, and builders run on Sonnet. Give no
   dollar figure. Offer a lighter path beside the full run: for a small suite, `apply: false`
   (stops after the refuters, so no builder, review, or rework agents) with a smaller
   `maxAuditors`. When the suite is large, recommend `apply: false` first: large means more than
   `maxAuditors` x 10000 test lines (40000 at the default), so each auditor reads over 10k lines.
   The build half returns little for its cost on a suite that size; the confirmed list is the
   product. The user can still choose the full run. Ask for a go-ahead if the user has not already given one.
3. Copy the script into the session scratchpad, because the Workflow tool only runs a script it
   can already read:

   ```
   cp ${CLAUDE_PLUGIN_ROOT}/skills/test-audit/test-audit.js <scratchpad>/test-audit.js
   ```

4. Run `Workflow({ scriptPath: "<scratchpad>/test-audit.js", args })` with:

   | arg | value |
   |---|---|
   | `root` | absolute path of the repo (`git rev-parse --show-toplevel`) |
   | `rules` | `${CLAUDE_PLUGIN_ROOT}/modules/testing/rules/testing.md`, expanded to an absolute path |
   | `scratch` | a directory under the session scratchpad, such as `<scratchpad>/test-audit` |
   | `date` | today's date as YYYY-MM-DD (the script cannot read the clock) |
   | `apply` | optional, default true |
   | `branch` | optional, default `tests-audit-<date>`; a git branch name of letters, digits, `.`, `_`, `-` and `/`, for a repo whose branch names need a tracker ID. Anything else throws |
   | `maxAuditors` | optional, default 4 |
   | `maxReworks` | optional, default 2; a non-negative integer, anything else is ignored with a log line. A round past the second still requires telling the user what each round found and why the next converges, per the orchestration rule |

   If the session lists no scratchpad, use a gitignored directory inside the repo root in its
   place, for the step 3 copy and for `scratch`. `<root>/.claude/worktrees/test-audit-scratch/`
   works because the sync step ignores `.claude/worktrees/`. Confirm first that any such path is
   ignored: `git -C <root> check-ignore -q <dir>/` must exit 0. If it does not, stop and ask the
   user rather than editing their `.gitignore`.

   `root` and `scratch` must hold no spaces. The script creates branch `branch` (default `tests-audit-<date>`) and a
   worktree under `<root>/.claude/worktrees/`.
5. When it returns, summarize for the user: how many findings were confirmed, refuted, and
   dropped (and why), the unread ranges if any, test counts and durations before and after, the
   CI critical path, every round's verdict from `rounds`, and the final verdict.
6. Only when the returned `verdict === 'ACCEPT'`, push the branch and open a PR from the
   worktree, using the repo's PR template. A `null` verdict means the build or a review produced
   nothing (the log says which; a build stops when its branch already exists), so no reviewed
   work exists: report that and stop. On `REWORK` after the last round, report
   `remainingMustFix` and stop: the maintainer decides. Never merge. If a PR body would pass GitHub's size limit, write a summary and attach
   the detail (the confirmed list with its planted-defect evidence) as a comment or file.

## While it runs

Point the user at `/workflows`: each agent completion logs a line there (merge counts, each
refuter as it returns, build start and end, each rework round). Those log lines are the user's
view; the session cannot read them, and the script writes no progress file. For a mid-run
summary, run this `jq` over the run's `journal.jsonl` (in the session's
`subagents/workflows/<run id>/` folder), not subagent transcripts:

```
jq -s '[.[] | select(.type == "started")] as $s | [.[] | select(.type == "result")] as $r
  | {phase: ($s | last | .phase), started: ($s | length), done: ($r | length),
     verdicts: ([$r[] | .result | objects | .verdicts[]? | .verdict] | group_by(.) | map({(.[0]): length}) | add)}' journal.jsonl
```

`phase` is the phase of the latest agent started, `started` minus `done` is the agents still
running, and `verdicts` tallies the refuters' confirmed, corrected, and refuted verdicts so far.

## The rework loop

After the first review, while the verdict is `REWORK` and fewer than 2 rework rounds have run, a
builder (Sonnet) fixes the must-fixes only as a new commit in the same worktree, and an Opus
refuter reviews that commit alone. After 2 rounds (or `maxReworks`) the script stops, logs that it stopped with one line per round,
and returns the open must-fixes. A third round would mean the design is the problem; hand it to the
user.

## Hazards

- An auditor often reads only part of a large test file and reports it as done. The script has
  each auditor report the ranges it read and sends it back for the rest; do not shortcut that by
  raising `maxAuditors` past the number of files or by dropping the re-read.
- A "covered elsewhere" claim is not accepted until a planted defect makes the named covering
  test fail. Do not accept a removal the refuters did not confirm, even a plausible one.
- Running `npm run verify` (or any heavy suite) in several worktrees at once overloads a laptop
  and makes timing assertions fail for no reason. The script runs the builder once; do not run
  suites in parallel yourself while it works.
- A builder that stops early returns a placeholder report. Check the worktree (`git log`,
  `git status`, the diff), not the report, before pushing.
- The builder branches from the commit the refuters proved claims against, and stops and reports
  if branch `tests-audit-<date>` or its worktree already exists. Rerunning on the same date needs
  a new `date` or the old worktree and branch removed first.
- A PR body over GitHub's size limit is rejected: write a summary and attach the detail.
- The script pushes nothing and merges nothing. Pushing and the PR are this skill's step 6.

## When an edit takes effect

An edit to this skill or its script reaches a session only after the plugin updates (the next
release) or the session reloads plugins. The copy in the scratchpad is a snapshot: re-copy it
before every run.

Files in this skill

  • SKILL.md7.6 KB
  • test-audit.js28.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.