# Test Audit

Audit existing tests for low-value, duplicated or implementation-coupled cases and the...

- Repository: https://github.com/udecode/dotai (1161 stars)
- Category: Testing
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add udecode/dotai --skill test-audit -g -a claude-code -y`
Codex: `npx skills add udecode/dotai --skill test-audit -g -a codex -y`
Cursor: `npx skills add udecode/dotai --skill test-audit -g -a cursor -y`
Gemini CLI: `npx skills add udecode/dotai --skill test-audit -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Test audit

Adapted from openclaw's `test-audit` skill (MIT, OpenClaw Foundation; see [LICENSE](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.

## Scope

The rest: https://github.com/udecode/dotai/blob/HEAD/skills/test-audit/SKILL.md
