crap

Installation
SKILL.md

CRAP — Change Risk Anti-Patterns

CRAP is a single number per function that says: "how dangerous is this code to change?" It fuses cyclomatic complexity (CC) and test coverage so that a function is only "safe" when it's either simple OR thoroughly tested (ideally both). High complexity with low coverage explodes the score.

Principle #10 (Agents drift, gates don't) — CRAP is one of the gates an autonomous loop cannot self-grade around. Wire it as a TaskCompleted hook so a teammate or nightshift agent can't mark work done while leaving a function above threshold. See /principles.

The formula

CRAP(f) = CC(f)^2 × (1 − coverage(f)/100)^3 + CC(f)

Implications worth holding in your head:

  • At 100% coverage, CRAP = CC — coverage cancels the squared term, so the floor is just the function's complexity.
  • At 0% coverage, CRAP = CC² + CC — a CC of 6 → 42, a CC of 10 → 110. Untested branchy code is catastrophic.
  • The cubic on the gap means even small coverage drops on complex functions hurt fast: CC=8 at 80% coverage = 8.5; at 50% = 16; at 0% = 72.

Targets (Uncle Bob, April 2026)

Installs
2
Repository
jonmumm/skills
GitHub Stars
2
First Seen
May 1, 2026
crap — jonmumm/skills