~ / rigs / wangbooth / Claude-Code-Guardrails

wangbooth/Claude-Code-Guardrails

Protective hooks for Claude Code that prevent accidental code loss through branch protection, automatic checkpointing, and safe commit squashing

↗ GitHub ★ 31 mit updated 1.1y ago project Claude Code
share on X
ARCHETYPE
Automator
Hooks on every lifecycle event: format, lint, notify, log.
CONTEXT TAX · EVERY TURN
~1.3k tokens
Featherweight · median rig: 2.3k · breakdown
GUARDRAILS
2/5
Pre-tool screening hook · No YOLO mode · details

Copy this rig

# review before running: this installs third-party code
$ npx degit wangbooth/Claude-Code-Guardrails/.claude ./rig-claude-code-guardrails  # inspect, then merge into .claude/

MCP servers are added to Claude Code at local scope; env vars are shown as YOUR_… placeholders — we never store values. Files are fetched with degit into a separate folder so you can review before merging.

Merge into .claude/settings.json (project) or ~/.claude/settings.json (user). Hook commands reference scripts in the source repo — copy those too.

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/guardrails/guard-branch.sh"
          }
        ]
      }
    ]
  }
}

Hooks (4)

eventmatcherruns
PreToolUseWrite|Edit|MultiEdit$CLAUDE_PROJECT_DIR/.claude/hooks/guardrails/guard-branch.sh
PostToolUseWrite|Edit|MultiEdit$CLAUDE_PROJECT_DIR/.claude/hooks/guardrails/auto-commit.sh
Stop*$CLAUDE_PROJECT_DIR/.claude/hooks/guardrails/squash-checkpoints.sh
PreCompact*$CLAUDE_PROJECT_DIR/.claude/hooks/guardrails/squash-checkpoints.sh compact

Similar rigs

copied ✓