Claude Code: block dangerous commands

114 · 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.