Test Audit
Audit existing tests for low-value, duplicated or implementation-coupled cases and the...
Install
npx skills add udecode/dotai --skill test-audit -g -a claude-code -y- Repository
- udecode/dotai1.2k
- Category
- Testing
- Updated
- 3d ago
- License
- See repository
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Audit existing tests for low-value, duplicated or implementation-coupled cases and the test-only code they keep alive, then remove or rewrite them on evidence. /test-audit full covers the whole suite and also lists public contracts no test guards. Use for test-audit, /test-audit <scope>, /test-audit full, a test sweep, or pruning tests. Not for writing a new test; the project's Tests rule gates that.
Test audit
Adapted from openclaw's test-audit skill (MIT, OpenClaw Foundation; see LICENSE).
Judge the result by how much the remaining tests can be trusted, never by how many were deleted. A test is worth keeping when it protects observable behavior, a credible regression, or an independent contract: a public API, protocol, config, migration, storage, security, platform, default, generated, package, release or architecture contract. Static, slow or flaky is never a reason to delete.
The bar
Judge each test by the two edits of pstack's principle-test-behavior-not-implementation:
- Break the behavior. Make the code return a wrong value, skip an effect or do it twice. The test must fail. One that passes proves nothing.
- Change the internals. Restructure the code under the test and keep every result its users observe. The test must pass. One that fails is pinned to the implementation. Its failure reports no bug, and every refactor has to rewrite it.
Keep a test that passes both. Rewrite or cut the rest, as the sections below say.
An internal entry is an export that no production code outside its own module calls. A dead-code tool in production mode, such as knip --production, lists them. With ignoreExportsUsedInFile on, knip does not list an export that its own module also uses, even when only tests import it from outside. List those exports' importers with a script, such as a git grep of each name; one whose only importers outside its module are tests is internal too. Each failure mode keeps one test, at the outermost entry a cheap test can call, such as the projection a screen reads rather than the helper inside it. When a kept boundary test catches a mistake, every other test of that mistake goes, even one that reads no private state.


