Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# Git Guardrails for Claude Code
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
This skill is imported from `mattpocock/skills` (MIT) and is **model-invoked** upstream.
## When to use this skill
- Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
- Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
## Instructions
## 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 --hard`
- `git clean -f` / `git clean -fd`
- `git branch -D`
- `git checkout .` / `git restore .`
When blocked, Claude sees a message telling it that it does not have authority to access these commands.
### Steps
#### 1. Ask scope
…
The line at the top of this page pins the label v1.0, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
GET https://markdownregistry.com/api/v1/artifacts/art_offersiihjz4rlsp
GET https://markdownregistry.com/api/v1/resolve?ref=akillness/jeo-skills/git-guardrails-claude-code
GET https://markdownregistry.com/api/v1/blob/eb5d5c0af8c01abc8f802084b2dcfca55eb0a4a45cdb44ce2161a1ce2dec2c9a
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
akillness/jeo-skills · .agent-skills/a2a-protocol/SKILL.md · Agent-to-Agent horizontal messaging — Linux Foundation AAIF 2026 standard. Use when multiple agents across…
akillness/jeo-skills · .agent-skills/academic-research/SKILL.md · Full academic research pipeline from discovery to publication — 4 reference pipelines, 27 modes, 39-agent ensemble…
akillness/jeo-skills · .agent-skills/agent-beacon/SKILL.md · Operate Asymptote-Labs/agent-beacon, the cross-harness coding-agent session history and self-improving memory layer…
akillness/jeo-skills · .agent-skills/agent-observability/SKILL.md · Instrument LLM agents with traces, metrics, and replay. Use when an agent in production is silently failing…
akillness/jeo-skills · .agent-skills/agent-principles/SKILL.md · Core principles for collaborative development with AI agents. Defines divide-and-conquer, context management…
akillness/jeo-skills · .agent-skills/agent-pulse/SKILL.md · Operate and extend barretlee/agent-pulse, the evidence-backed AI industry intelligence system: inspect source catalog…
asymmetric-al/core · .agents/skills/git-guardrails-claude-code/SKILL.md · Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they…
rudycity/superagent · .agents/skills/git-guardrails-claude-code/SKILL.md · Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they…
vodailocz/kilo-kit-mcp · skills/productivity/git-guardrails-claude-code/SKILL.md · Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they…
mambo-wang/codewiki-plus · .trae/skills/git-guardrails-claude-code/SKILL.md · Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they…
mambo-wang/codewiki-plus · .codebuddy/skills/git-guardrails-claude-code/SKILL.md · Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they…
chinkan/rustfox · .agents/skills/git-guardrails-claude-code/SKILL.md · Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they…