/session-orchestrator:test-audit [gate|audit|campaign] [scope] [--goal "<goal>"]from session-orchestrator
Three-mode test quality tool: a gate before writing new tests, a focused audit of one scope, and a repo-wide campaign that removes low-value tests under a coverage guard. Every change carries written evidence.
Ships in session-orchestrator. 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.
Plugin root:
${CLAUDE_PLUGIN_ROOT}. Claude Code replaces this with the plugin's absolute path when it loads this file. Where it appears unreplaced — in a file this skill reads with the Read tool, or on Codex, Cursor or Pi — the plugin root is the directory that contains this skill'sskills/folder (two levels above the folder of this SKILL.md). Write that absolute path literally into every command that starts a plugin script: the Bash tool has no plugin variable, and shell variables do not survive between tool calls.
A test earns its place by catching a regression nothing else catches. This skill applies that bar at three depths. It complements .claude/rules/test-value.md (TV-001..TV-005) and the repo's test-quality / test-hygiene rules; it replaces none of them.
Rule references below (test-value.md, receiving-review.md, parallel-sessions.md, bash-harness-pitfalls.md) name the repo's .claude/rules/. A consumer repo often lacks them; then read them from the plugin's rules/always-on/.
Invoked as /test-audit [gate|audit|campaign] [scope] [--goal "<goal>"] with arguments: $ARGUMENTS.
gate — run the write gate on the test about to be written. Default when no mode is given and the conversation is about to add a test.audit <scope> — one focused pass over a path, glob, or module. Default when a scope is given without a mode.campaign <scope> — a whole repo or subsystem, split into lanes. Only on the explicit word campaign; read references/campaign.md before starting.audit or campaign is asked for once via AskUserQuestion, with the largest test directories as options (lead-guided: § Lead-guided runs).State the goal in the first output and repeat it in the report. With no --goal, use:
Remove at least 20 % of the least useful tests, measured in test lines. Total coverage stays within 2 percentage points of M0, and no production file drops below its own M0 coverage.
Test lines count only for files the CI actually runs; tracked test files outside that scope are reported on their own line, as dead or as live outside the include, and never counted toward the goal (references/campaign.md § Measurements).
The goal exists because a bare "clean up" stops far too early. It never licenses a deletion without evidence. What counts toward it, and what is reported beside it (same-file reshaping, mock ballast, F/N growth, the O sum), is fixed in references/campaign.md § Goal accounting. A goal that is only reachable by breaking the evidence rules below is not reached: the report says which rule blocked it and where the audit stopped. An audit that ends with zero changes is valid when the ledger shows why.
Before adding any test, answer all four. A missing answer means the test is not written yet.
exports, index, another repo) reaches it, and a seam otherwise.Then check it against the junk patterns below; a match fails the gate unless the keep list names the contract it alone guards. A regression test must be shown red on the pre-fix code, for the intended reason, before the fix lands; one that never failed proves the mock, not the fix. One regression at the owning boundary covers the bug; do not replay it at every layer. no-tests-needed: <reason> is a success outcome (TV-001).
Judge each test by what its assertions can catch, never by its name.
Junk patterns (candidates for D, C, or F):
.md file (TV-002c), unless the project instruction file makes that structure a rule (then R, citing it);code-implementer commit, owner decision when the code is public API), otherwise O.Keep list (the counterweight to TV-002): a test that is the independent proof for a public API, protocol, a config value production reads (a config field whose only reader is the test is a seam, not a contract), migration, storage format, security control, release step, or data-protection rule stays. So do observable call ordering and regressions with a credible failure mode. Static or slow is not a reason to delete. When in doubt, mark R.
Accidental coverage is not a proof: a line that runs only because a mock is incomplete (a missing method sends the code into its catch branch) or because a timer is left dangling after the test. Deleting its duplicate loses no contract but trips the coverage backstop; answer that with a contract test (fake timers, an explicit failing mock), never by restoring the accidental one.
Every test declaration in scope gets exactly one mark and one evidence line. A parametrised table is one declaration unless its rows need different marks.
| Mark | Meaning | Required note |
|---|---|---|
| R | keep | the contract and the bug it catches |
| F | keep the contract, repair the assertion | what the assertion misses today, and the mutation the repair must catch |
| C | consolidate into a keeper | the keeper test that absorbs it |
| D | delete | the remaining proof, or why no contract exists |
| N | new test | only after passing the write gate |
| B | red on the baseline (from the P1 / M0 pass/fail list only) | possible product bug: never deleted, becomes an issue |
| O | owner decision pending: keep | the open question and the candidate's line count; listed in the MR under open decisions, never folded into R |
Suspected product bugs found while reading, with no test behind them, go into a separate Issues section of the ledger (file:line, expected vs. actual). They become issues, never red tests in the MR.
All eight fields, written into the ledger before the edit. A missing field means no deletion.
file:line) and exact name.git log -S "<identifier>" -- <file> and the reason the test or seam exists.src/file:line, and the diff as a patch file) under which the keeper must go red; falsification executes it. A D that removes no contract (dead code, a duplicate proven elsewhere, a test-local copy) says so here and becomes a NOCONTRACT manifest row instead (references/campaign.md § Mutation manifest).For every contract that a C, D, or F relies on, make one targeted mutation in the production code: flip the condition, drop the field, change the byte the contract names. Several marks may share one mutation when they name the same keeper and contract; the ledger maps every mark to at least one mutation id. Replacing a whole function body with throw kills every caller and proves nothing; use it at most as a pre-filter. The keeper (for C/D) or the repaired test (for F) must turn red under the mutation.
git apply), run the one test, reverse it (git apply -R), then prove the restore byte for byte: git diff --exit-code -- <prod-file>, or a checksum taken before the mutation when the file already carried edits. A leftover diff aborts the audit. references/mutate.sh runs a manifest of such patches (references/campaign.md § Mutation manifest). Prove the red with the runner's failure summary (vitest: Tests N failed), never with the exit code alone, and keep the output files.offload run <repo> -H <host> --job ta-<repo>-<purpose> -- <command>, reused with --no-sync (hosts come from remote-hosts: in Session Config; see the remote-offload skill; path and expansion pitfalls in references/campaign.md § Measurements). An agent's own pre-check runs only in a private copy outside the repo, under references/campaign.md § Pre-checks, and never counts as proof.file:line, the mutation diff, the test that went red, the restore proof.--coverage.reporter=json) and restore the contract in the keeper with a caught mutation. Restore the deleted test verbatim only when it was the genuine proof; accidental coverage (§ The value bar) gets a contract test instead.Bash harnesses are falsified before their tests are judged: feed a known-broken input and require a non-zero exit and a FAIL in the written artefact, under bash, not zsh (.claude/rules/bash-harness-pitfalls.md).
qa-strategist read-only to draft the ledger; it writes /tmp/<audit>/ledger-<lane>.md itself and answers with the count line, and the coordinator assembles the ledger file. A scope above one lane (about 2,200 test lines or 150 declarations, references/campaign.md § P2) needs campaign mode: say so and ask for the word campaign before step 3.test-writer repairs every F, absorbs every C into its keeper, and deletes the C and D. Agents never commit (PSA-007 in .claude/rules/parallel-sessions.md).CAUGHT. Removing a test-only production seam is a separate code-implementer task and commit.session-reviewer, or pr-review-toolkit:pr-test-analyzer when installed): contracts that lost their only proof, and new assertions that cannot fail. Every restored contract needs a caught mutation.Phases P1 to P9 with lanes, a separate layer-plan pass, an owner checkpoint after P4, the sub-campaign threshold, the pre-check rules, and the full measurement set live in references/campaign.md. Read it completely before P1.
Ask via AskUserQuestion, and do not work around a refusal. A headless or lead-guided run (§ Lead-guided runs) without that tool takes the answer the brief or this list already gives and logs it; anything else becomes an O mark plus an entry in the run's parking file (the report's Parked section when the brief names none), never a workaround:
autoUpdate);-u;stop-and-escalate, RCR-007 in .claude/rules/receiving-review.md);When the run is lead-guided or headless (detection, duties, owner classes and the decision-line format: ../_shared/lead-guided-mode.md), nobody answers and no question ends the turn. Where this skill would ask:
campaign: narrow to one lane (the recommendation) and record the line; a campaign starts only when the brief says campaign.### Autonome Entscheidungen beside the Parked section, and ends as a report.Stop when: a change you did not make, or a lock, appears in scope (PSA-002); a restore leaves a diff; the baseline does not reproduce; two review cycles pass without fewer open findings (RCR-008: land the smallest safe subset); a lane exceeds its budget.
Done when: the gate is green at the MR SHA; flakes and per-file coverage are no worse than M0; every C, D, and F has evidence and a caught mutation (a D without a contract may instead have a NOCONTRACT row with ledger evidence); the production diff against main outside the test globs and docs/audits/ is empty, seam commits and owner-approved changes excepted; the preservation review has no open gap; the goal is reached, or the report names why it was not; the MR pipeline has finished and its result stands in the report.
docs/audits/<date>-test-audit.md (report) and docs/audits/<date>-test-audit-ledger.md (ledger) in the target repo.test(audit): <scope> Test-Audit <date> (subject case per the repo's commitlint config) carrying: M0/M1 table, R/F/C/D/N/B/O counts per lane, the keeper per contract, the mutation table, kept false alarms and why, production and test lines counted separately, the zero-production-diff proof, owner decisions taken and open (every O), and the pipeline result.Inspired by openclaw/openclaw .agents/skills/test-audit @ 80930af (MIT, Copyright (c) 2026 OpenClaw Foundation); rewritten for session-orchestrator.
What SKILL.md sets; muted values are Claude Code's defaults
inheritThree short reads, in order
55 skills in this plugin
/architectureUse when the user asks to improve architecture, find refactoring opportunities, surface deepening opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable. Surfaces shallow modules and hypothetical seams using a precise vocabulary (Module / Interface / Implementation / Depth / Seam / Adapter / Leverage / Locality from LANGUAGE.md)./autopilotUse this skill when running an autonomous session-orchestration loop. Chains session-start → session-plan → wave-executor → session-end for N iterations with all 10 kill-switches (SPIRAL, FAILED wave, carryover > 50%, max-hours, max-sessions, resource-overload, token-budget, stall-timeout, sub-threshold confidence, user-abort). Reads Mode-Selector output (Phase B) to decide auto-execute vs. fallback. Writes one autopilot.jsonl record per loop run. Phase C scaffold (issue #277); implementation lives in scripts/lib/autopilot.mjs (Phase C-1 follow-up).
/backlogUse when a repository's issue backlog needs refinement so agents can start work without asking back. Measures the tracker with scripts/backlog-refine.mjs (labels, readiness of status:ready issues, size, dependencies, epics, closed-issue hygiene), then proposes splits, epics, merges, fills and closings for approval and applies them through gitlab-ops. Triggered by /backlog [repo], "refine the backlog", "is the backlog ready for agents", "Backlog aufräumen". Not for finding code defects (use discovery), not for cross-repo dashboards (use portfolio), and not for creating issues from scratch./bootstrapUse this skill when scaffolding the minimum repository structure required by session-orchestrator. Invoked automatically by the Bootstrap Gate when CLAUDE.md, Session Config, or bootstrap.lock is missing. Also available as /bootstrap for manual invocation. Three intensity tiers: fast (demos/spikes), standard (MVPs), deep (production/team).
/brainstormUse when you have a feature idea but the scope or UX is still ambiguous — runs a lightweight Socratic design dialogue (3-5 AUQ rounds) and writes a spec markdown file. Use BEFORE /plan feature when product intent needs validation; skip to /plan feature when scope is already clear. HARD-GATE prevents any code work until the design is user-approved./claude-md-drift-checkUse when detecting drift between CLAUDE.md (or AGENTS.md, the Codex CLI alias) / _meta narrative and live repository state. Ten checks: absolute-path resolution, 01-projects/ count claims, issue-reference freshness, session-file existence, command-count sync, session-config-parity (mandatory template keys = error, opt-in gaps = note, unknown local keys = warning), vault-dir-parity (CLAUDE.md vs AGENTS.md), generated-rule-staleness (WARN-only), rule-scoping (paths:/globs: frontmatter defects, dangling rule citations, zero-match globs), and docs-parity (docs/components.md count-claims vs on-disk counts, template-vs-reference config-key parity, stale .claude/metrics/ paths). Full per-check spec in the body table. Invoked as an opt-in session-end phase; mirrors vault-sync's lean JSON+exit-code contract.
npx claudepluginhub kanevry/session-orchestrator --plugin session-orchestratorOther plugins' skills for the same job