crap-analysis

crap-analysis is a skill for Claude Code, Codex from ComeOnOliver/skillshub. It costs 45 tokens per session (2,773 once invoked), scanned C, a copy of crap-analysis, MIT.

A code-risk check that combines test coverage with cyclomatic complexity, which measures how many decision paths code has. Its CRAP score highlights code that is complex and poorly tested.

In plain words
What is it for?
Use it to collect .NET coverage data, generate risk reports, set coverage checks in CI/CD, and identify code needing tests or simplification.
Why use it?
It helps you find the parts of a codebase most likely to break when changed. This gives testing and refactoring a clearer priority.

Skill for Claude CodeCodex

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

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.

agentmods
npx agentmods add skills/comeonoliver/skillshub/crap-analysis
Any agent
npx skills add ComeOnOliver/skillshub --skill crap-analysis
Clone the repo
git clone --depth 1 https://github.com/ComeOnOliver/skillshub

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-analysis

README.md
[![agentmods](https://agentmods.dev/badge/skills/comeonoliver/skillshub/crap-analysis.svg)](https://agentmods.dev/skills/comeonoliver/skillshub/crap-analysis)
Your own site
<a href="https://agentmods.dev/skills/comeonoliver/skillshub/crap-analysis"><img src="https://agentmods.dev/badge/skills/comeonoliver/skillshub/crap-analysis.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,773 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00045 $0.02773
Opus 5 $0.00023 $0.01386
Sonnet 5 $0.00009 $0.00555
Haiku 4.5 $0.00005 $0.00277

Measured 6d ago against content hash af6a151d22f4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade C, and why

crap-analysis scanned grade C with 1 finding 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 6d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf coverage/ TestResults/
Origin

This is a copy

100% identical to crap-analysis — 1 line differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/Aaronontheweb/dotnet-skills/crap-analysis/SKILL.md · 389 lines

How it starts

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

CRAP Score Analysis

When to Use This Skill

Use this skill when:

  • Evaluating code quality and test coverage before changes
  • Identifying high-risk code that needs refactoring or testing
  • Setting up coverage collection for a .NET project
  • Prioritizing which code to test based on risk
  • Establishing coverage thresholds for CI/CD pipelines

What is CRAP?

CRAP Score = Complexity x (1 - Coverage)^2

The CRAP (Change Risk Anti-Patterns) score combines cyclomatic complexity with test coverage to identify risky code.

CRAP Score Risk Level Action Required
< 5 Low Well-tested, maintainable code
5-30 Medium Acceptable but watch complexity
> 30 High Needs tests or refactoring

Why CRAP Matters

  • High complexity + low coverage = danger: Code that's hard to understand AND untested is risky to modify
  • Complexity alone isn't enough: A complex method with 100% coverage is safer than a simple method with 0%
  • Focuses effort: Prioritize testing on complex code, not simple getters/setters

CRAP Score Examples

Method Complexity Coverage Calculation CRAP
GetUserId() 1 0% 1 x (1 - 0)^2 1
ParseToken() 54 52% 54 x (1 - 0.52)^2 12.4
ValidateForm() 20 0% 20 x (1 - 0)^2 20
ProcessOrder() 45 20% 45 x (1 - 0.20)^2 28.8
ImportData() 80 10% 80 x (1 - 0.10)^2 64.8

Coverage Collection Setup

coverage.runsettings

Create a coverage.runsettings file in your repository root. The OpenCover format is required for CRAP score calculation because it includes cyclomatic complexity metrics.

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat code coverage">
        <Configuration>
          <!-- OpenCover format includes cyclomatic complexity for CRAP scores -->
          <Format>cobertura,opencover</Format>

          <!-- Exclude test and benchmark assemblies -->
          <Exclude>[*.Tests]*,[*.Benchmark]*,[*.Migrations]*</Exclude>

          <!-- Exclude generated code, obsolete members, and explicit exclusions -->
          <ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>

          <!-- Exclude source-generated files, Blazor generated code, and migrations -->
          <ExcludeByFile>**/obj/**/*,**/*.g.cs,**/*.designer.cs,**/*.razor.g.cs,**/*.razor.css.g.cs,**/Migrations/**/*</ExcludeByFile>

          <!-- Exclude test projects -->
          <IncludeTestAssembly>false</IncludeTestAssembly>

          <!-- Optimization flags -->
          <SingleHit>false</SingleHit>
          <UseSourceLink>true</UseSourceLink>
          <SkipAutoProps>true</SkipAutoProps>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

Read the full file on GitHub · 389 lines

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. 6d ago First seen · 389 lines · 45 tokens per session scan C af6a151d22f4

Subscribe to this mod's changes

crap-analysis is a skill published in the GitHub repository ComeOnOliver/skillshub (63 stars, last pushed 2mo ago), licensed MIT. It adds 45 tokens to every session and 2,773 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). It is 100% identical to crap-analysis, differing in 1 line, and is treated as a copy.