crap-score

crap-score is a skill for Claude Code, Codex from managedcode/dotnet-skills. It costs 99 tokens per session (2,928 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…

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.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.svg" alt="Measured on agentmods" 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 2,928 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.
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.02928
Opus 5 $0.00049 $0.01464
Sonnet 5 $0.00020 $0.00586
Haiku 4.5 $0.00010 $0.00293

Measured yesterday against content hash 4254327d4d22, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 yesterday.

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 · 226 lines

How it starts

The opening of the file, as written. The whole thing — 226 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-agent)
  • 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 no coverage data exists yet, classify the test project first. For SDK-style projects, run dotnet test with coverage collection. For classic non-SDK projects (ToolsVersion, explicit compile items, or packages.config), use only a repository-provided coverage command that emits Cobertura. If none exists, ask for Cobertura XML and stop; do not migrate the project or inject an SDK-style coverage package. CRAP scores always require real coverage data.

Read the full file on GitHub · 226 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. yesterday Changed · +34 lines 4254327d4d22
  2. 3d 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 (477 stars, last pushed yesterday), licensed MIT. It adds 99 tokens to every session and 2,928 once invoked, about $0.0005 per session on Opus 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.

Related

Other skills, from other repositories

rust-development

Idiomatisk Rust-utvikling med cargo, clippy, error handling, async/tokio, unsafe og testing.

navikt/copilot · 27 tokens

author-test

Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.

Azure/azure-sdk-for-net · 68 tokens

winui-ui-testing

Automated UI testing for Windows desktop apps — generate a batch test script with the winapp ui UI Automation harness, run all tests in one pass, read results. Covers element assertions, interactions, value checking (TextBox, ComboBox, ToggleSwitch), keyboard shortcuts and typing (send-keys), hover, drag-and-drop…

microsoft/win-dev-skills · 122 tokens

testing-strategies

Comprehensive testing strategy covering unit, integration, e2e, property-based, and mutation testing with practical patterns.

cosmicstack-labs/mercury-agent-skills · 27 tokens

maui-unit-testing

Add MAUI app tests around ViewModels, services, platform abstractions, and unit/integration/device boundaries. USE FOR: xUnit, avoiding MauiProgram.CreateMauiApp in unit tests, fakes/mocks, injectable Essentials interfaces, PlatformNotSupportedException, navigation/data services, AppProjectReference, device-test…

dotnet/maui-labs · 84 tokens

check-coverage

Comprehensive assessment of Unit / Integration / E2E three-layer test coverage, identify gaps and provide actionable recommendations.

sd0xdev/sd0x-harness · 27 tokens