We ran 28 git commands through Claude Code's most-installed git guardrail
The most-installed git skill for Claude Code is git-guardrails-claude-code, Matt Pocock's git safety skill , with 523,036 all-time installs on the skills.sh registry as of November 7, 2026. It lives in mattpocock/skills on GitHub (317,373 stars the same day). It does one job. In the words of its SKILL.md, it "Sets up a PreToolUse hook that intercepts and blocks dangerous git commands before…
The most-installed git safety skill for Claude Code, named git-guardrails-claude-code, has achieved an impressive 523,036 installations as of November 7, 2026. Created by Matt Pocock, this skill resides in the GitHub repository mattpocock/skills, boasting 317,373 stars at the same time. Its purpose is straightforward: intercept and block dangerous git commands before Claude executes them, as outlined in its SKILL.md file.
To achieve this, the skill sets up a PreToolUse hook that intercepts and halts dangerous git commands. While this is more reliable than a rule in CLAUDE.md, because a hook runs on every tool call, its effectiveness relies on the patterns it uses. To test its capabilities, we ran 28 git commands through Claude Code and analyzed the results.
The skill copies block-dangerous-git.sh into either .claude/hooks/ (for a single project) or ~/.claude/hooks/ (for all projects), then registers it under hooks.PreToolUse using a Bash matcher. Upon receiving a shell command, the hook processes it via a JSON payload on stdin. The command string is located at .tool_input.command. If a command matches any of the predefined dangerous patterns, the hook prints an error message to stderr and exits with code 2, which Claude Code then prevents from executing.
The block-dangerous-git.sh script, consisting of just 25 lines, reads the command using jq, loops through a list of dangerous patterns, and runs grep -qE against each entry. If a match is found, the script prints a "BLOCKED" message and exits with code 2. The list of dangerous patterns includes commands like git push, git reset --hard, git clean -fd, git clean -f, git branch -D, git checkout ., git restore ., push --force, reset --hard, and more.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.