
Safety Guard
- 4.6k installs
- 238k repo stars
- Updated August 5, 2026
- affaan-m/everything-claude-code
A pre-execution guard that detects and blocks destructive commands and restricts file writes to safe zones during agent autonomy.
About
Safety Guard intercepts destructive commands and file operations before execution in Claude Code environments. It operates in three modes: Careful mode warns on risky patterns (rm -rf, git push --force, DROP TABLE, docker system prune, kubectl delete, chmod 777, sudo rm, npm publish); Freeze mode locks write access to specified directory trees while allowing reads elsewhere; Guard mode combines both protections for maximum safety during autonomous agent execution. Developers use this when agents run full-auto, managing production systems, performing migrations, or handling sensitive data changes. Blocked actions log to ~/.claude/safety-guard.log. Integrates via PreToolUse hooks on Bash, Write, Edit, and MultiEdit tools. Careful mode detects 11+ destructive patterns before execution with suggestions for safer alternatives Freeze mode restricts write access to specified directories while preserving global read capability Guard mode combines
- Careful mode detects 11+ destructive patterns before execution with suggestions for safer alternatives
- Freeze mode restricts write access to specified directories while preserving global read capability
- Guard mode combines destructive-command blocking with directory-write restrictions for autonomous agents
- All blocked actions logged to ~/.claude/safety-guard.log for audit and compliance
- Toggleable via /safety-guard off | careful | freeze | guard commands with optional --dir and --allow-read-all flags
Safety Guard by the numbers
- 4,574 all-time installs (skills.sh)
- +221 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #135 of 2,203 Security skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
safety-guard capabilities & compatibility
- Capabilities
- pre execution command pattern matching · directory scoped write restrictions · destructive operation logging · safer alternative suggestions · audit trail generation
- Use cases
- security audit · ci cd · testing
- Runs
- Runs locally
- Pricing
- Free
What safety-guard says it does
本番システムでの作業時や、エージェントを自律的に実行する際に破壊的な操作を防ぐためにこのスキルを使用してください
PreToolUse フックを使用して Bash、Write、Edit、MultiEdit ツールの呼び出しを検知します。実行前に、アクティブなルールに対してコマンド/パスを確認します
npx skills add https://github.com/affaan-m/everything-claude-code --skill safety-guardAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 4.6k |
|---|---|
| repo stars | ★ 238k |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 5, 2026 |
| Repository | affaan-m/everything-claude-code ↗ |
What it does
Prevent destructive operations when running agents autonomously or working on production systems.
Who is it for?
Production systems, autonomous agent execution, sensitive migrations, data-mutation tasks, compliance-heavy environments.
Skip if: Local development with immediate user oversight, non-agent workflows, environments with no destructive risk.
When should I use this skill?
Running agents with autonomy enabled, working on production, performing migrations or bulk operations, requiring audit trails.
What you get
Developers confidently run agents in full-auto mode knowing destructive operations are intercepted, logged, and require confirmation.
- Blocked operation logs
- Audit trail in ~/.claude/safety-guard.log
- Confirmation prompts with safer alternatives
By the numbers
- Monitors 11+ destructive command patterns (rm -rf, git push --force, DROP TABLE, docker system prune, kubectl delete, ch
- Logs all blocked actions to ~/.claude/safety-guard.log for audit
- 3 protection modes: Careful (warn), Freeze (lock writes), Guard (both)
Files
Safety Guard — 破壊的な操作の防止
使用するタイミング
- 本番システムでの作業時
- エージェントが自律的に動作している場合(フルオートモード)
- 特定のディレクトリへの編集を制限したい場合
- センシティブな操作時(マイグレーション、デプロイ、データ変更)
動作の仕組み
3つの保護モードがあります:
モード1: Careful モード
実行前に破壊的なコマンドを検知して警告します:
監視するパターン:
- rm -rf(特に /、~、またはプロジェクトルート)
- git push --force
- git reset --hard
- git checkout .(全変更を破棄)
- DROP TABLE / DROP DATABASE
- docker system prune
- kubectl delete
- chmod 777
- sudo rm
- npm publish(誤公開)
- --no-verify を含む全コマンド検知した場合: コマンドの内容を示し、確認を求め、より安全な代替手段を提示します。
モード2: Freeze モード
特定のディレクトリツリーへのファイル編集をロックします:
/safety-guard freeze src/components/src/components/ 外への Write/Edit は説明付きでブロックされます。エージェントを特定の領域に集中させ、無関係なコードに触れないようにしたい場合に便利です。
モード3: Guard モード(Careful + Freeze の組み合わせ)
両方の保護が有効になります。自律エージェントのための最大安全モードです。
/safety-guard guard --dir src/api/ --allow-read-allエージェントはすべてを読み取れますが、src/api/ にのみ書き込めます。破壊的なコマンドはどこでもブロックされます。
ロック解除
/safety-guard off実装
PreToolUse フックを使用して Bash、Write、Edit、MultiEdit ツールの呼び出しを検知します。実行前に、アクティブなルールに対してコマンド/パスを確認します。
統合
codex -a neverセッションでデフォルトで有効化する- ECC 2.0 の可観測性リスクスコアリングと組み合わせる
- ブロックされた全アクションを
~/.claude/safety-guard.logに記録する
Related skills
Forks & variants (1)
Safety Guard has 1 known copy in the catalog totaling 1.4k installs. They canonicalize to this original listing.
- affaan-m - 1.4k installs
FAQ
Does Safety Guard slow down command execution?
No - Careful and Guard modes run pattern checks via PreToolUse hooks before command invocation, with negligible latency. Only matching commands trigger confirmation dialogs.
Can I unlock Safety Guard temporarily?
Yes - use /safety-guard off to disable all protections, or /safety-guard careful to revert to warning-only mode. Full audit trail remains in ~/.claude/safety-guard.log.
What happens if an agent tries a blocked operation?
The operation is halted, a detailed warning with safer alternatives is shown, and the attempt is logged. The agent continues execution for other tasks.