coverage-analysis

Analyzes .NET solution-wide test coverage and computes CRAP scores to surface risk hotspots.

Updated May 2, 2026
One-click install
npx skills add https://github.com/hdeshev/pi-config --skill coverage-analysis-hdeshev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coverage-analysis
Source: https://github.com/hdeshev/pi-config/tree/main/agent/skills/coverage-analysis
Command: npx skills add https://github.com/hdeshev/pi-config --skill coverage-analysis-hdeshev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires coverlet.collector, coverlet.msbuild, and includes scripts (resource) and references (resource) components.

What problem does it solve? Raw coverage percentages tell you what code ran, but not which uncovered code is risky, what tests to write next, or why coverage has plateaued. This Skill automates project-wide .NET coverage collection and CRAP (Change Risk Anti-Patterns) scoring so you get a prioritized list of complex, under-tested methods that are dangerous to modify. ## Core Features & Use Cases - Automated coverage collection: Auto-detects solution structure and coverage provider (Microsoft.Testing.Extensions.CodeCoverage or Coverlet), runs dotnet test with Cobertura output, and generates HTML, text, markdown, and CSV reports via ReportGenerator. - CRAP score risk hotspots: Computes CRAP = complexity² × (1 − coverage)³ + complexity per method and surfaces the top-N riskiest methods, plus coverage gaps ranked by priority. - Use Case: Point the Skill at a .NET solution whose coverage has stalled at 65%. It runs the tests, merges coverage across test projects, and returns a report showing that ProcessOrder has complexity 18 with 20% coverage (CRAP 78) — telling you exactly which tests to write first. ## Quick Start Run a coverage analysis with CRAP score hotspots on the .NET solution in the current directory.

Frequently Asked Questions about coverage-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run code coverage analysis on a .NET solution?▼

Run dotnet test with a coverage collector such as coverlet.collector or Microsoft.Testing.Extensions.CodeCoverage, configured to output Cobertura XML. This Skill automates provider detection, test execution, ReportGenerator reports, and CRAP score computation in one workflow.

What is a CRAP score and how is it calculated?▼

CRAP (Change Risk Anti-Patterns) measures how risky a method is to change using the formula complexity² × (1 − coverage)³ + complexity. Scores above 30 need immediate attention, 15–30 are moderate, and 5 or below is generally safe.

Coverlet vs Microsoft.Testing.Extensions.CodeCoverage — which should I use?▼

Both produce Cobertura XML and are supported. The Skill auto-detects which provider each test project references and picks a unified strategy; for mixed solutions it runs per-project to avoid dual-provider conflicts.

Why did dotnet test produce no Cobertura XML coverage file?▼

This usually means the test project lacks a coverage provider package, or Visual Studio's collector emitted binary .coverage files instead. The Skill auto-adds coverlet.collector or Microsoft.Testing.Extensions.CodeCoverage and re-runs with Cobertura format when only binary output is found.

Can I analyze existing coverage data without re-running tests?▼

Yes. If you provide a path to existing Cobertura XML or data already in TestResults/, the Skill skips test execution and provider detection but still runs ReportGenerator and CRAP score computation, since the risk hotspot table is mandatory output.

When should I not use project-wide coverage analysis?▼

Avoid it for targeted single-method CRAP analysis (use the crap-score skill), writing or generating tests, applying test filters, producing TRX reports, or troubleshooting test execution — those belong to the run-tests skill or direct dotnet test usage.