claude-crap

Deterministic Quality Assurance plugin for Claude Code.
Forces the agent through mathematical hooks, CRAP / TDR thresholds,
and SARIF 2.1.0 reports before a single line of code is allowed to
ship.
claude-crap turns Claude Code into a disciplined QA engineer. It
wraps every Write, Edit, and Bash call with a synchronous
PreToolUse gatekeeper, a retrospective PostToolUse verifier,
and a final Stop quality gate that refuses to close a task until
maintainability, reliability, and security ratings pass policy.
Every decision that touches source code must be backed by a result
from the deterministic MCP engines — compute_crap, compute_tdr,
analyze_file_ast, ingest_sarif, score_project, and others.
This is the Fat Platform / Thin Agent thesis: the LLM is an
efficient worker, but the rails are mathematical and outside the
model's reach.
CRAP stands for Change Risk Anti-Patterns — a metric
originally developed by Alberto Savoia and Bob Evans at Google (2007).
Read the original post.
Quick Start · Configuration · How It Works · MCP Tools · Documentation · Contributing
Quick Start
npx claude-crap install
This downloads the package, compiles dist/ from source, creates
.claude-crap/reports/ in your project, and prints the Claude Code
command to register the plugin:
Next steps — pick ONE of the following:
1. Native install:
/plugin install /.../claude-crap
2. Marketplace install:
/plugin marketplace add https://github.com/ahernandez-developer/claude-crap
/plugin install claude-crap@herz
Once registered, open any new session. The SessionStart hook
prints a briefing with thresholds and the dashboard URL. From that
point the PreToolUse gatekeeper and Stop quality gate run
automatically — no further setup required.
Configuration
Default: warn. No config file needed. The Stop gate
shows all violations but lets tasks close. Teams that want
hard enforcement can set "strict" in .claude-crap.json.
The strictness value controls how the Stop gate reacts to failures:
| Mode | Stop exit | Effect |
|---|
strict | 2 | Task cannot close until rules pass. |
warn | 0 | Full verdict visible to agent, but task closes. Default. |
advisory | 0 | Single-line nudge only. |
Override per workspace:
// .claude-crap.json — commit to git for team-wide policy
{
"strictness": "strict"
}
Or per session: CLAUDE_CRAP_STRICTNESS=strict claude
Precedence: env var > .claude-crap.json > hardcoded warn.
See docs/quality-gate.md for the full
CRAP formula, TDR formula, letter ratings, and adoption strategy.
How It Works