crap-score
Calculates targeted CRAP (Change Risk Anti-Patterns) scores for a named .NET method, class, or single source file. Use when the user explicitly asks to compute CRAP scores or assess risky untested code for a specific target, combining Cobertura coverage data with cyclomatic complexity analysis. DO NOT USE FOR: project-wide coverage analysis, coverage plateau or "stuck coverage" diagnosis, what's blocking coverage, or where to add tests across a project (use coverage-analysis); writing tests; running tests without CRAP context.
npx skills add dotnet/skills --skill crap-score --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# CRAP Score Analysis Calculate CRAP (Change Risk Anti-Patterns) scores for .NET methods to identify code that is both complex and undertested. ## Background The CRAP score combines **cyclomatic complexity** and **code coverage** into a single metric: $$\text{CRAP}(m) = \text{comp}(m)^2 \times (1 - \text{cov}(m))^3 + \text{comp}(m)$$ Where: - $\text{comp}(m)$ = cyclomatic complexity of method $m$ - $\text{cov}(m)$ = code coverage ratio (0.0 to 1.0) of method $m$ | CRAP Score | Risk Level | Interpretation | |------------|------------|----------------| | < 5 | Low | Simple and well-tested | | 5-15 | Moderate | Acceptable for most code | | 15-30 | High | Needs more tests or simplification | | > 30 | Critical | Refactor and add coverage urgently | A method with 100% coverage has CRAP = complexity (the minimum). A method with 0% coverage has CRAP = complexity^2 + complexity. ## When to Use - User wants to assess which methods are risky due to low coverage and high complexity - User asks for CRAP score of specific methods, classes, or files - User wants to prioritize which code to test next - User wants to evaluate test quality beyond simple coverage percentages ## When Not to Use - User
- Background
- When to Use
- When Not to Use
- Inputs
- Workflow
- Step 1: Collect code coverage data
- Step 2: Compute cyclomatic complexity
- Step 3: Extract per-method coverage from Cobertura XML
- Step 4: Calculate CRAP scores
- Step 5: Present results
- Step 6: Provide actionable recommendations
- Validation
- Common Pitfalls
What does the crap-score skill do?
Calculates targeted CRAP (Change Risk Anti-Patterns) scores for a named .NET method, class, or single source file. Use when the user explicitly asks to compute CRAP scores or assess risky untested code for a specific target, combining Cobertura coverage data with cyclomatic complexity analysis. DO NOT USE FOR: project-wide coverage analysis, coverage plateau or "stuck coverage" diagnosis, what's blocking coverage, or where to add tests across a project (use coverage-analysis); writing tests; running tests without CRAP context.
How do I install it?
Run `npx skills add dotnet/skills --skill crap-score --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
