git-guardrails
Set up guardrails that block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they run.
Skill by netname
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/netname-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
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 guardrails that block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they run. Use when the user wants to prevent destructive git operations, add git safety guardrails, or block git push/reset.
- License
- MIT
- Metadata
- upstream: mattpocock/skills · invocation: model · adapted-for: pi · upstream-path: skills/misc/git-guardrails-claude-code · upstream-commit: c55ee46073ed923f86ce59a5eb3b6d895095d1b7
- Instructions
- 63 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)
# Set Up Git Guardrails
The guardrail ships with this package as a Pi extension: `extensions/git-guardrails.ts`. It hooks `tool_call`, and a `bash` call whose command matches a dangerous-git pattern is blocked before it executes, with the reason returned to you. Nothing else is affected.
The extension is inert until the user opts in, so installing this package never changes anyone's git behaviour by surprise. Opting in is writing one small JSON file; the guardrail then applies in that scope. The config file is re-read on every `bash` call, so an opt-in, an `"enabled": false`, or a `patterns` change takes effect immediately; the default pattern list in the sidecar is read once when the session loads, so editing *that* file needs a new session or `/reload`.
## 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 reason reads: `BLOCKED: '<command>' matches dangerous pattern '<pattern>'. The user has prevented you from running this command.`
## Steps
### 1. Ask scope
Ask the user: opt in for **this project only** or **all projects**?
- **Project**: `.pi/git-guardrails.json` in the repo root.
- **Global**: `~/.pi/agent/git-guardrails.json`.
### 2. Write the opt-in file
Write the chosen file (create `.pi/` if needed):
```json
{
"enabled": true
}
```
That is the whole opt-in. Leave `patterns` out and the guardrail uses the default list from the skill's own [scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh), which the extension reads at load time. Add a `patterns` array only if the user wants to replace the default list.
If the file already exists, merge `"enabled": true` into it rather than overwriting other keys.
### 3. Ask about customization
Ask if the user wants to change what is blocked.
- **Add or remove patterns**: edit the `DANGEROUS_PATTERNS` array in [scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh) — that file is the single source of truth for the default list, and both the extension and the standalone check use it.
- **Per-project override**: put a `patterns` array in that project's `.pi/git-guardrails.json`. When present it replaces the default list for that scope.
Patterns are regular expressions matched anywhere in the command, the same semantics upstream used.
### 4. Verify
Check the pattern list standalone by passing a command to the sidecar:
```bash
bash skills/misc/git-guardrails/scripts/block-dangerous-git.sh "git push origin main"
```
It prints `BLOCKED: …` and exits 1 for a match, and exits 0 for a safe command such as `git status`.
Then confirm the extension is live: ask the user to run a command that should be blocked, or note that the next matching `bash` call in this session is blocked with the reason above.
To turn the guardrail off without deleting the file, set `"enabled": false`; for one session, set `PI_GIT_GUARDRAILS=off`.From netname/pi-adapted-mp-skills, MIT.
More from netname/pi-adapted-mp-skills
- 0.504score
diagnosing-bugs
netname
Diagnosis loop for hard bugs and performance regressions.
SkillBFreshness: BClaude Code +9 - 0.499score
codebase-design
netname
Shared vocabulary for designing deep modules.
SkillBFreshness: BClaude Code +9 - 0.499score
domain-modeling
netname
Build and sharpen a project's domain model.
SkillBFreshness: BClaude Code +9 - 0.499score
tdd
netname
Test-driven development.
SkillBFreshness: BClaude Code +9 - 0.499score
prototype
netname
Build a throwaway prototype to answer a design question.
SkillBFreshness: BClaude Code +9 - 0.499score
research
netname
Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo.
SkillBFreshness: BClaude Code +9 - 0.499score
code-review
netname
Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding…
SkillBFreshness: BClaude Code +9 - 0.496score
improve-codebase-architecture
netname
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
SkillBFreshness: BClaude Code +9 - 0.496score
to-spec
netname
Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.
SkillBFreshness: BClaude Code +9 - 0.496score
to-tickets
netname
Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker…
SkillBFreshness: BClaude Code +9 - 0.496score
triage
netname
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
SkillBFreshness: BClaude Code +9 - 0.496score
wayfinder
netname
Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time…
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Sep 19, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/netname/pi-adapted-mp-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from netname
- 0.504score
diagnosing-bugs
netname
Diagnosis loop for hard bugs and performance regressions.
SkillBFreshness: BClaude Code +9 - 0.499score
prototype
netname
Build a throwaway prototype to answer a design question.
SkillBFreshness: BClaude Code +9 - 0.499score
domain-modeling
netname
Build and sharpen a project's domain model.
SkillBFreshness: BClaude Code +9 - 0.499score
codebase-design
netname
Shared vocabulary for designing deep modules.
SkillBFreshness: BClaude Code +9 - 0.499score
code-review
netname
Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding…
SkillBFreshness: BClaude Code +9 - 0.499score
research
netname
Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo.
SkillBFreshness: BClaude Code +9
Cite this page
git-guardrails skill. Agent Mart. https://agentmart.dev/skills/netname-git-guardrails (last updated 2026-10-24)