safe-mode

Solid

Prevent destructive operations using Claude Code hooks. Three modes — cautious (warn on dangerous commands), lockdown (restrict edits to one directory), and clear (remove restrictions). Uses PreToolUse matchers for Bash, Edit, and Write.

AI & Automation 2,228 stars 213 forks Updated 6 days ago

Install

View on GitHub

Quality Score: 86/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
0
Description 5%
100

Skill Content

# Safe Mode Three levels of protection against destructive operations during AI coding sessions. > **Note:** These hooks are skill-scoped — they only activate when you invoke `/safe-mode`. The global `permission-request.js` hook in hooks.json provides always-on alerting for dangerous commands. Safe-mode adds opt-in blocking and directory restrictions on top of that. ## Modes ### Cautious Mode ```text /safe-mode cautious ``` Intercepts Bash commands before execution. Warns on dangerous patterns but does not block — the user decides. **Flagged patterns:** | Pattern | Risk | |---------|------| | `rm -rf` / `rm -r` | Recursive deletion | | `DROP TABLE` / `DROP DATABASE` | SQL data loss | | `TRUNCATE` | SQL data destruction | | `git push --force` / `git push -f` | Remote history rewrite | | `git reset --hard` | Local history loss | | `git clean -f` | Untracked file deletion | | `git checkout .` / `git restore .` | Discard all changes | | `chmod 777` | World-writable permissions | | `curl \| sh` / `wget \| sh` | Piped remote execution | | `> /dev/sda` / `dd if=` | Disk-level operations | | `:(){ :\|:& };:` | Fork bombs | | `sudo rm` | Elevated deletion | **What happens:** ```text WARNING: Destructive operation detected Command: rm -rf ./build Pattern: rm -rf (recursive forced deletion) Risk: Permanently deletes ./build and all contents Proceed? The command will execute as-is if you continue. ``` The warning goes to stderr. Claude sees it and asks for confirmatio...

Details

Author
rohitg00
Repository
rohitg00/pro-workflow
Created
3 months ago
Last Updated
6 days ago
Language
JavaScript
License
None

Similar Skills

Semantically similar based on skill content — not just same category