Skip to content
Back to skills

Coverage Gating

ASecurity

Use when the user asks to check, enforce, or gate test coverage, set a coverage threshold, find untested code, or wants to know why coverage dropped. Triggers: "coverage", "coverage gate", "coverage threshold", "untested code", "pytest-cov", "nyc", "c8", "go test -cover", "fail build under X% coverage".

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 1, 2026
ai-agentsgorails

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 1, 2026

npx -y skills add matthews-wong/claude-code-plugins --skill coverage-gating --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coverage Gating?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coverage Gating
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/matthews-wong-coverage-gating/badge)](https://www.skillsdirectory.com/skills/matthews-wong-coverage-gating)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: coverage-gating
description: >
  Use when the user asks to check, enforce, or gate test coverage, set a
  coverage threshold, find untested code, or wants to know why coverage
  dropped. Triggers: "coverage", "coverage gate", "coverage threshold",
  "untested code", "pytest-cov", "nyc", "c8", "go test -cover", "fail build
  under X% coverage".
---

# Coverage Gating

Measure test coverage, compare it to a threshold, and turn the result into an
actionable verdict. Coverage is a floor for confidence, not a proof of
correctness — treat a passing gate as "no obvious untested paths," not "bug-free."

## Quick workflow

1. Pick the threshold: CLI arg > `COVERAGE_THRESHOLD` env > project config > 80.
2. Run `sh "${CLAUDE_PLUGIN_ROOT}/scripts/coverage.sh"`. It auto-detects the
   toolchain and prints `COVERAGE_TOTAL=<n>`.
3. Compare total to threshold. Report PASS/FAIL with the gap and the
   least-covered files.

## Choosing a threshold honestly

- 100% is rarely worth it; 70-85% line coverage is a common enterprise floor.
- Prefer a **ratchet**: never let coverage fall below its current value, and
  raise the floor as it improves. Avoid a hard number that blocks unrelated work.
- Gate on **diff/patch coverage** (new code) when possible — it catches
  under-tested changes without penalizing legacy code.

## Reading results well

- Line coverage counts executed lines; branch coverage counts decision paths.
  Branch coverage is the stronger signal — a line can run without its
  false-branch ever being tested.
- A high total can hide a critical untested module. Always name the
  lowest-covered files, not just the aggregate.

## Tool specifics and CI wiring

See `./reference/tooling.md` for exact commands, config keys, and CI examples
for pytest-cov, nyc/c8, and Go.

## Guardrails

- The gate is advisory unless the user wires it into CI. The provided hook and
  script never block; they inform.
- Never fabricate a percentage. If the script reports `unknown`, say the tool or
  report was not found and suggest how to enable it.

Files in this skill

  • SKILL.md2 KB
  • reference/tooling.md1.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…