Claude Code Rm Guard
Description
Stop Claude Code from accidentally running `rm -rf ~` or other catastrophic commands
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
claude-code-rm-guard
**Important to note:** Claude Code's sandboxing feature (https://code.claude.com/docs/en/sandboxing) seems like a much better way to solve this problem, or otherwise using devcontainers. If that isn't what you want, then maybe this hook will help!
🛡️ Security hook for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) that prevents destructive file operations outside your working directory.
Stop Claude from accidentally running `rm -rf ~/` or other catastrophic commands.
Quick Install
curl -fsSL https://raw.githubusercontent.com/elertan/claude-code-rm-guard/main/install.py | python3
The installer will:
- Download the hook to
~/.claude/hooks/validate-rm.py - Add the hook configuration to
~/.claude/settings.json - Optionally add ask permissions for rm/unlink/rmdir (recommended)
**Uninstall:**
curl -fsSL https://raw.githubusercontent.com/elertan/claude-code-rm-guard/main/install.py | python3 - --uninstall
Features
- Path Validation: Blocks
rm,unlink,rmdir, andshredcommands targeting paths outside your project directory - Shell-Aware Parsing: Uses Python's
shlexwithpunctuation_chars=Truefor proper handling of pipes, chains, and quoted arguments - Recursive Analysis: Detects dangerous commands hidden in
sudo,xargs,find -exec,bash -c, and other wrappers - Safety-First Blocking: Commands with unresolvable paths (variables, globs, command substitution) are blocked by default
- Zero Dependencies: Pure Python 3, no external packages required
How It Works
When Claude Code attempts to run a Bash command:
- Hook Receives Input: Claude Code sends JSON via stdin with
tool_name,tool_input.command, andcwd - Command Parsing: The script uses
shlexto tokenize the command, splitting on;,|,&&,|| - Recursive Analysis: Each subcommand is analyzed, unwrapping
sudo,bash -c, etc. - Path Resolution: Target paths
Related Skills
Auto Update
Pull the latest ECC repo changes and reinstall the current managed targets.
Development Ecc Guide
Navigate ECC's current agents, skills, commands, hooks, install profiles, and docs from the live repository su
Development Epic Claim
Claim an epic issue, stamp coordination state, and sync local ownership.
Development Epic Publish
Publish a validated epic update back to the issue and local cache.
Development Epic Review
Mark epic review requested, approved, or changes requested.
Development Epic Unblock
Sweep blocked epic issues and reopen anything whose dependencies are closed.
Development Related Agents
Django Build Resolver
Django/Python build, migration, and dependency error resolution specialist. Fixes pip/Poetry errors, migration
Openai Codex CLI
(55.8k ⭐) - Lightweight coding agent that runs in your terminal.
src/agents/ — 11 Agent Definitions
**Generated:** 2026-04-11