consolidate-test-suites

$npx mdskill add compozy/agh/consolidate-test-suites

Identify invariant, layer, and canonical suite before changing tests.

  • Solves the problem of adding or moving tests without a clear rationale.
  • Depends on rg, file system search, and test-placement-rules.md reference.
  • Decides by naming the invariant, choosing the lowest owning layer, and reusing existing suites.
  • Delivers a structured procedure and a stop condition when no test is justified.

SKILL.md

.github/skills/consolidate-test-suitesView on GitHub ↗
---
name: consolidate-test-suites
description: Use when adding, moving, reviewing, or auditing tests in AGH to identify the invariant, owning layer, and canonical suite before changing coverage. Do not use as a replacement for framework-specific testing skills or final verification gates.
---

# Consolidate Test Suites

## Procedures

**Step 1: Name The Invariant**
1. Identify the rule that must stay true after the change.
2. Write the invariant in one sentence before editing any test.
3. If no durable behavior, contract, security boundary, concurrency rule, data invariant, or public API promise can be named, stop and report that no new automated test is justified.

**Step 2: Choose The Owning Layer**
1. Select exactly one primary owning layer: unit, integration, end-to-end, static analysis, codegen, visual QA, documentation build, or manual QA evidence.
2. Prefer the lowest layer that can prove the invariant against the real owner.
3. Do not duplicate the same invariant in multiple layers unless each layer proves a distinct failure mode.
4. Read `.agents/skills/agh/consolidate-test-suites/references/test-placement-rules.md` when the owning layer is not obvious.

**Step 3: Reuse The Canonical Suite**
1. Search existing tests before creating files: use `rg --files` plus focused `rg` for the feature, public API, component, route, command, or package name.
2. Prefer adding or adjusting a case in the existing canonical suite for the owning layer.
3. Create a new standalone regression test only when no existing suite owns the invariant.
4. If a new test file is created, record why an existing suite could not own the case.

**Step 4: Reject Low-Signal Tests**
1. Do not add tests that merely freeze implementation details, CSS literal values, generated output, snapshots, prose strings, config shape, or file existence.
2. Allow static artifact tests only when the artifact itself is the product contract and no stronger gate exists.
3. Reject Storybook setup/config/bootstrap, CI workflow/action YAML, Mage/Make/package-script plumbing, generic config/file existence, generated-output drift, snapshots/goldens, and coverage-padding unless the artifact is itself the product/operator contract.
4. For UI/design changes, prefer lint rules, Storybook visual verification, accessibility checks, or behavior-level component tests over literal token/prose snapshots.
5. For bug fixes, add the narrowest regression coverage at the owning layer after reproducing the bug.

**Step 5: Record The Decision**
1. In task notes, completion notes, or the final response, report:
   - Invariant.
   - Owning layer.
   - Canonical suite updated, or no-new-test rationale.
   - Verification command.
2. If no new automated test is added, cite the existing suite or gate that already proves the invariant.

## Error Handling

- **Existing test appears redundant:** identify the invariant it claims to own. If another suite already proves the same failure mode, consolidate into the owner and remove the duplicate only when the task explicitly includes test cleanup.
- **Coverage target conflicts with test placement:** do not add filler tests to raise coverage. Report the coverage gap and add behavior-bearing tests only where a named invariant exists.
- **Review requests a new regression test without an invariant:** ask for or infer the invariant from the bug. If none exists, mark the test request unjustified with evidence.
- **A task template says tests are required:** interpret that as a required test decision, not automatic creation of unit and integration tests.

More from compozy/agh

SkillDescription
agent-exploration>-
aghAGH runtime and contribution guide. Use for sessions, agents, native tools, skills, memory, network, tasks, capabilities, bundles, QA, docs, and repo work. Do not use for unrelated projects.
agh-cleanup-failure-paths>-
agh-code-guidelines>-
agh-contract-codegen-coshipContract co-ship for AGH wire changes. Use when editing public DTOs, OpenAPI, JSON-RPC extension shapes, generated clients, or handler request/response semantics. Do not use for internal Go refactors or test-only changes that leave the wire contract unchanged.
agh-data-boundariesData-boundary audit for AGH route loaders, TanStack Query caches, paginated catalogs, filters, ordering, totals, live streams, workspace-scoped reads, and their backend APIs. Use when adding, changing, or debugging those paths. Don't use for presentational-only UI or backend work with no public read-model impact.
agh-designAGH visual-design authority for production UI, static artifacts, prototypes, and reviews. Use when creating or reviewing an AGH surface or changing tokens, typography, spacing, depth, icons, or motion. Do not use for capture-only verification; use agh-ui-screenshot.
agh-qa-bootstrapBootstraps isolated AGH QA labs and emits the canonical manifest for downstream QA. Use when local QA needs daemon, workspace, provider, or playbook setup. Do not use for unit tests, planning-only work, or browser-only checks.
agh-schema-migrationAuthors append-only Goose SQL migrations for AGH SQLite streams and keeps declarative schema sources, atlas.sum, Atlas checks, sqlc output, and migration tests synchronized. Use for SQLite table, column, index, constraint, trigger, or seed-data changes under internal/store or internal/memory. Do not use for in-memory structures, derived Markdown memory, or non-SQLite caches.
agh-test-conventions>-