Detect and prevent lazy rewrites, skipped reads, and untested commits.
Install all quality hooks with one command:
npx cc-safe-setup --install-example overwrite-guard
npx cc-safe-setup --install-example full-rewrite-detector
npx cc-safe-setup --install-example diff-size-guard
npx cc-safe-setup --install-example commit-quality-gate
npx cc-safe-setup --install-example push-requires-test-pass
npx cc-safe-setup --install-example pre-compact-checkpoint
| Hook | Detects | Action |
|---|---|---|
overwrite-guard | Writing to existing files without reading first | Warning |
full-rewrite-detector | Rewriting >80% of a file when partial edit would suffice | Warning |
diff-size-guard | Too many files changed without committing | Warning / Block |
commit-quality-gate | Empty or vague commit messages | Block |
push-requires-test-pass | Pushing without running tests | Block |
pre-compact-checkpoint | Context compaction about to happen | Auto-save |
Claude Code can produce excellent work, but it can also take shortcuts:
Hooks don't fix the model. They provide a safety net that catches quality issues before they reach your codebase.
# diff-size-guard: change file count thresholds
export CC_DIFF_WARN=5 # warn at 5+ files changed
export CC_DIFF_BLOCK=20 # block at 20+ files changed
# Search by keyword
npx cc-safe-setup --examples quality
npx cc-safe-setup --examples overwrite
npx cc-safe-setup --examples diff
npx cc-safe-setup --examples commit
Or use the Hook Selector to get a personalized recommendation in 5 questions.