git-guardrails-claude-code

Install a PreToolUse hook to block dangerous git commands in Claude Code.

3|2|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/wesleyegberto/software-engineering-skills --skill git-guardrails-claude-code-wesleyegberto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/wesleyegberto/software-engineering-skills/tree/main/plugins/programming-skills/skills/git-guardrails
Command: npx skills add https://github.com/wesleyegberto/software-engineering-skills --skill git-guardrails-claude-code-wesleyegberto

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, and includes scripts (resource) components.

What problem does it solve?

Prevents destructive git operations by blocking dangerous commands before they execute.

Core Features & Use Cases

  • Blocks dangerous git operations like git push (including --force), git reset --hard, git clean, and git branch -D to prevent destructive changes.
  • Provides a guided setup workflow to install the hook on a single project or globally, and merge with existing settings.
  • Uses a bundled script at scripts/block-dangerous-git.sh to enforce safety in Claude Code.

Quick Start

Install the PreToolUse hook, copy the block-dangerous-git.sh script to the target location, and update Claude Code settings to block dangerous git commands.

Frequently Asked Questions about git-guardrails-claude-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I block dangerous git commands in Claude Code?

You can block dangerous git commands in Claude Code by installing a PreToolUse hook that intercepts operations like git push, git reset --hard, and git clean before they execute.

What git operations should I prevent AI assistants from running automatically?

Destructive git operations like git push --force, git reset --hard, git clean, and git branch -D should be blocked to prevent irreversible changes to your repository history and files.

Can I install a git pretooluse hook globally across all my projects?

Yes, the guided setup workflow allows you to install the PreToolUse hook either on a single project or globally, automatically merging the configuration into your existing Claude Code settings.

Do I need jq to set up git guardrails for Claude Code?

Yes, jq is required as a dependency to parse and merge the hook configuration into your existing Claude Code settings during the installation process.

How do I test that blocked git commands are actually intercepted by the hook?

After installation, you can verify the hook is active by running a blocked git command; it should return a specific BLOCKED message indicating the PreToolUse interceptor successfully prevented execution.