Claude Code: block dangerous commands

· Thiago Perrotta · Dec. 21, 2025, 9:35 p.m.
Summary
This post discusses a safety mechanism in Claude Code that blocks dangerous commands such as 'rm -rf' and 'terraform apply' via configuration hooks. The author provides code samples and explains how to implement a hook to prevent these commands from executing to maintain system integrity. Alternative methods for safely deleting files are suggested as well, making it a practical guide for developers concerned about command safety in their environments.
AUTHOR
Sponsored
Zulip logo Zulip
Organized team chat for people who take work seriously. Topic-based threading keeps conversations focused.
Try Zulip
Become a sponsor →