Agent Skills › wannabespace/tamery › test-audit

test-audit

GitHub

用于测试编写、变更及审查的质量控制技能。包含新增测试的准入审核与现有测试的价值审计,旨在消除冗余、维护耦合及无效测试,确保测试保护真实行为而非实现细节。

.agents/skills/test-audit/SKILL.md wannabespace/tamery

Trigger Scenarios

编写新测试时 修改现有测试时 审查测试代码时 清理低价值或重复测试时

Install

npx skills add wannabespace/tamery --skill test-audit -g -y
More Options

Non-standard path

npx skills add https://github.com/wannabespace/tamery/tree/main/.agents/skills/test-audit -g -y

Use without installing

npx skills use wannabespace/tamery@test-audit

指定 Agent (Claude Code)

npx skills add wannabespace/tamery --skill test-audit -a claude-code -g -y

安装 repo 全部 skill

npx skills add wannabespace/tamery --all -g -y

预览 repo 内 skill

npx skills add wannabespace/tamery --list

SKILL.md

Frontmatter
{
    "name": "test-audit",
    "description": "Invoke whenever writing, changing, reviewing, or sweeping tests. Authoring gate for new tests plus audit workflow for low-value, implementation-coupled, or duplicative tests and the test-only production seams they demand."
}

Test Audit

Two modes, one value bar. Authoring mode gates every new or changed test at write time. Audit mode sweeps for tests that re-assert source, duplicate stronger proof, couple behaviour to implementation, or keep test-only production seams alive. Optimize for confidence, not deletion count.

Stack: bun test for unit tests (colocated *.test.ts), Playwright for E2E (apps/app/e2e).

Authoring gate

Before adding any test, answer four questions; a missing answer means do not add it yet:

  1. What observable behaviour, 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 test owner at the strongest boundary; another layer needs its own distinct risk. Prefer extending a table-driven case (test.each) or shared fixture over a near-duplicate test.
  4. Does it need a production seam (export, flag, wrapper, injection hook) no production caller needs? If yes, move the test to the real boundary instead.

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 breaks under behaviour-preserving refactoring asserts implementation, not behaviour; rewrite it at the owning boundary.

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

  • assertion-free coverage probes;
  • self-comparisons and identity copiers;
  • 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;
  • per-dialect replays of a shared helper;
  • tests whose only purpose is preserving test-only exports, globals, or wrappers;
  • dead production code whose only callers are tests;
  • expected values produced by the helper under test;
  • mocks that implement the asserted behaviour, or one mock standing in for different APIs;
  • fixtures that supply the result or ordering the owner should produce;
  • capability tests that restate declared flags instead of exercising what the flag gates;
  • negative controls that pass for an unrelated reason, such as a rejection from a different guard;
  • names or fixtures that promise more than the input exercises.

Value bar

Tests justify their maintenance cost by protecting behaviour, a credible regression, or an independently meaningful contract. In an audit, an existing test that must change for behaviour-preserving reorganization is suspect, not automatically deletable.

Before judging a candidate, read the complete test and production owner, its callers, sibling implementations (other dialects), overlapping tests, and relevant history. When the test claims dependency-backed behaviour, inspect the dependency source or types directly.

Discovery

Keep discovery read-only and report evidence before editing. For broad scope, split lanes: packages/, apps/app/src, apps/app/e2e, plus a cross-cutting pattern sweep. Prefer a few high-confidence candidates over a large speculative inventory.

Retention bar

Keep a test when it independently enforces a public API, protocol, parser, per-dialect SQL, encryption, security, default, or architecture contract. Also keep:

  • call ordering when order is observable behaviour;
  • regressions with a credible failure mode;
  • source inspection when it is the cheapest independent guard — fails when the contract changes, survives an identifier-only rename;
  • a retained test that fails on the baseline: treat it as a possible product bug, reproduce it, and repair the owner rather than deleting it.

Static or slow is not a deletion reason. A test that resembles implementation may still be the independent contract; prove otherwise before removing it.

Candidate evidence

Record every field before editing. A missing field means the candidate is not ready for deletion:

  • exact test name and location;
  • what failure it can actually detect;
  • non-test callers of the covered seam;
  • stronger remaining owner-boundary proof, or why no proof is needed;
  • why the test or seam exists (history);
  • production or test-support deletion unlocked;
  • risk and the focused validation command.

Edit shape

One coherent owner-boundary batch at a time. Delete obsolete test-only exports, wrappers, and dead production paths instead of preserving aliases. Move retained regressions to their canonical owners. Prefer net-negative production LOC. Do not add replacement tests that restate the same implementation.

Validation

  1. Run the owner and sibling tests: bun test <path>.
  2. pnpm run fix && pnpm run check, then git diff --check.
  3. pnpm test before handoff.
  4. Inspect git diff --numstat; report production separately from tests.

Handoff

Report: removed low-value categories; production simplifications; retained false positives and why they stay; proof actually run; production versus test LOC; named follow-ups.

Version History

  • 17012db Current 2026-10-19 21:20

Same Skill Collection

.agents/skills/apple-design/SKILL.md
.agents/skills/cleanup/SKILL.md
.agents/skills/design-an-interface/SKILL.md
.agents/skills/design-taste-frontend/SKILL.md
.agents/skills/electron-drive/SKILL.md
.agents/skills/emil-design-eng/SKILL.md
.agents/skills/tamery-ui/SKILL.md
.agents/skills/thermo-nuclear-code-quality-review/SKILL.md
.agents/skills/user-behavior-qa/SKILL.md
.agents/skills/vercel-react-best-practices/SKILL.md

Metadata

Files
0
Version
17012db
Hash
aa853fd2
Indexed
2026-10-19 21:20

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-29 01:18
浙ICP备14020137号-1