Developer uses 27-line hook to block rm -rf in Claude Code
11/27/2026 — 11/27, 04:16·1 sources (all)·1 reports (all)
Key takeaways
- The author argues that "do not delete files" in CLAUDE.md is just an instruction that can be overridden in longer conversations, so they wro…
Background & analysis
On November 27, 2026, DEV Community published an article by a developer who built a PreToolUse hook for Claude Code in 27 lines of Node code to block recursive deletes such as rm -rf. The author argues that a line in CLAUDE.md telling the agent never to delete files is only an instruction: it is followed most of the time, but a later request or a long conversation can override it, and "most of the time" is not good enough for a delete. According to the post, Claude Code passes each tool call to the hook as JSON before executing it, and if the hook returns deny, the command does not run. The code uses no external packages. The author says every command listed in the article was tested against the hook before publication, and that the format was checked item by item against the Claude Code hooks documentation dated November 26. The account stops there: the material reports no further developments beyond the developer's own release and testing of the hook.
AI-generated from 1 reports · updated 2 days ago
Related AI tools
- Heat index
- 25
- All sources
- 1
- All reports
- 1
- First seen
- 2 days ago
Reports on this story headlines open the original
A developer argues that "never delete files" in CLAUDE.md is only an instruction that can be overridden or lost in a long chat, so they built a 27-line dependency-free Node PreToolUse hook instead: Claude Code passes each tool call as JSON and a "deny" answer stops the command no matter what the conversation said. The author says the code was run against every command in the post's table before publishing and checked against the Claude Code hooks reference on 26 November 2026.
DEV Community · AIAI score 60
Other stories people are talking about
- Heat index 63Developer says bulk-installed Skills crowd out Claude Code's context window1 sources
- Heat index 49Developer releases Claude Code skill legwork to offload mechanical edits1 sources
- Heat index 62Connecting Claude Code to local Ollama models1 sources
- Heat index 166Claude Code adds /ship command for automated PR review3 sources
- Heat index 27Developer open-sources explainroo video tool for Claude Code explainer videos1 sources
How is heat calculated?About the methodHide
Heat counts how many independent sources covered a story in the last 48 hours: one source counts once no matter how many posts it published, decaying with a 24-hour half-life. What ranks first is what many people are talking about.
This page aggregates public feeds. Headlines and summaries are machine-organized and remain the property of the original authors; verify important facts at the source. If you believe a headline or summary infringes your rights, email the contact address in the footer with the page URL and basis of your claim, and we will remove or replace it after review.
- Surge
- Discussion rising fast
- New
- First report within 6 hours
- Rising
- Still gathering discussion

