Test Audit

Skill

Gates new tests with four boundary questions and prunes mock-heavy, duplicate, or implementation-coupled tests from existing suites.

Adapted from OpenClaw · Maintained in Dotagents · skills/test-audit/SKILL.md · View source

What it does

AI agents love writing tests that assert a mock returned what the mock was just told to return, or that lock down private helper wiring. Test Audit stops that before it starts with a four-question gate: What real caller boundary does this exercise? What production bug would make it fail? Does an existing test already cover it? And if it uses mocks, is a real unit still under test?

In audit mode, it walks an existing test directory in small batches, merges overlapping files into parameterized cases, deletes tautological or implementation-coupled tests, and strips dead production exports that existed only for tests.

When to reach for it

Invocation: Loaded when writing or reviewing tests, or invoked explicitly via /skill:test-audit.

Writing tests for a new feature
Run the four-question gate before adding a test case so every test protects real caller behavior.
Cleaning up a bloated test suite
Audit a module's tests in batches of 3–5 files, verifying the suite still passes before committing each batch.

What it adds

  • A pre-write gate that rejects mock-only, duplicate, and source-regex tests.
  • A batch audit workflow with smell heuristics and dead test-only export cleanup.

Commands: /skill:test-audit

How it fits

  • Pi Review — Pair with Pi Review before committing: Pi Review checks production changes while Test Audit keeps the test diff lean.

Good to know

  • Never weakens assertions just to reduce line count—every batch must pass the project's test runner before being committed.

Source and setup

Loaded via
skills/test-audit/SKILL.md
Attribution
Adapted from OpenClaw · Maintained in Dotagents