Agent skill · Testing & QA

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.

dotnetgithub.com/dotnetGitHub ↗
claude-codeMIT
Install
npx skills add dotnet/skills --skill crap-score --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 9 KB
Bundled scripts: none
Path: plugins/dotnet-test/skills/crap-score/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 4,927
Language: C#
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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

What's inside
Steps it walks through
  1. Background
  2. When to Use
  3. When Not to Use
  4. Inputs
  5. Workflow
  6. Step 1: Collect code coverage data
  7. Step 2: Compute cyclomatic complexity
  8. Step 3: Extract per-method coverage from Cobertura XML
  9. Step 4: Calculate CRAP scores
  10. Step 5: Present results
  11. Step 6: Provide actionable recommendations
  12. Validation
  13. Common Pitfalls
More from skills
All skills →
About this skill
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.

Keep going