Skip to content
Swap Meet

Free

No. 008Free

block-destructive: the hook that stops rm -rf and force pushes

A Claude Code PreToolUse hook that blocks rm -rf, force-push, --no-verify and other destructive shell commands before they run. Pattern based, with documented bypasses.

by Lucas Cooper-Bey

About it

One shell script, wired into ~/.claude/settings.json as a PreToolUse hook. It reads each Bash command Claude Code is about to run and refuses the destructive shapes: recursive deletes of broad paths, force pushes, hook bypasses. When it cannot decide it blocks. Limits: Pattern based: a command it has never seen passes. Pair it with a backup and review, never rely on it alone. Door 9 of 100 Doors.