test-audit
БесплатноБез исполняемых скриптовНе проверенInvoke whenever writing, changing, reviewing, or sweeping Vitest tests in this repo. Authoring gate for new or changed tests, plus an audit workflow for…
от every-app★ 29 413 звёзд на GitHubОб этом скилле
Test Audit
Three modes, one value bar. Authoring mode gates every new or changed test at write time. Audit mode runs focused sweeps for tests that re-assert source, duplicate stronger proof, couple behavior to implementation, or keep test-only production seams alive. Campaign mode reviews every test file with a per-test verdict when the maintainer asks to prune the whole suite; see Campaign mode. Optimize for confidence, not deletion count. Land one coherent batch per PR; continue broad audits as separate follow-ups.
The repository's own rules live in the "Testing" section of AGENTS.md. This
skill is the procedure for applying them; when the two disagree, AGENTS.md
wins and this file needs an update.
Authoring gate
Before adding a test, answer four questions. A missing answer means do not add it yet:
- What observable behavior, invariant, or independent contract does it protect?
- What credible regression makes it fail?
- Why does existing coverage not already catch that failure? Each contract has
one primary owner at the strongest boundary (usually the service or the MCP
tool handler, not the repository or a private helper). Another layer needs
its own distinct risk. Prefer extending a table-driven case or a shared
factory (
ga4-test-fixtures.ts,tool-test-support.ts) over a near-duplicate test, and consolidate duplicated setup in the same change. - Does it need a production seam (export, flag, wrapper, injection hook) that
no production caller needs? If yes, test at the real boundary instead.
Grep the whole repo for callers, not just
src/;scripts/counts.
Then check the test against every junk pattern; a match fails the gate unless the retention bar names the contract it independently guards. A test that would break under behavior-preserving refactoring is asserting implementation, not behavior; rewrite it at the owning boundary before landing it.
Bug regression tests must fail on the pre-fix code for the intended reason and pass after the fix. A regression test that never demonstrably failed proves the mock, not the fix. One regression at the owner boundary covers the bug; do not replay it at every layer it crosses.
Junk patterns
The shared checklist for both modes. The authoring gate rejects a new test that matches one; audits hunt for existing tests that do.
Repo-specific (each is a AGENTS.md rule):
- per-test
await import()orvi.resetModules()without a comment explaining which module-level state must reset; - a production class re-declared inside a test instead of imported from a leaf
module (
ga4Errors.ts,gscErrors.tsare the pattern); mockReset/mockClearceremonies inbeforeEach(VitestclearMocksis already on);- fixtures longer than the assertions that read them, or inline copies of a shape that already has a factory;
- Zod schemas or third-party libraries re-tested through the module under test;
- an output-schema round-trip repeated in every happy path;
- Drizzle builder chains mocked (
select().from().where()withvi.fn()chains); repositories are tested through services or real SQL; - argument forwarding to a mock asserted when the mapping is not the contract (billing params and telemetry events are the contract; internal helper arguments are not).
General:
- assertion-free coverage probes;
- self-comparisons, and expected values produced by the helper or renderer under test;
- copied fixtures, inventories, manifests, or export lists;
- exact source, import, or string greps;
- private predicate or call-shape tests duplicated at real boundaries;
- duplicate invocations of the same contract;
- tests whose only purpose is preserving test-only exports or wrappers;
- dead production code whose only callers are tests;
- mocks that implement the asserted behavior, or one identical mock standing in for different APIs;
- negative controls that pass for an unrelated reason, such as a denial from a different guard or a rejection the production path never reaches;
- names or fixtures that promise more than the input exercises.
Value bar
Tests justify their maintenance cost by protecting behavior, a credible regression, or an independently meaningful contract. In an audit, an existing test that must change for behavior-preserving source reorganization is suspect, not automatically deletable; the authoring gate still rejects new ones.
Before judging a candidate, read the complete test and its production owner, the entry point, callers, callees, sibling implementations, overlapping tests, and relevant git history. When the test claims dependency-backed behavior (DataForSEO response shapes, Autumn, Better Auth, Drizzle), inspect the dependency source or types directly.
Discovery
Keep discovery read-only and report evidence before editing. For broad scope, run parallel read-only lanes (Explore subagents work well):
- `src/server/
Установить test-audit в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл test-audit?
Invoke whenever writing, changing, reviewing, or sweeping Vitest tests in this repo. Authoring gate for new or changed tests, plus an audit workflow for low-value, implementation-coupled, or duplicative tests and the test-only production seams they keep alive. Use when asked to add tests, review tests, clean up tests, or when a PR touches *.test.ts.
Как установить скилл test-audit?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-audit запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic