test-gap-audit

软件研发 安全与合规 2 文件 EN 原文 1 脚本

Run a read-only audit for missing, weak, stale,

Run a read-only audit for missing, weak, stale, or mis-scoped test coverage. If the user does not name a scope, audit the full repository and identify important code paths, routes, features, services, workflows, and contracts that lack proper tests. If the user names a feature, PR, branch, route, workflow, service, bug fix, API, security-sensitive path, or risky code change, focus only on that specific scope. Use when the user asks what tests are missing, whether coverage is enough, what regression tests to add, or how to prove a change is safe. This is not a general bug audit and not a security review; it evaluates whether behavior is covered by tests.

说明语言:英文

来源githubawesome-copilot ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/github/awesome-copilot --skill test-gap-audit

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: test-gap-audit description: Run a read-only audit for missing, weak, stale, or mis-scoped test coverage. If the user does not name a scope, audit the full repository and identify important code paths, routes, features, services, workflows, and contracts that lack proper tests. If the user names a feature, PR, branch, route, workflow, service, bug fix, API, security-sensitive path, or risky code change, focus only on that specific scope. Use when the user asks what tests are missing, whether coverage is enough, what regression tests to add, or how to prove a change is safe. This is not a general bug audit and not a security review; it evaluates whether behavior is covered by tests. license: MIT ---

Test Gap Audit

Find the tests that should exist but do not, or tests that exist but do not prove the important behavior. Produce concrete, prioritized test recommendations grounded in code paths, risk, and existing test conventions.

Core Rules

Inputs

When no scope is given, audit the whole repository. Inventory the repo's major testable surfaces and report which important areas do not have tests, do not have enough assertions, or are only indirectly covered.

Accept any specific testing scope, including:

If scope is blurry, infer the smallest useful boundary and state it. If no scope is stated, do not ask for one; proceed with a full-repo audit. Ask only when different scopes would require materially different test plans.

Discovery Workflow

  1. Establish repo context.
  2. Check git status --short.
  3. Identify stack, test runners, package scripts, CI checks, test file naming, fixture style, mocks, factories, browser tools, API test conventions, and monorepo boundaries.
  4. Read relevant manifests, CI workflows, test configs, and nearby tests.
  1. Map the behavior under review.
  2. For full-repo audits, inventory major app surfaces, packages, routes, APIs, services, jobs, CLIs, schemas, integrations, and shared libraries before choosing the highest-risk gaps to inspect deeply.
  3. For PRs, inspect changed files, changed tests, and adjacent unchanged code.
  4. For features, locate routes, components, services, models, schemas, jobs, permissions, integrations, and user-facing states.
  5. Identify happy paths, failure paths, edge cases, data boundaries, auth/authorization boundaries, migration/config behavior, and external integration behavior.
  1. Map existing coverage.
  2. Run the bundled scripts/coverage_map.py first when it is available. It detects the test framework and naming convention, then matches every source file against the tests by name, mirrored path, and what the test files actually import, and returns the unmatched files ranked with risk keywords plus test files that have cases but almost no assertions. The path is relative to this skill's own directory, which varies by host. Use python if python3 is not on PATH.
  3. python <skill-dir>/scripts/coverage_map.py --top 25, or --format json to filter the results yourself.
  4. The matcher is heuristic and cannot see coverage that arrives through fixtures, end-to-end tests, or indirection. Treat an unmatched file as a lead, and grep for the module name to confirm before reporting it as P0 or P1. Report a gap as confirmed only after you have looked.
  5. If the script is unavailable, compare production/source areas against test directories and test naming conventions manually to find untested or weakly tested portions of the repo.
  6. Find direct tests for the changed or requested code.
  7. Find indirect tests that cover the same behavior through a higher-level workflow.
  8. Inspect assertions, fixtures, mocks, setup, and test names to see what is actually proven.
  9. Note stale tests whose names or fixtures no longer match current behavior.
  1. Identify gaps.
  2. Entire routes, features, services, packages, commands, jobs, or integration boundaries with no tests.
  3. Missing critical path tests.
  4. Tests that only render or call code without meaningful assertions.
  5. Tests that mock away the behavior they claim to cover.
  6. Missing negative/error/permission tests.
  7. Missing tenant/ownership/role boundary tests.
  8. Missing validation, pagination, sorting, filtering, time zone, race/idempotency, retry, or empty-state tests.
  9. Missing regression test for a fixed bug.
  10. Missing contract tests for API/schema/client changes.
  11. Missing docs/example tests when examples are part of the user contract.
  12. Missing migration/backward-compatibility tests when data shape changes.
  1. Verify safely.
  2. Run focused test discovery or relevant existing tests when quick and repo-conventional.
  3. Use test list commands, grep/search, typecheck, lint, or focused test files as appropriate.
  4. Do not install dependencies, start long-running services, or run expensive full suites unless the user asks or the repo clearly expects it.
  5. Never run a command that writes into the repository as a side effect. python -m compileall and py_compile emit .pyc files, formatters rewrite sources, and installers touch lockfiles. .pyc output is usually gitignored, so git status will look clean while the tree has in fact been modified. Prefer checks that write nothing, and if a language offers no read-only check, say so under checks skipped.
  6. Record checks run and skipped.

Severity Rubric

Evidence Standards

Report Format

Use this structure unless the user asks otherwise:

**Test Gap Audit: <scope>**

No code changed. I reviewed <brief scope>, existing tests, and repo test conventions. <verification summary>. No P0s found / P0s found: <count>.

1. **P1: <gap title>.**
   Gap: <behavior or risk not covered>.
   Current coverage: <what existing tests cover or why none were found>.
   Evidence: code `<path>:<line>`; tests `<path>:<line>` or "no direct tests found in <area>".
   Suggested test: <specific test level, file/location, scenario, and key assertions>.

2. **P2: <gap title>.**
   Gap: <missing or weak coverage>.
   Current coverage: <what is currently proven>.
   Evidence: code `<path>:<line>`; tests `<path>:<line>`.
   Confidence: <high/medium/low if inferred>.
   Suggested test: <specific recommendation>.

**Suggested Test Plan**
- <ordered list of concrete tests to add first>

**Untested Or Weakly Tested Areas**
- <for full-repo audits, list important routes/features/services/packages/workflows that lack proper tests, with brief evidence>

**Existing Coverage Worth Keeping**
- <only include useful tests that already protect important behavior>

**Surveyed But Not Deeply Inspected**
- <For full-repo audits only: surfaces that were inventoried but not inspected deeply this pass, and which to run next. Omit this section entirely for scoped audits.>

**Checks Run**
- `<command>`: <result>

**Not Tested**
- <test suites, services, browsers, credentials, or dependency gaps and why>

**Assumptions**
- <only include if useful>

If no meaningful gaps are found, say that clearly, name the strongest coverage observed, and list any residual risk.

Post-Audit Test Implementation

When the user asks to add tests:

Related Skills

This skill is one of seven review skills that share a single report contract: every finding carries a P0-P3 severity and a path:line you can open. docs-sync-audit is the other one in this repository. The remaining five cover launch readiness, security, repo structure, improvement ideas, and pull request communication, at https://github.com/specialone0007/review-skills.

Agent Portability Notes

同类技能
api-securityapk-reverseattack-chainattack-tree-constructionaudit-integrityauth-implementation-patternsbinary-diffbinary-ninja-reverse
本页内容来自开源项目 github, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。