safety-guard
できること
このAIエージェントは、作業の安全を守るボディガードのような役割を果たします。危険なコマンドが誤って実行されるのを防ぎ、AIの変更対象をプロジェクト内の特定の範囲に制限することもできます。
使う場面
- ✓本番環境などの重要なシステムで作業するとき
- ✓AIに制限された範囲内だけで単独作業させたいとき
- ✓重要な更新やデータ変更を行うとき
スキルのリンク
https://github.com/affaan-m/ECC/blob/main/skills/safety-guard/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“プロジェクトを危険なコマンドから守り、編集を「src/components/」フォルダに限定してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIが実行しようとしているコマンドをチェックする仕組みです。コマンドが危険とみなされるもの(すべてを削除するなど)であったり、AIが許可された範囲の外を編集しようとしたりすると、処理を止めて確認を求めます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Safety Guard — Prevent Destructive Operations
When to Use
- When working on production systems
- When agents are running autonomously (full-auto mode)
- When you want to restrict edits to a specific directory
- During sensitive operations (migrations, deploys, data changes)
How It Works
Three modes of protection:
Mode 1: Careful Mode
Intercepts destructive commands before execution and warns:
Watched patterns:
- rm -rf (especially /, ~, or project root)
- git push --force
- git reset --hard
- git checkout . (discard all changes)
- DROP TABLE / DROP DATABASE
- docker system prune
- kubectl delete
- chmod 777
- sudo rm
- npm publish (accidental publishes)
- Any command with --no-verify
When detected: shows what the command does, asks for confirmation, suggests safer alternative.
Mode 2: Freeze Mode
Locks file edits to a specific directory tree:
/safety-guard freeze src/components/
Any Write/Edit outside src/components/ is blocked with an explanation. Useful when you want an agent to focus on one area without touching unrelated code.
Mode 3: Guard Mode (Careful + Freeze combined)
Both protections active. Maximum safety for autonomous agents.
/safety-guard guard --dir src/api/ --allow-read-all
Agents can read anything but only write to src/api/. Destructive commands are blocked everywhere.
Unlock
/safety-guard off
Implementation
Uses PreToolUse hooks to intercept Bash, Write, Edit, and MultiEdit tool calls. Checks the command/path against the active rules before allowing execution.
Integration
- Enable by default for
codex -a neversessions - Pair with observability risk scoring in ECC 2.0
- Logs all blocked actions to
~/.claude/safety-guard.log
よくある質問
どのような危険なコマンドをブロックしますか?
「すべて削除」(rm -rf)、バージョン管理システムでの強制プッシュ(git push --force)、データベースのテーブル削除(DROP TABLE)などのコマンドをブロックします。
保護を解除するにはどうすればよいですか?
「/safety-guard off」と入力すると、保護をオフにできます。
AIにすべてのファイルを読み取らせて、書き込みはひとつの場所だけに限定することはできますか?
はい、「Guard Mode」でそれができます。AIが書き込めるフォルダを指定すると、プロジェクトの他の部分は変更できなくなります。
詳細
作者による元の説明
Guard against destructive operations with three modes: Careful intercepts dangerous commands (rm -rf, git push --force, DROP TABLE) for confirmation, Freeze locks writes to one directory, and Guard combines both via PreToolUse hooks. Use when working on production systems, running agents autonomously, restricting edits to a directory, or during migrations, deploys, and data changes.
repo: affaan-m/ECC
人気
- GitHubのスター
- 280k
- ランキング
- #397
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
accessibility
280kエージェントが誰にとっても使いやすいインターフェースを作れるように手助けします。目が見えない方や身体の動きに制限のある方など、障害のある人にとってもWebサイトやアプリが正しく動くようにします。
agent-architecture-audit
280kエージェントがすべて正しく動いているかを確認できるようにします。AIシステムの問題を見つけて修正し、期待どおりに動くようにします。
agent-eval
280kエージェントが異なるAIコーディングツールを比較できるようにします。特定のタスクにおいて、どれがより速く、安く、信頼性が高いかを測定します。
agent-harness-construction
280kエージェントがタスクの進め方をよりよく理解できるようにします。エージェントが使うツールや指示を最適化し、成功する可能性を高めます。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。