coverage-pr-commentlisted
Install: claude install-skill damson/hard-won-skills
# Coverage comment on a pull request
A coverage comment fails in two ways, and neither one looks like a failure:
1. **It appends instead of editing.** Ten pushes, ten comments, and the review
thread is unreadable. Fixed by a marker and an upsert (step 4).
2. **It reports a number with no verdict.** `47.3%` answers nothing a reviewer
can act on — is that good, is it falling, is it about to break a rule? Fixed
by a delta against the base and a threshold band (steps 2 and 5).
The output is one sticky comment carrying a headline percentage, a bar that
doubles as a diff, a **band line** naming where the project stands, and a
per-metric table with a **status column**.
## Procedure
### 1. Get the numbers
Every stack can emit a machine-readable report. Parse that, never the human
summary — its layout changes between tool versions without notice.
| Stack | Report to generate | Totals live at |
|---|---|---|
| JVM — JaCoCo | `jacocoTestReport` → `jacocoTestReport.xml` | root `<counter type="LINE" missed= covered=>` |
| JS/TS — Istanbul (jest, vitest, nyc) | `--coverage --coverage-reporters=json-summary` | `coverage/coverage-summary.json` → `.total.lines.pct` |
| Python — coverage.py | `coverage xml` | `coverage.xml` (Cobertura) → `line-rate`, `branch-rate` |
| .NET — coverlet | `--collect:"XPlat Code Coverage"` | `coverage.cobertura.xml`, same shape |
| Go | `go test -coverprofile=c.out` then `go tool cover -func=c.out` | the trailing `total:` line |
| Ruby — SimpleCov