
Description
safety-hooks is a plugin for Claude Code that adds guards to risky command-line operations. Its hooks use three decisions: block, which stops a command outright; ask, which prompts you for approval in the interface; and allow, which lets a command run. A unified Bash hook runs all the sub-checks and applies the strongest decision, so block takes priority over ask, and ask over allow. The rm guard blocks deletion, including /bin/rm and /usr/bin/rm, and suggests moving files to a TRASH folder instead, with a log of what was moved. The README says heredoc bodies are treated as data rather than commands. Other guards cover destructive git actions, access to .env files and large file operations. The hooks report their decisions to Claude Code in the format the tool expects. The plugin is part of the claude-code-tools collection by pchalasani on GitHub, and the listing gives its purpose as blocking or confirming risky CLI operations.…
Highlights
- Block, ask or allow decisions for commands
- Blocks rm and suggests a TRASH folder
- Guards destructive git actions
- Guards .env file access
- Guards large file operations
Ratings & Reviews
No ratings yet
Be the first to rate safety-hooks.
People also visit

git-guardrails-claude-code
设置 Claude Code hooks,在危险 git commands(push、reset --hard、clean、branch -D
safety-hooks FAQ
What does safety-hooks do?
It adds hooks to Claude Code that block, or ask you to approve, risky command-line operations.
What happens when I run rm?
The rm guard blocks the deletion and suggests moving the files to a TRASH folder, with the move logged in TRASH-FILES.md.
What else is guarded?
Destructive git actions, access to .env files and large file operations, according to the listing.
Which decision wins if several checks disagree?
Block takes priority over ask, and ask over allow.
Where is it from?
The claude-code-tools collection by pchalasani on GitHub.
What are the best safety-hooks alternatives?
Popular alternatives to safety-hooks include git-guardrails-claude-code, git-guardrails-claude-code and garrytan/careful. See all safety-hooks alternatives














