Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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:

  1. What observable behavior, invariant, or independent contract does it protect?
  2. What credible regression makes it fail?
  3. 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.
  4. 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() or vi.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.ts are the pattern);
  • mockReset / mockClear ceremonies in beforeEach (Vitest clearMocks is 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() with vi.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/
Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить test-audit с