Git Guardrails (Claude Code skill)
Setup skill that drops a `PreToolUse` hook into Claude Code to block destructive git commands upfront: `git push` (incl. `--force`), `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`. When Claude tries any of them, the hook replies with a 'no authority' message and aborts. Installs per-project (`.claude/settings.json`) or global (`~/.claude/settings.json`).
Strengths
- Blocks BEFORE execution, not a post-mortem audit, a real guardrail
- Setup in 4 steps: copy script + chmod +x + 1 settings.json block + verify
- Customisable patterns, you can add `git tag --delete` or remove `git push` depending on your flow
- Global AND project compatible, global for yourself, project to set a team baseline
Limitations
- Also blocks legitimate usage (`git push` on your personal branch), you must disable or whitelist case-by-case
- Setup skill, not runtime, invoked once to install, then invisible
Best for
- Devs who let Claude Code run on a prod repo without constant supervision
- Teams that want a shared git-authority baseline across all Claude Code agents on the repo
- Any dev who has ever been bitten by an accidental `--force-push` or `reset --hard`