Skills Explorer Add Skills

git-guardrails-claude-code

An agent skill by mattpocock, from mattpocock/skills. Tags: access-control, automation, claude-code, git, security.

What it does

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.

Install

With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:

npx skills add mattpocock/skills --skill git-guardrails-claude-code

Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):

git clone --depth 1 https://github.com/mattpocock/skills
cp -r skills/skills/misc/git-guardrails-claude-code ~/.claude/skills/git-guardrails-claude-code

Safety box score

Grade B, low risk: 11 of 100 risk points, rated 2026-10-15. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.

This skill installs a local Claude Code pre-tool hook that blocks a short list of dangerous git commands before they run. It only touches Claude config/hooks and executes a small bash script, with the main risks being local file changes, broad global scope if chosen, and some overblocking from substring-based matching.

Category levels, from 0 (none) to 3 (high)
CategoryLevelWhy
Code & shell execution1 (low)It installs and runs a local hook script (`#!/bin/bash`) and makes it executable with `chmod +x`, but the script only inspects command text and exits.
Network access0 (none)No downloads or remote endpoints are used; the files shown contain no `curl`, `wget`, or external network calls.
Filesystem reach2 (moderate)It copies a script into `.claude/hooks/block-dangerous-git.sh` or `~/.claude/hooks/block-dangerous-git.sh` and edits `.claude/settings.json` or `~/.claude/settings.json`, which can affect one project or all projects.
Secrets & credentials0 (none)The skill does not reference tokens, keys, `.env` files, browser sessions, or other credential stores.
Privilege & persistence0 (none)It does not ask for sudo, install services, change shell startup files, or make system-wide OS changes; it only updates Claude-local config.
Instruction hijack surface0 (none)There is no prompt injection, hidden text, or instruction to ignore safeguards; the hook uses fixed blocked patterns and plain setup steps.
Irreversible actions0 (none)The skill does not push, delete, deploy, or send anything itself; it blocks `git push`, `git reset --hard`, `git clean -f`, and similar commands before execution.
Transparency0 (none)All shipped files are plain text shell/markdown/YAML; there are no binaries, base64 blobs, or remotely fetched installers.

Before installing

Rated 2026-10-15 by an automated review of 3 files from the skill's repository.

Source

Repository
mattpocock/skills (all skills from this repository)
Path
skills/misc/git-guardrails-claude-code/SKILL.md
Branch
main
Updated
2026-10-05