git-guardrails-claude-code
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
Skill by dengmuming
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/dengmuming-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: not checked yet.
What's inside
- Skill name
git-guardrails-claude-code- Description
- Set up 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 in Claude Code.
- License
- MIT
- Instructions
- 92 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (3)
- SKILL.md
- openai.yaml · agents/
- 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 the 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.
### 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 dengmuming/ai-vibe-coding, MIT.
More from dengmuming/ai-vibe-coding
- 0.626score
go-init
dengmuming
基于 gin + gorm + redis + zap + mix-go/xcli 的 Go 后端项目脚手架规范(源自 mindcloudxai_api 的实战架构)。Claude 应在用户提到 "初始化 Go 项目"、"创建 Go 后端服务"、"搭建 gin 项目"、"新建 Go API 项目"、"按…
SkillAFreshness: A★ 7Claude Code +9 - 0.624score
grill-code-review
dengmuming
Review changes since a fixed point along two independent axes — repository standards and the originating spec.
SkillAFreshness: A★ 7Claude Code +9 - 0.624score
find-simplifications
dengmuming
Use when working in a codebase to find non-obvious simplification candidates, write proposed design notes or inline TODO/FIXME/XXX notes, or fold worthwhile…
SkillAFreshness: A★ 7Claude Code +9 - 0.621score
dispatch
dengmuming
安全执行一个已经明确的工作项批次并返回可验证结果。Prepare 把批次整理到可执行、Dispatch 安排隔离 worktree 与执行器执行、Resume 恢复中断的执行。当用户给出一批已经明确的工作项(任务单、ticket、改动清单)要求执行时使用。跨会话的目标管理与验收生命周期不归本 skill。
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
dev
dengmuming
从想法到上线的一条龙研发流程——grill 压实想法、to-spec 写成 spec、to-tickets 拆成工单、implement 落地代码。用户输入 /dev 触发,也可从任一段中途进入。
SkillAFreshness: A★ 7Claude Code +9 - 0.610score
debugging
dengmuming
Systematically debug an error or unexpected behavior.
SkillAFreshness: A★ 7Claude Code +9 - 0.599score
domain-modeling
dengmuming
Build and sharpen a project's domain model.
SkillAFreshness: A★ 7Claude Code +9 - 0.599score
codebase-design
dengmuming
Shared vocabulary for designing deep modules.
SkillAFreshness: A★ 7Claude Code +9
Signals
- Stars
- 7
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 11, 2026 (17 days ago)
- Last release
- Oct 11, 2026 (17 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/dengmuming/ai-vibe-coding
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.750score
git-guardrails-claude-code
mattpocock
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.366score
git-guardrails-claude-code
chinkan
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: A★ 10Claude Code +9 - 0.363score
git-guardrails-claude-code
Sarthib7
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: A★ 10Claude Code +9 - 0.361score
git-guardrails-claude-code
caterpi11ar
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: A★ 8Claude Code +9 - 0.353score
git-guardrails-claude-code
tt-a1i
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillBFreshness: B★ 187Claude Code +9 - 0.337score
git-guardrails-claude-code
fveracoechea
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: A★ 1Claude Code +9 - 0.327score
git-guardrails-claude-code
alexcamlo
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: AClaude Code +9 - 0.327score
git-guardrails-claude-code
Grindhead
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: AClaude Code +9 - 0.327score
git-guardrails-claude-code
JacobStephens2
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: AClaude Code +9 - 0.324score
git-guardrails-claude-code
arcdigital
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: AClaude Code +9 - 0.324score
git-guardrails-claude-code
Saifa-96
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: AClaude Code +9 - 0.313score
git-guardrails-claude-code
Huazzi
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillBFreshness: B★ 1Claude Code +9
More from dengmuming
- 0.626score
go-init
dengmuming
基于 gin + gorm + redis + zap + mix-go/xcli 的 Go 后端项目脚手架规范(源自 mindcloudxai_api 的实战架构)。Claude 应在用户提到 "初始化 Go 项目"、"创建 Go 后端服务"、"搭建 gin 项目"、"新建 Go API 项目"、"按…
SkillAFreshness: A★ 7Claude Code +9 - 0.624score
find-simplifications
dengmuming
Use when working in a codebase to find non-obvious simplification candidates, write proposed design notes or inline TODO/FIXME/XXX notes, or fold worthwhile…
SkillAFreshness: A★ 7Claude Code +9 - 0.624score
grill-code-review
dengmuming
Review changes since a fixed point along two independent axes — repository standards and the originating spec.
SkillAFreshness: A★ 7Claude Code +9 - 0.621score
dispatch
dengmuming
安全执行一个已经明确的工作项批次并返回可验证结果。Prepare 把批次整理到可执行、Dispatch 安排隔离 worktree 与执行器执行、Resume 恢复中断的执行。当用户给出一批已经明确的工作项(任务单、ticket、改动清单)要求执行时使用。跨会话的目标管理与验收生命周期不归本 skill。
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
dev
dengmuming
从想法到上线的一条龙研发流程——grill 压实想法、to-spec 写成 spec、to-tickets 拆成工单、implement 落地代码。用户输入 /dev 触发,也可从任一段中途进入。
SkillAFreshness: A★ 7Claude Code +9 - 0.610score
debugging
dengmuming
Systematically debug an error or unexpected behavior.
SkillAFreshness: A★ 7Claude Code +9
Cite this page
git-guardrails-claude-code skill. Agent Mart. https://agentmart.dev/skills/dengmuming-git-guardrails-claude-code (last updated 2026-10-24)