Git Guardrails

Install a hook that blocks destructive git commands before an AI agent runs them. Use when an agent force-pushed or ran reset --hard, when adding git safety hooks, or when protecting main from agent pushes.

1,157 stars 217 forksGit & Code Review Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add borghei/Claude-Skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

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

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

From the SKILL.md

# Git Guardrails

An agent with shell access can run `git reset --hard`, `git clean -fdx` or
`git push --force` as casually as `ls`, usually while trying to make a failing
command pass. This skill installs a **PreToolUse hook** that reads every Bash
call before it runs, parses the git invocations inside it (chains, subshells,
`bash -c`, `xargs`, `git -C`), and blocks the destructive ones with exit code 2
and a reason the agent can act on. It ships the hook, an installer that merges
into `.claude/settings.json` without overwriting anything, plain git `pre-push`
and `pre-rebase` hooks for non-agent callers, and a corpus tester that proves
which commands are allowed and which are blocked.

## When to use this skill

- **After an incident**: an agent discarded uncommitted work, deleted a branch,
  or force-pushed over a teammate's commits
- **Before giving an agent autonomy**: auto-accept mode, background agents,
  long unattended runs, or several agents in parallel worktrees
- **Protecting shared branches**: no direct pushes or rebases on `main`,
  `release/*`, `production`
- **Auditing an existing guardrail**: run its hook against the corpus to see what
  it actually catches
- **Rolling guardrails out to a team**: one committed project-scope hook plus a
  CI-runnable test

Not for server-side branch protection (configure that in your Git host) or for
general command sandboxing; this guards git specifically.

## Clarify First
Read the full skill on GitHub

Details

Skill name
git-guardrails
Path
engineering/git-guardrails/SKILL.md
Repo updated
8 November 2026

FAQ

What does the Git Guardrails skill do?

Install a hook that blocks destructive git commands before an AI agent runs them. Use when an agent force-pushed or ran reset --hard, when adding git safety hooks, or when protecting main from agent pushes.

How do I install the Git Guardrails skill?

Claude Code plugin: /plugin marketplace add borghei/Claude-Skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Git Guardrails popular?

It lives in borghei/Claude-Skills, which has 1,157 GitHub stars and 217 forks, and is included in 1 curated skill list.

Related skills

Cto Advisor

1.2k

borghei/Claude-Skills

Technical leadership guidance for engineering teams, architecture decisions, and technology strategy. Use when assessing technical debt, scaling engineering teams, evaluating technologies, or making architecture decisions.

Software DevelopmentIn 1 list217

Customer Success Manager

1.2k

borghei/Claude-Skills

Monitors customer health, predicts churn risk, and identifies expansion opportunities using weighted scoring models for SaaS customer success

Marketing, Sales & BusinessIn 1 list217

Financial Analyst

1.2k

borghei/Claude-Skills

Performs financial ratio analysis, DCF valuation, budget variance analysis, and rolling forecast construction for strategic decision-making

Finance & CryptoIn 1 list217

Git Worktree Manager

1.2k

borghei/Claude-Skills

Run parallel Git worktrees without collisions: a port block per worktree, .env sync, health checks for stale or dirty trees, and safe cleanup of merged ones. Use when several branches or agents need running dev servers at once.

Git & Code ReviewIn 1 list217

Changelog Generator

1.2k

borghei/Claude-Skills

Generate changelogs and release notes from Conventional Commits with semver bump detection, Keep a Changelog formatting, and monorepo scopes. Use when preparing releases, enforcing commit standards, or automating release notes.

Git & Code ReviewIn 1 list217

PR Description Writer

1.2k

borghei/Claude-Skills

Write PR descriptions with evidence, verification steps and a one-way/two-way merge-risk call. Use when opening a PR, when asked to write or fix a PR body, or when checking a description before requesting review.

Git & Code ReviewIn 1 list217

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