coverage-analysis

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

1|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/D1ssolve/craft-agents --skill coverage-analysis-d1ssolve
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coverage-analysis
Source: https://github.com/D1ssolve/craft-agents/tree/main/skills/coverage-analysis
Command: npx skills add https://github.com/D1ssolve/craft-agents --skill coverage-analysis-d1ssolve

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, why coverage has plateaued, or which methods are dangerous to refactor. This Skill turns a .NET solution or existing Cobertura XML into a prioritized risk-hotspot list using CRAP (Change Risk Anti-Patterns) scores. ## Core Features & Use Cases - CRAP Score Analysis: Computes CRAP = complexity² × (1 − coverage)³ + complexity per method and surfaces the top risk hotspots — complex code with low coverage. - Automated Coverage Collection: Auto-detects the coverage provider (coverlet.collector or Microsoft.Testing.Extensions.CodeCoverage), adds one if missing, and runs dotnet test with Cobertura output — no runsettings files needed. - Coverage Gap & Plateau Diagnosis: Extracts per-method coverage below thresholds, assigns HIGH/MED/LOW priorities, and identifies what is blocking coverage gains. - Use Case: Your project's line coverage is stuck at 72% and you don't know why. Run this Skill to get a ranked table showing that ProcessOrder has a CRAP score of 48 (complexity 12, 20% coverage), plus concrete recommendations on which tests to write next. ## Quick Start Analyze the code coverage and CRAP risk hotspots for the .NET solution in the current directory and tell me which methods are blocking coverage improvement.

Frequently Asked Questions about coverage-analysis

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

FAQPage Schema
How do I analyze code coverage and CRAP scores in a .NET project?

Point the Skill at your .NET solution or project path and it runs dotnet test with coverage collection, then computes CRAP scores per method from the Cobertura XML. You get a ranked risk hotspot table showing complex, under-tested methods.

What is a CRAP score and how is it calculated?

CRAP (Change Risk Anti-Patterns) combines cyclomatic complexity and coverage: CRAP = complexity² × (1 − coverage)³ + complexity. Scores above 30 need immediate attention, 15–30 are moderate, and 5 or below is generally safe.

Does it work with coverlet and Microsoft CodeCoverage providers?

Yes, it auto-detects coverlet.collector and Microsoft.Testing.Extensions.CodeCoverage per test project and picks the right dotnet test arguments. Mixed-provider solutions run per-project to avoid dual-provider conflicts, and projects with no provider get one added automatically.

Can I analyze existing Cobertura XML without running tests?

Yes, supply a path to an existing coverage.cobertura.xml file and the Skill skips test execution entirely. It runs the analysis scripts directly on your data and returns the CRAP hotspot summary without installing ReportGenerator.

Why did coverage collection produce no Cobertura XML?

This usually happens when the test project lacks a coverage provider or dotnet add package failed due to no internet access. Check for binary .coverage files as an indicator, and ensure coverlet.collector or Microsoft.Testing.Extensions.CodeCoverage is referenced.

When should I use crap-score instead of coverage-analysis?

Use crap-score for targeted single-method CRAP analysis. Use coverage-analysis for project-wide coverage diagnosis, plateau investigation, and ranked risk hotspot lists across an entire solution.