Tooluck logoTooluck
SKILL.md

crap-analysis

Agent skill fromAaronontheweb/dotnet-skills

Analyze code coverage and CRAP (Change Risk Anti-Patterns) scores to identify high-risk code. Use OpenCover format with ReportGenerator for Risk Hotspots showing cyclomatic complexity and untested code paths.

How to install crap-analysis

install crap-analysis
# install the dotnet-skills pack with the skills CLI
npx skills add Aaronontheweb/dotnet-skills

# or add only this skill to Claude Code: copy the folder

skills/crap-analysis/

# into

~/.claude/skills/crap-analysis/ (all projects)

.claude/skills/crap-analysis/ (one project)

skills/crap-analysis/SKILL.md

MITFull file
1# CRAP Score Analysis
2
3## When to Use This Skill
4
5Use this skill when:
6- Evaluating code quality and test coverage before changes
7- Identifying high-risk code that needs refactoring or testing
8- Setting up coverage collection for a .NET project
9- Prioritizing which code to test based on risk
10- Establishing coverage thresholds for CI/CD pipelines
11
12---
13
14## What is CRAP?
15
16**CRAP Score = Complexity x (1 - Coverage)^2**
17
18The CRAP (Change Risk Anti-Patterns) score combines cyclomatic complexity with test coverage to identify risky code.
19
20| CRAP Score | Risk Level | Action Required |
21|------------|------------|-----------------|
22| **< 5** | Low | Well-tested, maintainable code |
23| **5-30** | Medium | Acceptable but watch complexity |
24| **> 30** | High | Needs tests or refactoring |
25
26### Why CRAP Matters
27
28- **High complexity + low coverage = danger**: Code that's hard to understand AND untested is risky to modify
29- **Complexity alone isn't enough**: A complex method with 100% coverage is safer than a simple method with 0%
30- **Focuses effort**: Prioritize testing on complex code, not simple getters/setters
31
32### CRAP Score Examples
33
34| Method | Complexity | Coverage | Calculation | CRAP |
35|--------|------------|----------|-------------|------|
36| `GetUserId()` | 1 | 0% | 1 x (1 - 0)^2 | **1** |
37| `ParseToken()` | 54 | 52% | 54 x (1 - 0.52)^2 | **12.4** |
38| `ValidateForm()` | 20 | 0% | 20 x (1 - 0)^2 | **20** |
39| `ProcessOrder()` | 45 | 20% | 45 x (1 - 0.20)^2 | **28.8** |
40…

Excerpt shown under the repository's MIT license.

More skills in dotnet-skills

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

nexu-io /

open-design
107k

The 1st Collaborative AI Design Agent Workspace. Local-first and open source. Create motion, prototypes, websites, apps, dashboards, presentations, images, and videos with your team and AI agents. Share work, exchange feedback, and iterate together in one workspace.

40 skills

tt-a1i /

archify
95k

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

CCCXOC1 skill

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates