跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

coverage-report

Produce the latest deterministic C0/C1 coverage report for a .NET service. Use when the user asks for a 'coverage report', 'coverage status', 'what's covered', 'C0 C1 numbers', or wants to check the gate. Runs dotnet-coverage + ReportGenerator (numbers are tool output, never estimated), then joins uncovered files against the manifest to explain every inclusion, exclusion, and cannot-test entry. Runnable any time.

livlign · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add livlign/claude-skills --skill coverage-report

技能说明


name: coverage-report description: "Produce the latest deterministic C0/C1 coverage report for a .NET service. Use when the user asks for a 'coverage report', 'coverage status', 'what's covered', 'C0 C1 numbers', or wants to check the gate. Runs dotnet-coverage + ReportGenerator (numbers are tool output, never estimated), then joins uncovered files against the manifest to explain every inclusion, exclusion, and cannot-test entry. Runnable any time."

coverage-report

Numbers come only from the tool. The model never estimates, infers, or rounds coverage. The model's only role is joining tool output to the manifest's reasons and narrating the observations section.

Read ${CLAUDE_PLUGIN_ROOT}/rules/coverage-report.base.md and the repo's .claude/coverage/refs/coverage-manifest.yml first.

One command, any time

The whole report is one wrapper — no arguments needed (it auto-detects the .sln):

./.claude/coverage/tools/report.sh

It collects coverage, joins it against the manifest, and writes a dated per-run folder .claude/coverage/reports/<YYYY-MM-DD>/ containing REPORT.md, REPORT.html, and CANNOT-TEST.md, then prints the Markdown. It exits non-zero only for a check named in the manifest's gate.enforce (empty by default, so a breach prints as ADVISORY and the script still succeeds); a failing build or test run is fatal regardless, from run-coverage.sh. Each run writes its own dated folder rather than overwriting a fixed path, so prior dates are preserved for comparison; override the date with REPORT_DATE=YYYY-MM-DD to re-emit under a specific day. CANNOT-TEST.md is generated from the manifest cannot_test entries (grouped by blocking construct, each row citing target, reason, and unlock), not hand-written. This is the identical join CI runs — the report a developer sees locally is the report on the PR. When invoked as the coverage-report skill, just run it and surface the result; don't re-derive numbers by hand.

Steps

  1. Run the wrapper. ./.claude/coverage/tools/report.sh (or, before init has copied it, ${CLAUDE_PLUGIN_ROOT}/scripts/report.sh). Pass a solution path or repo-filter only if auto-detect is wrong. If the tools or solution are missing, report that — never fabricate numbers. All numbers come from the tool + the deterministic join in coverage-gate.py; the model does not parse XML or compute percentages.

    The script prints KIT_VERSION=, KIT_DRIFT= and FILE_FILTER= before collecting. Check all three. KIT_DRIFT= is <state> <manifest kit_version> <kit semver>: any state other than current means this repo has not been reconciled against the current kit, and the report carries a note saying so. Surface it in one line and name coverage-redo as what applies it. Do not apply any migration here: a report that quietly changed the measured scope would make its own numbers unreproducible. The one exception is the stale-tool-copy refresh below, which changes no classification. See ${CLAUDE_PLUGIN_ROOT}/MIGRATIONS.md ("Preflight"). Stale tool copies no longer need asking about: report.sh runs kit-sync.py first, which installs the current copies and applies the auto manifest entries, printing [kit-sync] lines for each. Relay those lines and remind the user to COMMIT the changed files, since CI runs the committed copies and not their kit checkout. If the sync printed nothing, the repo was already current. If FILE_FILTER lacks an exclusion for a shared directory that is present in the repo, stop and fix scope.vendored_paths before trusting the number.

  2. Latent bugs are DATA, not narration. The script's report is complete and deterministic (verdict, headline, Do-next, insights, by-bucket, and the red section 7). Suspected bugs frozen by characterization belong in manifest latent_bugs:, where coverage-gate.py renders them as section 7 plus the ACTION REQUIRED banner. Put them there, not in a hand-written section: the report is regenerated on every run, so appended prose is lost, and a defect backlog that evaporates is worse than none. Verify the banner's A/B/C count matches what the backfill found, and add no narrated section of your own.

  3. At baseline only. Write the measured Adjusted overall into baseline.recorded_overall (with basis: in-scope) so it becomes the ratchet floor. Not on ordinary report runs. Stamp baseline.scope_lines at the same time, from the report's "Total lines (Adjusted)" denominator. It is what lets the gate distinguish a real regression from a filter mistake: without it, a scoping error presents as a coverage collapse and the ratchet blames the tests.

Report shape — the Unit Test Report (produced by coverage-gate.py)

Fixed six-section report card. Header carries commit / branch / date / tooling / verdict; coverage is two-pass throughout — Adjusted (target set, the headline + ratchet basis) and Raw (all instrumented), for C0, C1, and Method.

# Unit Test Report — <repo>
<commit · branch · date · tooling · verdict (gate PASS/FAIL · Adjusted C0/C1)>

## 1. Test Results     total / passed / failed / skipped / flaky / duration (from .trx)
## 2. Coverage Summary Raw | Adjusted | Baseline | Δ, for C0 / C1 / Method; + the Gate block
                       (ratchet always; diff-coverage + scope-change guard in PR mode, --base)
## 3. Coverage by Layer columns: Layer | Raw lines | Raw branches | Testable lines |
                       Testable branches | C0 | C1 — where C0/C1 cells are "NN% (covered/total)"
                       over the testable slice (covered counts fold into the cell, no separate
                       covered columns). Rows are
                       human LAYER names (Application/Service — TARGET, Infrastructure/Integration,
                       Presentation/Workers, Models/DTOs, Generated, Non-product) mapped from the
                       m
阅读完整来源 ↗