git-guardrails
Set up a Copilot hook to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
Skill by RafEngineer
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/rafengineer-git-guardrails
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Shell scripts
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/git-guardrails
What's inside
- Skill name
git-guardrails- Description
- Set up a Copilot hook 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 the agent.
- License
- MIT
- Instructions
- 61 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (2)
- SKILL.md
- block-dangerous-git.sh · scripts/
SKILL.md (first lines)
# Setup Git Guardrails
Sets up a `PreToolUse` hook that intercepts and blocks dangerous git commands before the agent 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, the agent sees a message telling it that it does not have authority to access these commands.
## Steps
### 1. Copy the hook script
The bundled script is at: [scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh)
Copy it to:
- `.github/hooks/block-dangerous-git.sh`
Make it executable with `chmod +x`.
### 2. Register the hook
Create `.github/hooks/block-dangerous-git.json`:
```json
{
"hooks": {
"PreToolUse": [
{
"type": "command",
"command": "./.github/hooks/block-dangerous-git.sh",
"timeout": 10
}
]
}
}
```
If the file already exists, merge the hook into the existing `hooks.PreToolUse` array — don't overwrite other settings.
### 3. Ask about customization
Ask if user wants to add or remove any patterns from the blocked list. Edit the copied script accordingly.
### 4. Verify
Run a quick test:
```bash
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>
```
Should exit with code 2 and print a BLOCKED message to stderr.From RafEngineer/copilot-skills-pack, MIT.
More from RafEngineer/copilot-skills-pack
- 0.455score
diagnosing-bugs
RafEngineer
Diagnosis loop for hard bugs and performance regressions.
SkillCFreshness: CClaude Code +9 - 0.450score
design-an-interface
RafEngineer
Generate multiple radically different interface designs for a module using parallel sub-agents.
SkillCFreshness: CClaude Code +9 - 0.450score
codebase-design
RafEngineer
Shared vocabulary for designing deep modules.
SkillCFreshness: CClaude Code +9 - 0.450score
domain-modeling
RafEngineer
Build and sharpen a project's domain model.
SkillCFreshness: CClaude Code +9 - 0.447score
improve-codebase-architecture
RafEngineer
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
SkillCFreshness: CClaude Code +9 - 0.444score
ask-matt
RafEngineer
Ask which skill or flow fits your situation.
SkillCFreshness: CClaude Code +9 - 0.439score
implement
RafEngineer
Implement a piece of work based on a spec or set of tickets.
SkillCFreshness: CClaude Code +9 - 0.439score
handoff-bg
RafEngineer
Hand the current conversation off to a fresh background subagent that picks up the work immediately.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jul 23, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from RafEngineer
- 0.455score
diagnosing-bugs
RafEngineer
Diagnosis loop for hard bugs and performance regressions.
SkillCFreshness: CClaude Code +9 - 0.450score
design-an-interface
RafEngineer
Generate multiple radically different interface designs for a module using parallel sub-agents.
SkillCFreshness: CClaude Code +9 - 0.450score
codebase-design
RafEngineer
Shared vocabulary for designing deep modules.
SkillCFreshness: CClaude Code +9 - 0.450score
domain-modeling
RafEngineer
Build and sharpen a project's domain model.
SkillCFreshness: CClaude Code +9 - 0.447score
improve-codebase-architecture
RafEngineer
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
SkillCFreshness: CClaude Code +9 - 0.444score
ask-matt
RafEngineer
Ask which skill or flow fits your situation.
SkillCFreshness: CClaude Code +9
Cite this page
git-guardrails skill. Agent Mart. https://agentmart.dev/skills/rafengineer-git-guardrails (last updated 2026-10-24)