agent toolingby evgeniiperov
Setup Git Guardrails
evgeniiperov/git-guardrails-claude-code
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
What it changes
Passed 19 of 22 test cases with the skill, and 10 of 22 without it.
Without skill45%
With skill86%
Checks it passed that the model alone missed
- Specify exit code 2
- Specify .claude/settings.json
- Specify ~/.claude/settings.json
and 7 more in the full report
9 fixed10 passed either way3 still failing0 broke
- Pass-rate lift
- +41 pp
- Tokens
- -22%
- Agent turns
- 0%
- Response time
- -58%
Model gemini-3.6-flashMeasured 8/6/2026v119 of 22 cases passed with skill
See it in action
One of 9 test cases the skill fixed. Same model, same prompt, with and without the skill.
PromptWhich configuration file path is updated when installing git guardrails globally for all Claude Code sessions?
What was checked, without and with the skill| Checked | Without skill | With skill |
|---|
| Specify ~/.claude/settings.json | Missed | Passed |
|---|
What's inside
The instructions your model reads when the skill loads.
SKILL.md90 lines2 filesincludes scripts
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
Ask the user: install for this project only (.claude/settings.json) or all projects (~/.claude/settings.json)?
2. Copy the hook script
The bundled script is at: scripts/block-dangerous-git.sh
Copy it to the target location based on scope:
- Project:
.claude/hooks/block-dangerous-git.sh
- Global:
~/.claude/hooks/block-dangerous-git.sh
Make it executable with chmod +x.
3. Add hook to settings
Add to the appropriate settings file:
Project (.claude/settings.json):
{
"hooks": {
Track record
Benchmark
19 / 22
test cases passed, vs 10 / 22 without
Adoption
- Users
- 0
- Times used
- 0
Safety and source details
SkillSafety
✓ 3 of 3 passed✓Code scan15 of 15 checks clean
0 critical · 0 warning · 0 info — scanner v4 — 8/2/2026
View 15 scanner checks
live_secretremote_code_executionreverse_shelldata_exfiltrationssrf_metadataagent_snoopinganti_refusaldestructive_commandsobfuscated_unicodeunicode_homoglyphopaque_blobsuspicious_urltool_overreachtrigger_abuseprompt_injection_phrasing
✓IntentSafe
LLM judge · does the skill do what it claims
✓ContentClean
LLM judge · policy & harmful-content review
Source
Importedevgeniiperov / quay
.agents/skills/git-guardrails-claude-code/SKILL.md
View on GitHub ↗License MITImported 8/2/2026Version v1Bundled 1 file · scripts