crap-score

crap-score is a skill for Claude Code, Codex from managedcode/dotnet-skills. It costs 99 tokens per session (3,081 once invoked), scanned A, original, MIT.

A calculator for CRAP scores, a measure that combines a .NET method's complexity with its test coverage. It uses the score to describe how risky a named method, class, or file may be to change.

In plain words
What is it for?
Assessing coverage-and-complexity risk and prioritizing tests or refactoring for specific .NET methods, classes, or files.
Why use it?
Complex code with few tests is more likely to hide defects during changes. The score helps focus testing or simplification on the riskiest named areas.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Assessing coverage-and-complexity risk and prioritizing tests or refactoring for specific .NET methods, classes, or files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/managedcode/dotnet-skills/crap-score
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add managedcode/dotnet-skills --skill crap-score
Clone the repo
git clone --depth 1 https://github.com/managedcode/dotnet-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for crap-score

README.md
[![agentmods](https://agentmods.dev/badge/skills/managedcode/dotnet-skills/crap-score/github.svg)](https://agentmods.dev/skills/managedcode/dotnet-skills/crap-score)
Your own site
<a href="https://agentmods.dev/skills/managedcode/dotnet-skills/crap-score"><img src="https://agentmods.dev/badge/skills/managedcode/dotnet-skills/crap-score/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for crap-score

Your own site · 80×15
<a href="https://agentmods.dev/skills/managedcode/dotnet-skills/crap-score"><img src="https://agentmods.dev/badge/skills/managedcode/dotnet-skills/crap-score.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 99 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,081 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00099 $0.03081
Opus 5.5 $0.00040 $0.01232
Sonnet 5.5 $0.00020 $0.00616
Haiku 4.5 $0.00010 $0.00308

Measured 12d ago against content hash dd5a49f1a9a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

crap-score scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

catalog/Testing/Official-DotNet-Test/skills/crap-score/SKILL.md · 245 lines

How it starts

The opening of the file, as written. The whole thing — 245 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 to < 15 Moderate Acceptable for most code
15 to 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 what to test next within a named method, class, or file based on coverage-and-complexity risk
  • User wants to evaluate test quality beyond simple coverage percentages

When Not to Use

  • User just wants to run tests (use run-tests skill)
  • User wants to write new tests (use code-testing)
  • User only wants a coverage percentage without complexity analysis
  • User wants project-wide coverage/CRAP analysis or priorities (use coverage-analysis)

Inputs

Input Required Description
Target scope Yes Method name, class name, or file path to analyze
Test project path No Path to the test project. Defaults to discovering test projects in the solution.
Source project path No Path to the source project under analysis

Workflow

Step 1: Collect code coverage data

If the user supplies a valid Cobertura report that contains the requested target, use it directly and do not rerun tests. If the supplied report is malformed, empty, internally contradictory, or missing the target, treat it as failed input: regenerate it with a repository-compatible command when possible, or request a valid report when collection is unavailable. Otherwise invoke run-tests to classify the repository's test platform and confirm the compatible command shape, then require a command that emits Cobertura:

Read the full file on GitHub · 245 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago Changed dd5a49f1a9a3
  2. 25d ago Changed · +19 lines 71f57c83134b
  3. 1mo ago Changed · +34 lines 4254327d4d22
  4. 1mo ago First seen · 192 lines · 99 tokens per session scan A f8620cb28489

Subscribe to this mod's changes

crap-score is a skill published in the GitHub repository managedcode/dotnet-skills (490 stars, last pushed today), licensed MIT. It adds 99 tokens to every session and 3,081 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.