/ ディレクトリ / プレイグラウンド / Claude Code Safety Net
● コミュニティ kenryu42 ⚡ 即起動

Claude Code Safety Net

作者 kenryu42 · kenryu42/claude-code-safety-net

A hooks-driven safety net for Claude Code — interceptors catch rm -rf, git reset --hard, force pushes, and uncommitted destructive edits.

Installs as a Claude Code plugin with PreToolUse hooks. Each potentially destructive operation is intercepted and either confirmed or refused based on rules. Includes rules for git, file system, npm, and arbitrary bash.

なぜ使うのか

主な機能

ライブデモ

実際の動作

準備完了

インストール

クライアントを選択

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "claude-code-safety-net": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/kenryu42/claude-code-safety-net",
        "~/.claude/skills/safety-net"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop → Settings → Developer → Edit Config を開く。保存後、アプリを再起動。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "claude-code-safety-net": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/kenryu42/claude-code-safety-net",
        "~/.claude/skills/safety-net"
      ],
      "_inferred": true
    }
  }
}

Cursor は Claude Desktop と同じ mcpServers スキーマを使用。プロジェクト設定はグローバルより優先。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "claude-code-safety-net": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/kenryu42/claude-code-safety-net",
        "~/.claude/skills/safety-net"
      ],
      "_inferred": true
    }
  }
}

Cline サイドバーの MCP Servers アイコンをクリックし、"Edit Configuration" を選択。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "claude-code-safety-net": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/kenryu42/claude-code-safety-net",
        "~/.claude/skills/safety-net"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop と同じ形式。Windsurf を再起動して反映。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "claude-code-safety-net",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/kenryu42/claude-code-safety-net",
        "~/.claude/skills/safety-net"
      ]
    }
  ]
}

Continue はマップではなくサーバーオブジェクトの配列を使用。

~/.config/zed/settings.json
{
  "context_servers": {
    "claude-code-safety-net": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/kenryu42/claude-code-safety-net",
          "~/.claude/skills/safety-net"
        ]
      }
    }
  }
}

context_servers に追加。保存時に Zed がホットリロード。

claude mcp add claude-code-safety-net -- git clone https://github.com/kenryu42/claude-code-safety-net ~/.claude/skills/safety-net

ワンライナー。claude mcp list で確認、claude mcp remove で削除。

ユースケース

実用的な使い方: Claude Code Safety Net

Install the safety net into Claude Code

👤 Claude Code users ⏱ ~15 min intermediate

使うタイミング: You've been bitten by an agent overwriting uncommitted changes.

フロー
  1. Clone
    git clone into ~/.claude/skills/safety-net✓ コピーしました
    → Skill directory present
  2. Wire hooks
    Run the included setup; settings.json gets PreToolUse entries.✓ コピーしました
    → Hooks active
  3. Test
    Ask Claude to git reset --hard; expect block.✓ コピーしました
    → Block triggered

結果: Destructive ops require explicit override.

組み合わせ

他のMCPと組み合わせて10倍の力を

claude-code-safety-net + filesystem

Pairs naturally with any agent doing repo edits

Combine claude-code-safety-net with filesystem: Pairs naturally with any agent doing repo edits✓ コピーしました

ツール

このMCPが提供する機能

ツール入力呼び出すタイミングコスト
hook-driven (see docs) No callable tools; activates via PreToolUse hooks 1 call

コストと制限

運用コスト

APIクォータ
N/A
呼び出しあたりのトークン
0
金額
Free
ヒント
Start in soft-warn mode; promote to hard-block after a week of clean runs

セキュリティ

権限、シークレット、影響範囲

最小スコープ: hooks-read hooks-write
認証情報の保管: None
データ送信先: None

トラブルシューティング

よくあるエラーと対処法

Hooks not firing

Confirm settings.json was actually updated; restart Claude Code

False positives on benign git ops

Tune the per-project rules file

代替案

Claude Code Safety Net 他との比較

代替案代わりに使う場面トレードオフ
pegasi-ai/reinsYou want broader agent guardrailsHeavier setup
Manual reviewSolo, low-stakes repoDoesn't scale

その他

リソース

📖 GitHub の公式 README を読む

🐙 オープンな issue を見る

🔍 400以上のMCPサーバーとSkillsを見る