audit-tests
Audit tests and fix clear negative-value or mechanical problems.
Scope
- Default to all tests; accept paths, modules, repository-defined tiers, and a
report limit that does not reduce coverage.
- Derive tiers from repository configuration. If ambiguous, audit concrete
tests without tiers and report the limitation.
Write .agent-layer/tmp/audit-tests.<run-id>.report.md, using
YYYYMMDD-HHMMSS-<short-rand> for run-id.
Contract
- Findings identify concrete tests, behavior, and evidence; coverage percentage
alone is not a finding.
- Delete tautological, self-confirming, dead, rubber-stamp, or duplicate tests,
preserving the strongest behavioral coverage.
- Make mechanical assertion, naming, tier, helper, and fixture repairs when the
intended behavior is established.
- Add behavior-focused tests for material gaps when the expected behavior is
established.
- Do not delete partially valuable tests or change production for testability
without a user decision. Replace false coverage only for a clear behavior
contract.
- Ignore framework conventions and style preferences that do not affect value.
Workflow
Read COMMANDS.md before selecting commands. Identify the test runner,
configuration, conventions, fixtures, helpers, and tiers. Inventory the scope.
For large scopes, parallelize non-overlapping read-only investigations; the
owning agent validates candidates, reconciles gaps/duplication, and edits.
Review:
- duplicate scenarios, setup, assertions, helpers, and fixtures
- false, fragile, dead, misleading, or misplaced tests
- unexpected I/O, network, sleeps, or other tier violations
- material gaps in failures, boundaries, interactions, or critical workflows
Use coverage when documented and useful, reusing results until edits invalidate
them. Apply safe deletions, consolidation, and mechanical fixes. Leave
judgment-dependent work untouched. Fix material gaps with behavior-focused
tests; report only gaps that require a user decision.
If files changed, run a credible repository lane covering them. Diagnose and
repair in-scope failures, then rerun invalidated checks.
The report contains:
# Test Audit Summary — scope, conventions, and verdict
## Inventory — grouped count by discovered tier
## Fixes Applied
## Material Findings — category, tier, location, evidence, and outcome
## Gap Findings — material behavioral gaps and their affected scope
## Decisions Needed
## Verification
Outcomes are fixed or needs-user-decision; use None for empty sections.
Finish after full evidence coverage, terminal finding outcomes, and a passing
lane for changed tests. Return the report path, fixes, residuals, and
verification.
1---2name: audit-tests3description: Audit the existing test suite once for redundancy, misleading coverage, organization, and material behavioral gaps, directly fixing safe findings.4---56# audit-tests78Audit tests and fix clear negative-value or mechanical problems.910## Scope1112- Default to all tests; accept paths, modules, repository-defined tiers, and a13 report limit that does not reduce coverage.14- Derive tiers from repository configuration. If ambiguous, audit concrete15 tests without tiers and report the limitation.1617Write `.agent-layer/tmp/audit-tests.<run-id>.report.md`, using18`YYYYMMDD-HHMMSS-<short-rand>` for `run-id`.1920## Contract2122- Findings identify concrete tests, behavior, and evidence; coverage percentage23 alone is not a finding.24- Delete tautological, self-confirming, dead, rubber-stamp, or duplicate tests,25 preserving the strongest behavioral coverage.26- Make mechanical assertion, naming, tier, helper, and fixture repairs when the27 intended behavior is established.28- Add behavior-focused tests for material gaps when the expected behavior is29 established.30- Do not delete partially valuable tests or change production for testability31 without a user decision. Replace false coverage only for a clear behavior32 contract.33- Ignore framework conventions and style preferences that do not affect value.3435## Workflow3637Read COMMANDS.md before selecting commands. Identify the test runner,38configuration, conventions, fixtures, helpers, and tiers. Inventory the scope.39For large scopes, parallelize non-overlapping read-only investigations; the40owning agent validates candidates, reconciles gaps/duplication, and edits.4142Review:4344- duplicate scenarios, setup, assertions, helpers, and fixtures45- false, fragile, dead, misleading, or misplaced tests46- unexpected I/O, network, sleeps, or other tier violations47- material gaps in failures, boundaries, interactions, or critical workflows4849Use coverage when documented and useful, reusing results until edits invalidate50them. Apply safe deletions, consolidation, and mechanical fixes. Leave51judgment-dependent work untouched. Fix material gaps with behavior-focused52tests; report only gaps that require a user decision.5354If files changed, run a credible repository lane covering them. Diagnose and55repair in-scope failures, then rerun invalidated checks.5657The report contains:58591. `# Test Audit Summary` — scope, conventions, and verdict602. `## Inventory` — grouped count by discovered tier613. `## Fixes Applied`624. `## Material Findings` — category, tier, location, evidence, and outcome635. `## Gap Findings` — material behavioral gaps and their affected scope646. `## Decisions Needed`657. `## Verification`6667Outcomes are `fixed` or `needs-user-decision`; use `None` for empty sections.68Finish after full evidence coverage, terminal finding outcomes, and a passing69lane for changed tests. Return the report path, fixes, residuals, and70verification.