agentleFS
khivikhivi/cockpit/.claude/skills/coverage-audit/SKILL.md

coverage-audit

Skill0 starsChanged 41 days agoMITView on GitHub

Audit the nightly coverage.yml run for real test gaps, separating deliberate I/O shims from genuine ones. TRIGGER on "audit coverage", "coverage gaps", "what isn't tested".

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Not for this: running the suite locally (pytest -n auto --cov --cov-report=term-missing), reading a single percentage (the run's job …

    line 15
  2. Distinctive:

    Never dispatch a fresh one.

    line 21
  3. Distinctive:

    Use the run log, not the run's job summary (a markdown table with percentages but no line numbers) and not Codecov's raw upload payload …

    line 37
  4. Very specific:

    Do not: add # pragma: no cover. The tree has zero of them — exclusions go in pyproject.toml's [tool.coverage.report] exclude_also as a …

    line 85

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

coverage-audit

Answers what should I test next, from the nightly run. It does not answer did coverage drop — that is COVERAGE_FLOOR (which fails the run) and Codecov's per-commit delta.

Not for this: running the suite locally (pytest -n auto --cov --cov-report=term-missing), reading a single percentage (the run's job summary has it), or writing tests for a change you just made.

Read last night's run

Never dispatch a fresh one. The nightly already ran, and a re-run costs ~90s for numbers that only move when main does.

gh run list --workflow=coverage.yml --branch main --status success -L1 \
  --json databaseId,headSha,createdAt

Then the per-file table with missed line numbers:

gh run view <run-id> --log 2>/dev/null \
  | sed -n 's/^coverage\tRun suite with coverage\t[^ ]* //p' \
  | awk '/^Name .*Stmts/,/^Required test coverage/'

Use the run log, not the run's job summary (a markdown table with percentages but no line numbers) and not Codecov's raw upload payload (the same data wrapped in an envelope that needs stripping before it parses).

Check staleness before reading anything

Compare the run's headSha against origin/main. If main has moved, the report describes an older tree: its line numbers point into files that have since shifted, so a "gap" may be code that no longer exists.

git rev-parse origin/main

Say so up front when it is stale. Do not silently audit a stale report, and do not fix it by dispatching a run — offer that as the user's call.

Classify every miss before proposing a single test

coverage.yml reserves headroom for thin I/O shims the suite does not cover on purpose. Proposing tests for those is the failure mode this skill exists to prevent — they look like the worst files in the report because they are small and almost entirely uncovered.

DeliberateEvidence
A main() reading stdinstatusline.py — 8 of 13 statements, the whole body
Pidfile acquisitionlib/daemon.py:23-32
An interactive input()named in coverage.yml's COVERAGE_FLOOR comment

That list is not closed. Read coverage.yml's COVERAGE_FLOOR comment each time — it is the authority, and it is a workflow comment nobody opens during an audit, which is why it gets re-litigated.

A miss is a real gap when the uncovered lines carry a decision: a branch, a guard, an error path, a fallback. Rank those by what breaks if they are wrong, not by percentage — lib/gh.py at 81% with 84 missed statements of PR-join logic outranks a 38% file that is one stdin read.

Never weaken the check

Three moves are banned, and an agent told "improve coverage" reaches for all three. The PreToolUse hook blocks skip/xfail literals under tests/; nothing blocks the first two, so they are this skill's responsibility.

  • Do not lower COVERAGE_FLOOR in .github/workflows/coverage.yml. Raising it when measured has moved up is sanctioned by the file itself; lowering it because a run failed is the config-edit form of --no-verify.
  • Do not add # pragma: no cover. The tree has zero of them — exclusions go in pyproject.toml's [tool.coverage.report] exclude_also as a pattern, and never in the same change as whatever tripped the floor.
  • Do not skip or xfail a test to move the number.

Propose tests. If a line is genuinely unreachable, propose the exclude_also pattern and say why, but leave the call to the user.

Report

Real gaps ranked, deliberate misses as a bare count. Cap the list at five and give the remainder as a number. When nothing survives classification, say "no real gaps" — promoting a shim to fill the section is how this stops carrying signal.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.