Agent Skillsinstructa/agent-skills › consolidate-test-suites

consolidate-test-suites

GitHub

规范测试用例归属,确定唯一负责层并复用现有套件。防止重复添加、锁定实现细节或随意创建回归测试,清理弱覆盖和重复项,确保测试结构清晰且维护高效。

skills/engineering/consolidate-test-suites/SKILL.md instructa/agent-skills

Trigger Scenarios

修复bug后需要添加测试 重构代码后需要调整测试位置 存在多处重复或冗余的测试用例 不确定新测试应放在单元、集成还是E2E层

Install

npx skills add instructa/agent-skills --skill consolidate-test-suites -g -y
More Options

Non-standard path

npx skills add https://github.com/instructa/agent-skills/tree/main/skills/engineering/consolidate-test-suites -g -y

Use without installing

npx skills use instructa/agent-skills@consolidate-test-suites

指定 Agent (Claude Code)

npx skills add instructa/agent-skills --skill consolidate-test-suites -a claude-code -g -y

安装 repo 全部 skill

npx skills add instructa/agent-skills --all -g -y

预览 repo 内 skill

npx skills add instructa/agent-skills --list

SKILL.md

Frontmatter
{
    "name": "consolidate-test-suites",
    "description": "Decide exactly where bug-fix test coverage belongs. Use before adding, moving, or deleting tests after a bug fix or architectural change. Select one owning layer, reuse existing canonical suites, block redundant or weakly placed tests, and remove weaker duplicates."
}

Consolidate Test Suites

Purpose: place each invariant in one owning test layer only.

Definitions:

  • Invariant: the rule that must stay true.
  • Owning layer: the lowest layer that truly owns and can prove that rule.
  • Canonical suite: the normal existing suite for that owning layer.

Default: reuse an existing canonical suite. Do not create a new standalone regression test unless the exception rule below allows it.

Hard Rules

  • You MUST identify the invariant before adding or moving any test.
  • You MUST identify one primary owning layer: unit, integration, or end-to-end.
  • You MUST first try to place coverage in an existing canonical suite for that layer.
  • You MUST prefer editing an existing test file over creating a new test file.
  • You MUST NOT add the same invariant in multiple layers unless each layer covers a different failure mode. If you keep more than one layer, name the distinct failure mode for each.
  • You MUST NOT add tests that lock in implementation details unless that implementation unit itself owns the invariant.
  • You MUST NOT create a standalone regression test because it is faster or easier.
  • If you cannot name the invariant and the owning layer, STOP. Report that placement is not justified.

Required Decision Order

Choose the first option that fits:

  1. Add to an existing test in an existing file in the owning layer.
  2. Add a new test to an existing canonical file in the owning layer.
  3. Create a new file inside the existing canonical suite in the owning layer.
  4. Create a standalone regression-style test only if the Exception Rule passes.

Owning Layer Rules

Choose unit when:

  • one module owns the rule, and
  • the bug reproduces without I/O, transport, persistence, retries, IPC, orchestration, or lifecycle coupling.

Choose integration when:

  • the rule lives at a boundary between components, or
  • the bug depends on serialization, persistence, ordering, replay, retries, IPC, process lifecycle, or multi-component coordination.

Choose end-to-end only when:

  • the user-visible contract cannot be trusted from lower-layer tests alone.

Tie-breakers:

  • If torn between unit and integration, choose integration.
  • Never choose end-to-end to compensate for uncertainty.
  • Never choose a higher layer just because it is easier to reproduce there.

Exception Rule for Standalone Regression Tests

A standalone regression-style test is allowed only if ALL are true:

  • no existing canonical suite can express the case cleanly
  • the reproduction is deterministic
  • the case has durable incident or contract value
  • adding it to the canonical suite would make that suite less clear

If any condition is false, fold the coverage into the canonical suite.

Duplicate Cleanup

After placing coverage:

  1. Search for tests that assert the same invariant.
  2. Keep the strongest owned location.
  3. Merge any unique assertions into that location.
  4. Delete or simplify weaker duplicates.
  5. Rename tests by behavior and owner, not by ticket number or bug history.

Verification

Before finishing:

  1. Run the narrowest relevant test target first.
  2. Run required typecheck, build, or lint steps for touched code.
  3. Report exactly what was run and whether it passed.

Default Output Format

Use this format by default:

Invariant:

Owning layer: <unit | integration | end-to-end>

Target suite/file:

Action: <reuse existing test | add to existing suite | create file in canonical suite | keep standalone regression>

Why this layer owns it:

Duplicates to merge/delete: <list or "none">

Verification run:

Residual risk: <what is still not covered, if anything>

Version History

  • 11dfe69 Current 2026-08-20 11:31

Same Skill Collection

skills/delegation/delegate-fable/SKILL.md
skills/delegation/delegate-grok/SKILL.md
skills/delegation/delegate-sol/SKILL.md
skills/design/redesign-my-landingpage/SKILL.md
skills/electron/electron-live-test/SKILL.md
skills/engineering/architecture-ownership/SKILL.md
skills/engineering/clarify/SKILL.md
skills/engineering/find-duplicate-ownership/SKILL.md
skills/engineering/hard-cut/SKILL.md
skills/engineering/root-cause-finder/SKILL.md
skills/engineering/search-context/SKILL.md
skills/git/gitwhat/SKILL.md
skills/go/go-local-health/SKILL.md
skills/release/homebrew-publish/SKILL.md
skills/security/package-security-check/SKILL.md
skills/security/secleak-check/SKILL.md
skills/shell/shellck/SKILL.md
skills/specs/app-spec-packager/SKILL.md

Metadata

Files
0
Version
11dfe69
Hash
a6e350d7
Indexed
2026-08-20 11:31

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 13:16
浙ICP备14020137号-1 $방문자$