git-guardrails-claude-code

Block dangerous git commands before execution using Claude Code PreToolUse hooks.

Updated Jun 6, 2026
One-click install
npx skills add https://github.com/guille-gallo/auth-kit --skill git-guardrails-claude-code-guille-gallo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/guille-gallo/auth-kit/tree/main/.agents/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/guille-gallo/auth-kit --skill git-guardrails-claude-code-guille-gallo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill ensures that dangerous git commands are blocked before they execute, offering a safety layer for your codebase.

Core Features & Use Cases

  • Block Destructive Commands: Intercepts and blocks commands like push, reset --hard, clean, branch -D, etc.
  • Customizable: Ask the user whether to install for this project or all projects and customize the blocked list.
  • Easy Setup: Follow simple steps to copy the hook script and add it to the settings file.

Quick Start

Install the git-guardrails-claude-code skill and follow the setup instructions to add a PreToolUse hook that blocks 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 prevent destructive git commands from executing in Claude Code?

You can block dangerous git commands in Claude Code by installing a PreToolUse hook script that intercepts and prevents operations like push, reset --hard, and clean from executing.

What git commands should I block to protect my codebase?

To protect your codebase, you should block destructive git commands like push, reset --hard, clean, and branch -D using a customizable command interception pattern list.

Can I customize which dangerous git commands are blocked by Claude Code hooks?

Yes, you can customize the blocked git command list when setting up the Claude Code PreToolUse hook, allowing you to tailor the safety layer to your specific project requirements.

How do I set up git guardrails for a specific project versus globally?

Setting up git guardrails allows you to choose between project-specific or global installation scope, determining whether the PreToolUse hook applies to one repository or all projects.

Does Claude Code PreToolUse hook support Bash scripts for blocking git operations?

Claude Code PreToolUse hooks do support Bash scripts, allowing you to execute a script that evaluates and blocks dangerous git commands before they are processed by the tool.

What are the limitations of using hooks to block git commands in Claude Code?

Limitations of using hooks to block git commands include relying on the PreToolUse mechanism to intercept Bash commands, which requires proper settings configuration and pattern matching to be effective.