本文へスキップ
Skillpedia
セキュリティ280k · #397

safety-guard

できること

このAIエージェントは、作業の安全を守るボディガードのような役割を果たします。危険なコマンドが誤って実行されるのを防ぎ、AIの変更対象をプロジェクト内の特定の範囲に制限することもできます。

使う場面

  • ✓本番環境などの重要なシステムで作業するとき
  • ✓AIに制限された範囲内だけで単独作業させたいとき
  • ✓重要な更新やデータ変更を行うとき

スキルのリンク

https://github.com/affaan-m/ECC/blob/main/skills/safety-guard/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/affaan-m/ECC/blob/main/skills/safety-guard/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

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 never sessions
  • 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

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル