crap-score

Calculate CRAP scores for .NET methods using cyclomatic complexity and Cobertura coverage.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/1k-off/umbraco-observability-playground --skill crap-score-1k-off
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crap-score
Source: https://github.com/1k-off/umbraco-observability-playground/tree/main/.agents/skills/crap-score
Command: npx skills add https://github.com/1k-off/umbraco-observability-playground --skill crap-score-1k-off

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you pinpoint change-risk hotspots by identifying .NET code that is both complex and inadequately covered by tests, so refactoring and test investment are targeted instead of guesswork.

Core Features & Use Cases

  • Targeted CRAP scoring: Computes CRAP for a named .NET method, class, or single source file using cyclomatic complexity plus per-method coverage.
  • Coverage-data driven analysis: Requires Cobertura coverage output (or prompts you to run dotnet test with coverage) so scoring is based on real execution data.
  • Actionable prioritization: Produces a sorted results table and specific guidance, including coverage needed to reach CRAP thresholds and when complexity reduction is required.

Quick Start

Ask an AI agent to calculate the CRAP scores for method ProcessOrder in OrderService, using your solution’s test project coverage.

Frequently Asked Questions about crap-score

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate CRAP score for .NET methods using cyclomatic complexity and code coverage?

To calculate CRAP score, combine cyclomatic complexity from decision constructs with per-method line hit rates extracted from Cobertura XML coverage, then compute sorted values to pinpoint risky code.

What is a CRAP score and how does it identify change risk anti-patterns in C# code?

A CRAP score identifies change risk anti-patterns by measuring code that is both highly complex and inadequately tested, targeting refactoring and test investment toward specific risky methods.

Do I need Cobertura XML coverage output to assess .NET test prioritization for complex code?

Yes, you need Cobertura XML coverage output. If missing, you must run dotnet test with coverage collection to extract real execution data and calculate accurate CRAP scores.

Can I analyze a single source file for high cyclomatic complexity and low coverage in .NET?

Yes, you can compute CRAP scores for a named .NET method, class, or single source file by counting decision constructs for complexity and extracting method-level line hit rates.

What's the best way to prioritize test writing for under-tested .NET code paths?

The best way to prioritize test writing is computing sorted CRAP values and following threshold-based recommendations, which specify the exact coverage needed or when complexity reduction is required.

When should I reduce cyclomatic complexity instead of adding more tests to lower CRAP score?

You should reduce cyclomatic complexity instead of adding tests when threshold-based recommendations indicate that complexity reduction is required to lower the CRAP score effectively.