/ Directory / Playground / Claude Code Safety Net
● Community kenryu42 ⚡ Instant

Claude Code Safety Net

by 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.

Why use it

Key features

Live Demo

What it looks like in practice

ready

Install

Pick your client

~/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
    }
  }
}

Open Claude Desktop → Settings → Developer → Edit Config. Restart after saving.

~/.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 uses the same mcpServers schema as Claude Desktop. Project config wins over global.

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
    }
  }
}

Click the MCP Servers icon in the Cline sidebar, then "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
    }
  }
}

Same shape as Claude Desktop. Restart Windsurf to pick up changes.

~/.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 uses an array of server objects rather than a map.

~/.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"
        ]
      }
    }
  }
}

Add to context_servers. Zed hot-reloads on save.

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

One-liner. Verify with claude mcp list. Remove with claude mcp remove.

Use Cases

Real-world ways to use Claude Code Safety Net

Install the safety net into Claude Code

👤 Claude Code users ⏱ ~15 min intermediate

When to use: You've been bitten by an agent overwriting uncommitted changes.

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

Outcome: Destructive ops require explicit override.

Combinations

Pair with other MCPs for X10 leverage

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✓ Copied

Tools

What this MCP exposes

ToolInputsWhen to callCost
hook-driven (see docs) No callable tools; activates via PreToolUse hooks 1 call

Cost & Limits

What this costs to run

API quota
N/A
Tokens per call
0
Monetary
Free
Tip
Start in soft-warn mode; promote to hard-block after a week of clean runs

Security

Permissions, secrets, blast radius

Minimum scopes: hooks-read hooks-write
Credential storage: None
Data egress: None

Troubleshooting

Common errors and fixes

Hooks not firing

Confirm settings.json was actually updated; restart Claude Code

False positives on benign git ops

Tune the per-project rules file

Alternatives

Claude Code Safety Net vs others

AlternativeWhen to use it insteadTradeoff
pegasi-ai/reinsYou want broader agent guardrailsHeavier setup
Manual reviewSolo, low-stakes repoDoesn't scale

More

Resources

📖 Read the official README on GitHub

🐙 Browse open issues

🔍 Browse all 400+ MCP servers and Skills