coverage-analysis

Analyzes .NET code coverage and computes CRAP scores to rank risk hotspots per method.

Updated Aug 9, 2026
One-click install
npx skills add https://github.com/adinj00/player-performance --skill coverage-analysis-adinj00
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coverage-analysis
Source: https://github.com/adinj00/player-performance/tree/main/.agents/skills/coverage-analysis
Command: npx skills add https://github.com/adinj00/player-performance --skill coverage-analysis-adinj00

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Raw coverage percentages tell you what code was executed but not which uncovered code is risky to change. This Skill combines line/branch coverage with cyclomatic complexity to compute CRAP (Change Risk Anti-Patterns) scores per method, surfacing the complex, under-tested code that blocks coverage improvement and is dangerous to refactor. ## Core Features & Use Cases - CRAP Score Analysis: Parses Cobertura XML and applies the formula comp² × (1 − cov)³ + comp per method, returning a ranked risk-hotspot table. - Automated Coverage Collection: Detects the coverage provider (Coverlet or Microsoft CodeCoverage) per test project, adds one if missing, and runs dotnet test with Cobertura output — no runsettings files required. - Coverage Gap Reporting: Extracts per-method coverage below configurable thresholds and produces a prioritized markdown report with recommendations. - Use Case: Your project's line coverage has plateaued at 74% and you don't know why. Run this Skill to get the top 10 methods by CRAP score, see exactly which complex methods have near-zero coverage, and receive quantified recommendations for which tests to write next. ## Quick Start Analyze the coverage of my .NET solution in the current directory and show me the top CRAP score risk hotspots.

Frequently Asked Questions about coverage-analysis

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

FAQPage Schema
How do I find which code is blocking my .NET test coverage from improving?

Run a coverage analysis that computes CRAP scores per method from Cobertura XML. Methods with high cyclomatic complexity and low coverage rank highest, showing exactly which methods block coverage gains and where to add tests first.

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 comp² × (1 − cov)³ + comp, where comp is cyclomatic complexity and cov is line coverage. Scores above 30 are widely considered to need immediate attention; scores of 5 or below are generally safe.

Does this work with both Coverlet and Microsoft CodeCoverage?

Yes. The workflow detects which coverage provider each test project references and selects a unified or per-project execution strategy. Mixed solutions using both providers are run per project to avoid dual-provider conflicts, and both produce Cobertura XML.

Can I analyze existing Cobertura XML without running tests again?

Yes. If you supply a path to an existing coverage.cobertura.xml file, or one is found under TestResults/, the test execution phase is skipped entirely and the analysis scripts run directly against the existing data.

Why did my coverage run produce no Cobertura XML files?

The test project may lack a coverage provider, or Visual Studio's collector may have emitted binary .coverage files instead. The workflow auto-adds coverlet.collector or Microsoft.Testing.Extensions.CodeCoverage when missing, but offline environments can cause dotnet add package to fail silently.

When should I not use project-wide coverage analysis?

Avoid it for targeted single-method CRAP analysis, writing or generating tests, or general test execution unrelated to coverage. It identifies where tests are needed but does not write them, and raw dotnet test suffices when you only need a coverage number without CRAP context.