Git Guardrails Claude Code

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.

5 stars 2 forksGit & Code Review

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add GAGAA-HUE/ASHUO-claude-skills --skill git-guardrails-claude-code
Manual install
git clone --depth 1 https://github.com/GAGAA-HUE/ASHUO-claude-skills.git /tmp/ASHUO-claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/ASHUO-claude-skills/git-guardrails-claude-code ~/.claude/skills/git-guardrails-claude-code

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# 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`):
Read the full skill on GitHub

Details

Skill name
git-guardrails-claude-code
Path
git-guardrails-claude-code/SKILL.md
Repo updated
3 November 2026
Copies
Found in 2 GitHub repos

FAQ

What does the Git Guardrails Claude Code skill do?

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.

How do I install the Git Guardrails Claude Code skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add GAGAA-HUE/ASHUO-claude-skills --skill git-guardrails-claude-code. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Git Guardrails Claude Code popular?

It lives in GAGAA-HUE/ASHUO-claude-skills, which has 5 GitHub stars and 2 forks, and is included in 2 curated skill lists.

Related skills

Domain Modeling

5

GAGAA-HUE/ASHUO-claude-skills

Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model.

AI, LLMs & AgentsIn 2 lists

Setup Pre Commit

5

GAGAA-HUE/ASHUO-claude-skills

Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.

Testing & QAIn 2 lists

Writing Great Skills

5

GAGAA-HUE/ASHUO-claude-skills

Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.

Writing & ContentIn 2 lists

Git

9

thechandanbhagat/claude-skills

Git operations, conflict resolution, history management, and Git workflows. Use for complex Git operations and version control tasks.

Git & Code Review

Wonder Pill

10

thatmike1/claude-skills

Turns open-ended requests into things to think WITH instead of answers to accept. Audits the hidden assumptions inside a topic, inverts them into sharp "what if" provocations, branches each one outward, and delivers an interactive mind map (a standalone html file opened locally) plus the written wonderings. Use this whenever someone wants ideas, brainstorming, exploration, inspiration, or a direction to head in — "give me ideas for X", "help me brainstorm", "I'm stuck on what to do for my science fair / project / story / thesis", "what are some angles on X" — and especially when they seem to w

Git & Code Review

Code Review Zh

6

RazorEdge-wyh/zh-skills

审查代码时使用。按中文工程规范对代码做 review:命名、注释、可读性、错误处理、边界、安全、性能。特别关注中文项目里的拼音命名、翻译腔注释、神秘缩写。

Git & Code Review

Browse the most popular Claude skills, all git & code review skills, or write your own with the skills generator.