git-guardrails
Skill1 starsChanged 23 days agoMITView on GitHub
Set up Codex or 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.
- Deletes or force-pushes
- Commits and pushes
9 other projects use a version of this, 4 of them edited.
Adopted by
Most recently taken up by
- apravint/iram-ostheir own version, first seen Nov 8, 2026
- aveproject/avetheir own version, first seen Oct 31, 2026
- ethanfoell/skillsedited, first seen Oct 20, 2026
- manastalukdar/ai-devstudiotheir own version, first seen Oct 13, 2026
- DROOdotFOO/agent-skillsedited, first seen Sep 1, 2026
- karthikrshet/aiskillstheir own version, first seen Aug 20, 2026
Used with
Projects with it also use zoom-out, to-prd and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
victorgarciaesgiSkillzoom-out
Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.
Also in 3 projects that use this
GoogleSkillto-prd
Turn the current conversation into a PRD and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.
Also in 3 projects that use this
MicrosoftSkillhandoff
Compact the current conversation into a handoff document for another agent to pick up.
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 4
- uwvwko-zzz/mattpocock-skills-openclaw★ 915% same
- DROOdotFOO/agent-skills★ 116% same
- ethanfoell/skills★ 032% same
- saeed-vayghan/mitra★ 025% same
Wrote their own version · 5
- aveproject/ave★ 24same name
- apravint/iram-os★ 7same name
- Code-Shock/claude-skills★ 5same name
- karthikrshet/aiskills★ 4same name
- manastalukdar/ai-devstudio★ 1same 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 repository107 other files it gives its agents.
- AGENTS.mdAGENTS.md
- audit-agent-documentationSkill
- automate-meSkill
- babysit-and-shipSkill
- chief-of-staffSkill
- coordinatorSkill
- figure-it-outSkill
- maintain-skillsSkill
- principlesSkill
- pstack-helpSkill
- pstack-modeSkill
- pstack-setupSkill
- recallSkill
- reflectSkill
- retroSkill
- setup-matt-pocock-skillsSkill
- show-me-your-workSkill
- swarmSkill
- usage-reviewSkill
- wizardSkill
- writing-for-agentsSkill
- broSkill
- in-your-own-wordsSkill
- ketchupSkill
- ketchup-videoSkill
- next-optionsSkill
- prSkill
- reply-shapeSkill
- teachSkill
- technical-writingSkill
- unslopSkill
- write-like-meSkill
- correctSkill
- create-formal-verification-skillSkill
- create-verification-skillSkill
- diagnosing-bugsSkill
- implementSkill
- implement-specSkill
- linting-alignmentSkill
- maintain-formal-verification-skillSkill
- maintain-verification-skillSkill
- make-bot-uiSkill
- pstack-tddSkill
- setup-agent-sign-inSkill
- setup-pre-commitSkill
- setup-ts-deep-modulesSkill
- statechartSkill
- tddSkill
- typescript-best-practicesSkill
- update-dependenciesSkill
- architectSkill
- arenaSkill
- codebase-designSkill
- design-prototypeSkill
- domain-modelingSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- howSkill
- improve-codebase-architectureSkill
- 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 9 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 16
When blocked, the agent sees a message telling it that it does not have authority to access these commands.
“Common” is measured: kept by at least 6 in 10 of the 9 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
Set up Git guardrails
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 agent sees a message telling it that it does not have authority to access these commands.
Steps
- Resolve the user's requested host, project/global scope, and blocked operations. Ask if user wants to add or remove any patterns from the blocked list. Inspect existing settings and actual hook capability before editing. Merely installing this skill changes no host settings. Complete when the target and policy are authorized and concrete.
- Copy the Python detector to the agreed hook location and verify Python 3 is available. Edit the copied detector for any added or removed patterns. It inspects ordinary literal Git shell commands, including common Git options and shell separators. It is an accidental-operation guardrail, not a complete shell sandbox: aliases, opaque scripts, indirect language runtimes, or unsupported host paths can bypass it. Use host permissions for enforcement. Complete when the detector passes its fixture cases and limitations match the requested policy.
- Read the matching host reference below and merge a command hook into existing settings without replacing unrelated hooks. Resolve an absolute script path, or the host's documented project-directory form for a project hook; never build a command from untrusted issue text. Complete when the saved matcher and command use that host's documented schema.
- Test harmless allowed and denied events using stdin fixtures; a denied fixture such as
git push origin mainshould exit with code 2 and print a BLOCKED message to stderr, then verify the host actually invokes the hook without running a destructive command. Codex hooks require native review/trust; report a pending trust step accurately and never bypass it. Complete when observed host behavior matches the policy or activation remains an explicit gap.
Host adapters
- For Codex, read the Codex adapter.
- For Claude Code, read the Claude Code adapter.
The optional scripts/block-dangerous-git.sh wrapper invokes the Python detector for existing shell-hook launchers. Both adapters use the same detector and JSON deny response. Run python3 -m unittest discover -s scripts/tests -v from this skill to exercise its bounded command coverage.
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.

