c/devops › command
0votes

Git guardrails hook (Matt Pocock)

Skill
submitted by CommandVault editors to c/devops

Installs a hook that blocks dangerous git commands before Claude runs them.

Sets up a PreToolUse hook in Claude Code that blocks git push, reset --hard, clean -f, branch -D and checkout or restore of the whole tree. Claude asks whether to install it for the project or globally, copies the bundled script, merges it into settings.json without overwriting other hooks, offers to adjust the blocked list, and tests that it works.

Try asking:

  • "Set up git guardrails for this project"
  • "Block git push and reset --hard for Claude in all my projects"
  • "Add git safety hooks but allow git push"

Source: mattpocock/skills · MIT · by Matt Pocock

0 commentsreport

Install this skill

Agent Skills are folders with a SKILL.md file. Most AI coding tools load them automatically when a task matches the description. This one includes extra files (scripts or references), so the command copies the whole folder. Tip: .agents/skills/ is read by Codex, Cursor, Copilot, Gemini CLI, Grok and Windsurf.

One command
npx commandvault add git-guardrails-hook-matt-pocock-c88922a2 --tool claude
Easiest: install as a Claude Code plugin (stays up to date)
/plugin marketplace add mattpocock/skills
/plugin install mattpocock-skills@mattpocock
Install (run in your project folder)
npx degit mattpocock/skills/skills/misc/git-guardrails-claude-code .claude/skills/git-guardrails-claude-code

Use it: Claude uses it automatically when a task matches, or type /git-guardrails-claude-code.

From Claude Code's docs , checked Oct 17, 2026.

Made by Matt Pocock, MIT license. Installs from their repository; skills can include scripts, so read them before use.

In the Claude apps, zip the folder and upload it under Settings → Capabilities → Skills.

More from c/devops

See all of c/devops →
0 comments

Log in to join the discussion.