git-guardrails-claude-code
Installation
SKILL.md
Setup Git Guardrails
Sets up a PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.
What Gets Blocked
git push(all variants including--force)git reset --hardgit clean -f/git clean -fdgit branch -Dgit checkout ./git restore .
When blocked, Claude sees a message telling it that it does not have authority to access these commands.
This is a deterministic config task. Run the bash blocks below as written — the
copy-then-verify order matters: never register a hook that points at a script that
isn't there, or every session/Bash call will fail with
/bin/sh: …/block-dangerous-git.sh: not found.