git-guardrails
Skill1 starsChanged 3 months agoMITView on GitHub
Set up Codex or Claude Code hooks to block dangerous git commands before they execute. TRIGGER when: user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in an agent coding host. DO NOT TRIGGER when: user is asking about git workflow or branching strategy.
- Deletes or force-pushes
- Commits and pushes
3 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- uwvwko-zzz/mattpocock-skills-openclawedited, first seen May 12, 2026
- Code-Shock/claude-skillstheir own version, first seen Apr 5, 2026
- neuron-one/GODMODEtheir own version, first seen Apr 1, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- uwvwko-zzz/mattpocock-skills-openclaw★ 910% same
Wrote their own version · 2
- neuron-one/GODMODE★ 33same name
- Code-Shock/claude-skills★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-reviewerSkill
- agent-designerSkill
- architectSkill
- autoresearchSkill
- blockscoutSkill
- ci-cd-pipeline-builderSkill
- claude-apiSkill
- codebase-onboardingSkill
- code-reviewSkill
- coingeckoSkill
- database-designerSkill
- dependency-auditorSkill
- design-uxSkill
- digestSkill
- droo-stackSkill
- env-secrets-managerSkill
- ethskillsSkill
- ffmpeg-asmSkill
- focused-fixSkill
- frontend-slop-auditSkill
- git-worktree-managerSkill
- humanizerSkill
- interface-designerSkill
- llm-cost-optimizerSkill
- local-browser-inspectorSkill
- mcp-server-builderSkill
- native-codeSkill
- nixSkill
- noirSkill
- observability-designerSkill
- patchbotSkill
- performance-profilerSkill
- playwrightSkill
- polymathSkill
- prd-to-planSkill
- prepperSkill
- property-testingSkill
- qaSkill
- rag-architectSkill
- raxol-paymentsSkill
- raxolSkill
- raxol-symphonySkill
- recallSkill
- refactoring-strategySkill
- regenSkill
- releaseSkill
- security-auditorSkill
- self-improving-agentSkill
- sentinelSkill
- signozSkill
- skill-creatorSkill
- solidity-auditorSkill
- tddSkill
- tech-debt-trackerSkill
- ubiquitous-languageSkill
- watchdogSkill
- web-asset-generatorSkill
- writing-voiceSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
When blocked, the host receives a message explaining why the command is denied.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Guardrails
Sets up a PreToolUse hook that intercepts and blocks dangerous git commands before the coding agent executes them.
What You Get
- PreToolUse hook blocking destructive git operations
- Project-scoped or global installation
- Customizable blocked command patterns
- Verification test command
What Gets Blocked
git push(all variants including--force)git reset --hardgit clean -f/git clean -fdgit branch -Dgit checkout ./git restore .
When blocked, the host receives a message explaining why the command is denied.
WRONG: no guardrails, Claude runs destructive commands silently
# The coding agent decides to "clean up" and runs:
git reset --hard HEAD~3 # 3 commits of work gone
git clean -fd # untracked files deleted
git push --force # rewrites shared historyCORRECT: hook blocks before execution
$ echo '{"tool_input":{"command":"git push --force"}}' | block-dangerous-git.sh
BLOCKED: git push is not allowed. Ask the user to run it manually.Setup Steps
- Identify host and scope -- Codex or Claude Code; project or global.
- Copy hook script -- bundled at scripts/block-dangerous-git.sh. Put it in the host's project or global hooks directory and make it executable.
- Add to settings -- see settings-config.md for Codex and Claude Code examples.
- Customize -- ask if user wants to add/remove patterns from the blocked list
- Verify --
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>should exit code 2 with BLOCKED message
Reference
| File | Topic |
| settings-config.md | Codex and Claude Code hook configuration |
| scripts/block-dangerous-git.sh | The hook script |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

