This walks you through setting up CRAP score analysis for .NET projects, which combines cyclomatic complexity with test coverage to find risky code (the formula is complexity times one minus coverage squared). The guide is thorough on the mechanics: you need OpenCover format specifically because it includes complexity metrics, ReportGenerator to build the HTML reports, and a proper runsettings file to exclude generated code and test assemblies. The Risk Hotspots section in the output is what you're after, showing methods with high complexity and low coverage that are dangerous to touch. Useful if you're inheriting a codebase or need to justify where testing effort should go. The threshold recommendations are reasonable: CRAP scores over 30 need immediate attention.

skills.sh installs
581
GitHub stars
1.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add aaronontheweb/dotnet-skills --skill crap-analysis --agent claude-code

Installs into .claude/skills of the current project.

Files

CRAP Score Analysis

When to Use This Skill

Use this skill when:

  • Evaluating code quality and test coverage before changes
  • Identifying high-risk code that needs refactoring or testing
  • Setting up coverage collection for a .NET project
  • Prioritizing which code to test based on risk
  • Establishing coverage thresholds for CI/CD pipelines

What is CRAP?

CRAP Score = Complexity x (1 - Coverage)^2

The CRAP (Change Risk Anti-Patterns) score combines cyclomatic complexity with test coverage to identify risky code.

CRAP ScoreRisk LevelAction Required
< 5LowWell-tested, maintainable code
5-30MediumAcceptable but watch complexity
> 30HighNeeds tests or refactoring

Why CRAP Matters

  • High complexity + low coverage = danger: Code that's hard to understand AND untested is risky to modify
  • Complexity alone isn't enough: A complex method with 100% coverage is safer than a simple method with 0%
  • Focuses effort: Prioritize testing on complex code, not simple getters/setters

CRAP Score Examples

Sponsors

Details

Repository
github.com/aaronontheweb/dotnet-skills
Categories
Testing & QA, Code Review & Quality, .NET & C#
First seen
Jun 3, 2026

More from aaronontheweb/dotnet-skills

All 34
1aaronontheweb avatartestcontainers-integration-testsaaronontheweb/dotnet-skillsWrite integration tests using TestContainers for .NET with xUnit. Covers infrastructure testing with real databases, message queues, and caches in Docker contai579skills.sh installs
2eyadkelleh avatarsecurity-usernameseyadkelleh/awesome-skills-securityTop username lists for enumeration: common usernames, default credentials, names. Curated essentials for authorized testing.577skills.sh installs
3notedit avatarfeature-devnotedit/happy-skillsGuided feature development with codebase understanding and architecture focus. Use for implementing features systematically: explore → clarify → design → implem544skills.sh installs
4longbridge avatarlongbridge-financial-checkuplongbridge/skillsSystematic 100-point financial health scorecard for listed companies via Longbridge — five dimensions: profitability (ROE / net margin / gross margin), growth (515skills.sh installs
5horuz-ai avatarwebsite-clonerhoruz-ai/claude-pluginsAgentic workflow for cloning websites with pixel-perfect fidelity using specialized sub-agents. Use when the user wants to clone/copy/replicate a website, creat509skills.sh installs
6hkuds avatarcli-anything-wiremockhkuds/cli-anythingPython CLI harness for WireMock HTTP mock server administration503skills.sh installs