coverage-analyzer
Skill6 starsChanged 3 months agoMITView on GitHub
Parse coverage.py XML reports (coverage.xml) into a human-readable coverage analysis: total line/branch percent, files with zero coverage, worst-10 ranking, delta vs a stored JSON baseline, and a PASS/FAIL verdict against an optional threshold. Stdlib-only Python script (xml.etree.ElementTree, json, argparse) that closes the loop after test-generator.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- kanopi/cms-cultivatortheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- kanopi/cms-cultivator★ 17same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- skills/chronos/references/AGENTS.mdAGENTS.md
- api-contract-testingSkill
- api-doc-generatorSkill
- canonSkill
- censorSkill
- changelog-generatorSkill
- chronosSkill
- code-reviewSkill
- commit-lintSkill
- commit-message-writerSkill
- csv-proSkill
- data-analysisSkill
- deweySkill
- diagram-makerSkill
- doc-compareSkill
- docs-productSkill
- docs-projectSkill
- docs-systemSkill
- dsh-runnerSkill
- frontend-a11ySkill
- frontend-design-tasteSkill
- frontend-perfectionSkill
- frontend-performanceSkill
- frontend-testingSkill
- github-repo-hygieneSkill
- long-running-agent-workflowSkill
- mermaid-to-imageSkill
- mobile-frontendSkill
- pdf-report-builderSkill
- plan-skillSkill
- prd-to-appSkill
- presentation-craftSkill
- presentation-engineeringSkill
- presentation-makerSkill
- raster-to-svgSkill
- reddit-karmaSkill
- repo-community-filesSkill
- repo-metadata-healthSkill
- repo-readme-assetsSkill
- repo-social-previewSkill
- secret-scannerSkill
- security-reviewSkill
- seo-auditSkill
- seo-contentSkill
- seo-crawlSkill
- seo-schemaSkill
- seo-toolkitSkill
- skill-feedbackSkill
- skill-forgeSkill
- skill-suggesterSkill
- sql-helperSkill
- systematic-debuggerSkill
- test-generatorSkill
- test-graphicsSkill
- velesSkill
- version-bumperSkill
- video-script-writerSkill
- web-replicationSkill
- web-scraperSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
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
- Distinctive: line 79
Commit the baseline file so it is reviewable.
- Very specific: line 94
Use it as the last step of a test job: the script exits 1 when the total line-rate percent is below the threshold, failing the pipeline.
- Very specific: line 166
Do not use to generate tests or diagnose a failing test.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Coverage Analyzer — coverage.py XML → readable analysis
Load this skill when you need to turn a coverage.xml report into a
human-readable coverage analysis: overall line/branch percent, files with
zero coverage, the 10 worst-covered files, a delta vs a previously stored
baseline, and a PASS/FAIL verdict against a threshold for CI.
The analyzer is pure Python 3 stdlib (xml.etree.ElementTree, json,
argparse) — no dependencies, no network. It reads the exact XML format that
coverage.py emits via coverage xml
(Cobertura-style DTD), so it works with any tool that produces that format
(pytest-cov --cov-report=xml, coverage run -m pytest && coverage xml).
The analyzer script
scripts/coverage_analyzer.py — pure Python 3 stdlib (no dependencies).
| Mode | Command |
| Basic analysis | python3 coverage_analyzer.py --xml coverage.xml |
| Delta vs stored baseline | python3 coverage_analyzer.py --xml coverage.xml --baseline baseline.json |
| Threshold gate (CI) | python3 coverage_analyzer.py --xml coverage.xml --threshold 80 |
| Store current totals as baseline | python3 coverage_analyzer.py --xml coverage.xml --save-baseline baseline.json |
Output sections
- Total —
line-rate(andbranch-ratewhen branches were actually measured; abranch-rate="0"withbranches-valid="0"is treated as "not measured", not as 0%), file count,files_with_zero_lines(files with line-rate == 0) with their names - Worst 10 files — lowest line-rate first, ascending
- Delta vs baseline — per-file
before → after → Δtable plus atotalrow; files absent from the baseline are markednew - Verdict —
PASS/FAILwhen--thresholdis given
Exit codes
| Code | Meaning |
0 | analysis succeeded (threshold PASS, or no threshold) |
1 | parse/read error, or threshold FAIL |
2 | internal error |
Usage example (typical)
# 1. Produce the XML (coverage.py installed):
coverage run -m pytest && coverage xml
# 2. Analyze:
python3 coverage_analyzer.py --xml coverage.xml
# 3. Store a baseline on the first run:
python3 coverage_analyzer.py --xml coverage.xml --save-baseline baseline.json
# 4. On later runs, diff against the baseline and gate CI:
python3 coverage_analyzer.py --xml coverage.xml --baseline baseline.json --threshold 80Baseline tracking workflow
- First run —
--save-baseline baseline.jsonwrites{"files": [{"name": "...", "line_rate": 0.42}, ...], "total": 0.42}. Commit the baseline file so it is reviewable. - Later runs —
--baseline baseline.jsonprints a per-filebefore → after → Δtable. A file that appears in the current report but not in the baseline is markednew; a file that disappeared is simply absent from the table. - Trend — the
totalrow shows the overall delta in percentage points, so a regression (e.g.-5.0 pp) is visible at a glance.
Threshold gate for CI
python3 coverage_analyzer.py --xml coverage.xml --threshold 80
echo "exit=$?" # 0 = PASS, 1 = FAILUse it as the last step of a test job: the script exits 1 when the total
line-rate percent is below the threshold, failing the pipeline. This closes
the loop after test-generator — generate tests, measure coverage, gate on
the result.
Do NOT use
- If you don't have a
coverage.xml— this skill only parses the coverage.py XML format; it does not run your tests or measure coverage itself. Runcoverage run -m pytest && coverage xml(orpytest --cov) first. - If you want branching visualization (branch-by-branch coverage maps,
HTML reports with per-line coloring) — use coverage.py's own
coverage html/coverage reportor a dedicated coverage UI. This tool is a text/markdown summary + CI gate, not a visualizer. - If your report is in a different format (lcov, JaCoCo, Cobertura from other tools) — the parser targets the coverage.py XML schema; other Cobertura-style files may parse but attribute names differ.
Canonical patterns
Full deep dive with upstream sources in references/canonical-patterns.md.
Key canons:
- coverage.py XML schema (Ned Batchelder) — the
line-rate/branch-rateattribute semantics this tool parses verbatim - Cobertura DTD — the XML shape coverage.py emits (
<coverage>,<packages>,<classes>,<lines>) - pytest-cov — the
--cov-report=xmlpipeline that produces the input - codecov / coveralls — the baseline-diff + threshold-gate CI model
- coverage-badge — the "percent → verdict" rendering idea (we stay text)
Files
SKILL.md— this fileskill.json— manifestscripts/coverage_analyzer.py— the stdlib analyzer (XML parse + baseline diff + threshold gate)references/canonical-patterns.md— coverage.py/pytest-cov/codecov/ coveralls/coverage-badge deep dive with sources
Canonical analogues
Full source depth — in references/canonical-patterns.md. Backbone:
<table>
<tr><th>Analog</th><th>What we borrow</th></tr>
<tr><td>coverage.py (Ned Batchelder, Apache-2.0)</td><td>XML schema, <code>line-rate</code>/<code>branch-rate</code> semantics, <code>coverage xml</code> output</td></tr>
<tr><td>pytest-cov</td><td>Test-runner integration path (<code>--cov-report=xml</code>) that produces the input</td></tr>
<tr><td>codecov / coveralls</td><td>Baseline-diff + trend + threshold-gate CI model (we stay offline, no upload)</td></tr>
<tr><td>coverage-badge</td><td>Rate → verdict/badge conversion (we emit PASS/FAIL text instead of an SVG)</td></tr>
</table>Installation
# For opencode
cp -r skills/coverage-analyzer ~/.config/opencode/skills/
# For other agents
# Copy the skill folder to your skills directory; requires Python 3.Note: this tool analyzes, it does not generate tests or coverage. It expects a real
coverage.xmlproduced by coverage.py (or a compatible tool) and reports what the numbers mean — including a CI exit-code gate so coverage regressions fail the build.
Boundaries
- Do not use to generate tests or diagnose a failing test; use
test-generatororsystematic-debugger.
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
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.

