# Git Guardrails for Claude Code

Set up Claude Code hooks that guard against destructive Git commands\.

Canonical: https://claudelist.com/listings/skill-mattpocock-skills-git-guardrails-claude-code

Category: Skills

Source: community · Matt Pocock

Source checked: 2026-10-14

Website: https://github.com/mattpocock/skills/tree/main/skills/misc/git-guardrails-claude-code

Set up Claude Code hooks that guard against destructive Git commands. The upstream SKILL.md and its supporting files are maintained in mattpocock/skills.

## Install or set up

1. Read git-guardrails-claude-code’s SKILL.md and check its prerequisites at the source.
2. In your Claude Code project, run the command below to install this individual skill in project scope. Add `-g` if you want it in your personal scope.
3. Restart Claude Code and invoke `/git-guardrails-claude-code` or ask Claude to use the skill. If it is unavailable, check `.claude/skills/` and the upstream setup notes.

```sh
npx skills add https://github.com/mattpocock/skills/tree/main/skills/misc/git-guardrails-claude-code --agent claude-code
```

Installation guide: https://www.skills.sh/mattpocock/skills/git-guardrails-claude-code
