git-guardrails-claude-code
Use when the user wants dangerous git commands (push, reset --hard, clean, branch -D, checkout/restore .) blocked by a Claude Code hook before they run — the…
Skill by dekoza
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/dekoza-git-guardrails-claude-code
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-claude-code
What's inside
- Skill name
git-guardrails-claude-code- Description
- Use when the user wants dangerous git commands (push, reset --hard, clean, branch -D, checkout/restore .) blocked by a Claude Code hook before they run — the git-discipline rules enforced mechanically rather than by prompt. Triggers on: "block dangerous git commands", "git safety hooks", "prevent destructive git operations", "stop the agent force-pushing".
- License
- Unlicense
- Instructions
- 92 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 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](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`):
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
```
**Global** (`~/.claude/settings.json`):
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
```
If the settings file already exists, merge the hook into existing `hooks.PreToolUse` array — don't overwrite other settings.
### 4. Ask about customization
Ask if user wants to add or remove any patterns from the blocked list. Edit the copied script accordingly. In particular, plain `git push` is blocked by default — if the user routinely wants the agent to push to their own remotes (e.g. a self-hosted Gitea), suggest narrowing that pattern to `push --force`.
### 5. 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 dekoza/oh-my-slop, Unlicense.
More from dekoza/oh-my-slop
- 0.614score
skill-creator
dekoza
Use when creating or editing SKILL.md files, diagnosing skill-triggering failures, or measuring whether a skill improves agent behavior.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
resolving-merge-conflicts
dekoza
Use when a git merge or rebase is stopped mid-way with conflicting files.
SkillAFreshness: A★ 4Claude Code +9 - 0.605score
diagnosing-bugs
dekoza
Use when facing a bug with no obvious cause, a performance regression, or 5+ test failures at once.
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
setup-project-skills
dekoza
Configure project workflow bindings, preservation policy and launch gates.
SkillAFreshness: A★ 4Claude Code +9 - 0.574score
enterprise-patterns
dekoza
Use when an enterprise app's infrastructure decisions are in play — where business logic lives, transaction and identity coordination, application-level…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
construction-craft
dekoza
Use when implementation is blocked by unclear construction prerequisites or tangled routine/data shape, or when system knowledge and artifacts are drifting…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
domain-driven-design
dekoza
Business complexity, model language, lifecycle rules, or cross-team/system boundaries shape the design more than generic technical organization.
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
legacy-code
dekoza
Changing code that is expensive to change safely because behavior is unclear, tests are weak or missing, dependencies are hidden, or runtime/framework setup…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
production-readiness
dekoza
Services, APIs, jobs, queues, deployment paths, and critical flows that must survive production failures, overload, latency, bad data, and operational mistakes.
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
refactoring-pass
dekoza
Changing existing code structure without intending to change observable behavior.
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
codebase-design
dekoza
Use when designing or restructuring a module and reaching for the shared deep-module vocabulary — interface, seam, depth, adapter, leverage, locality — to…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
data-intensive
dekoza
Systems where correctness depends on data ownership, consistency, durability, replication, partitioning, schema evolution, event flow, replay, or derived-data…
SkillBFreshness: B★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 6, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Unlicense
- Repository
- github.com/dekoza/oh-my-slop
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from dekoza
- 0.614score
skill-creator
dekoza
Use when creating or editing SKILL.md files, diagnosing skill-triggering failures, or measuring whether a skill improves agent behavior.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
resolving-merge-conflicts
dekoza
Use when a git merge or rebase is stopped mid-way with conflicting files.
SkillAFreshness: A★ 4Claude Code +9 - 0.605score
diagnosing-bugs
dekoza
Use when facing a bug with no obvious cause, a performance regression, or 5+ test failures at once.
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
setup-project-skills
dekoza
Configure project workflow bindings, preservation policy and launch gates.
SkillAFreshness: A★ 4Claude Code +9 - 0.574score
construction-craft
dekoza
Use when implementation is blocked by unclear construction prerequisites or tangled routine/data shape, or when system knowledge and artifacts are drifting…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
documentation-lifecycle
dekoza
Use when documentation must stay truthful as software changes — writing or revising a spec, ADR, runbook, or API/config reference, splitting user-facing docs…
SkillBFreshness: B★ 4Claude Code +9
Cite this page
git-guardrails-claude-code skill. Agent Mart. https://agentmart.dev/skills/dekoza-git-guardrails-claude-code (last updated 2026-10-24)