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 tt-a1i
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/tt-a1i-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 tt-a1i/matt-skills-with-to-goal, MIT.
More from tt-a1i/matt-skills-with-to-goal
- 0.699score
to-goal
tt-a1i
Turn approved planning evidence or partially completed work into a portable, verifiable execution goal.
SkillBFreshness: B★ 187Claude Code +9 - 0.699score
execute-spec-in-fork
tt-a1i
Orchestrate approved, bounded work through a same-directory Codex App fork: create and name the execution task, ask it to run spec-executor, route decisions…
SkillBFreshness: B★ 187Claude Code +9 - 0.699score
goal-crafter
tt-a1i
Craft verifiable, tight goal prompts for AI coding agents (Claude Code /goal, Codex Automations, Pi), either from a standalone task interview or from an…
SkillBFreshness: B★ 187Claude Code +9 - 0.695score
spec-executor
tt-a1i
Execute approved, bounded work in an isolated implementation conversation and return a structured evidence receipt.
SkillBFreshness: B★ 187Claude Code +9 - 0.695score
roundtable
tt-a1i
Convene a roundtable of sub-agents that debate a decision or proposal from opposing perspectives — parallel independent statements, anonymous cross-review…
SkillBFreshness: B★ 187Claude Code +9 - 0.622score
grilling
tt-a1i
Grill the user relentlessly about a plan, decision, or idea.
SkillAFreshness: A★ 187Claude Code +9 - 0.619score
to-tickets
tt-a1i
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…
SkillAFreshness: A★ 187Claude Code +9 - 0.619score
improve-codebase-architecture
tt-a1i
Scan a codebase for deepening opportunities, present them as a report — HTML on request — then grill through whichever one you pick.
SkillAFreshness: A★ 187Claude Code +9 - 0.619score
triage
tt-a1i
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
SkillAFreshness: A★ 187Claude Code +9 - 0.619score
handoff
tt-a1i
Compact the current conversation into a portable handoff document, with an optional live clarification path for compatible Codex tasks.
SkillAFreshness: A★ 187Claude Code +9 - 0.616score
ask-matt
tt-a1i
Ask which skill or flow fits your situation.
SkillAFreshness: A★ 187Claude Code +9 - 0.584score
codebase-design
tt-a1i
Shared vocabulary for designing deep modules.
SkillBFreshness: B★ 187Claude Code +9
Signals
- Stars
- 187
- Forks
- 21
- Open issues
- 7
- Last commit (this folder)
- Aug 19, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- 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.362score
git-guardrails-claude-code
dengmuming
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: A★ 7Claude 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.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
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.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.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 tt-a1i
- 0.837score
archify
tt-a1i
Create validated architecture, workflow, sequence, data-flow, lifecycle/state, ERD, class, tree, timeline, and waterfall diagrams as explorable standalone…
SkillAFreshness: A★ 88.7KClaude Code +9 - 0.837score
simplify-codebase
tt-a1i
Simplification audit or authorized codebase simplification whose stated objective is to remove accidental complexity.
SkillAFreshness: A★ 88.7KClaude Code +9 - 0.834score
archify-tuning
tt-a1i
Improve Archify diagram accuracy, visual quality and complete authoring speed with fewer repairs.
SkillAFreshness: A★ 88.7KClaude Code +9 - 0.823score
archify-review
tt-a1i
Review Archify issues, PRs, or code through value, cost, and impact to support evidence-based maintenance decisions.
SkillAFreshness: A★ 88.7KClaude Code +9 - 0.699score
execute-spec-in-fork
tt-a1i
Orchestrate approved, bounded work through a same-directory Codex App fork: create and name the execution task, ask it to run spec-executor, route decisions…
SkillBFreshness: B★ 187Claude Code +9 - 0.699score
goal-crafter
tt-a1i
Craft verifiable, tight goal prompts for AI coding agents (Claude Code /goal, Codex Automations, Pi), either from a standalone task interview or from an…
SkillBFreshness: B★ 187Claude Code +9
Cite this page
git-guardrails-claude-code skill. Agent Mart. https://agentmart.dev/skills/tt-a1i-git-guardrails-claude-code (last updated 2026-10-24)