
crap-score
Calculates CRAP (Change Risk Anti-Patterns) for a named .NET method, class
by dotnetFree
Description
CRAP Score is a .NET agent skill from the dotnet/skills repository that calculates Change Risk Anti-Patterns scores for a named method, class or file. The CRAP metric combines cyclomatic complexity with code coverage: complexity squared times the cube of the uncovered fraction, plus complexity. A method that is both complex and poorly tested gets a high score, which makes the metric a quick way to spot code that is risky to change. The skill is used when someone explicitly asks for a CRAP calculation or for a coverage-and-complexity risk check within a specific scope. It suits developers deciding where to add tests before refactoring, and reviewers who want a number to back up a concern about a particular piece of code.…
Highlights
- CRAP score for a method, class or file
- Combines cyclomatic complexity and coverage
- Highlights complex, undertested code
- Scoped risk checks before refactoring
Ratings & Reviews
No ratings yet
Be the first to rate crap-score.
People also visit

coverage-analysis
Activation requires either supplied .NET coverage reports/percentages/line

dotnet-best-practices
Validate .NET/C# code against comprehensive best practices for your solution

analyzing-dotnet-performance
Scans .NET code for ~50 performance anti-patterns across async, memory, strings
crap-score FAQ
What is a CRAP score?
Change Risk Anti-Patterns: comp(m)^2 x (1 - cov(m))^3 + comp(m), where comp is cyclomatic complexity and cov is coverage from 0 to 1. Higher scores mean complex code with little test coverage.
What scope can it analyze?
A named .NET method, class or file.
When should I use it?
When you explicitly want a CRAP calculation or a coverage-and-complexity risk check for a specific part of your code.
How do I add this skill to my agent?
Use the skills CLI: `npx skills add https://github.com/dotnet/skills --skill crap-score`. This pulls the skill from dotnet/skills on GitHub.
Has the skill been security audited?
Yes. Results shown on skills.sh: Gen Agent Trust Hub: Pass, Socket: Pass, Snyk: Pass.
What are the best crap-score alternatives?
Popular alternatives to crap-score include coverage-analysis, health-check and hook-complexity-monitor. See all crap-score alternatives














