git-guardrails-claude-code

Block dangerous git commands before execution using Claude Code hooks.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/pxlcrtiv/opencode-setup --skill git-guardrails-claude-code-pxlcrtiv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/pxlcrtiv/opencode-setup/tree/main/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/pxlcrtiv/opencode-setup --skill git-guardrails-claude-code-pxlcrtiv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Avoids accidental destructive operations in git by setting up Claude Code hooks that block dangerous git commands before they are executed.

Core Features & Use Cases

  • Block Dangerous Commands: Prevents git commands like push, reset --hard, clean, branch -D, etc.
  • Project or Global Scope: Applies the block to a single project or all projects depending on user preference.
  • Customization: Allows the user to add or remove patterns from the blocked list.

Quick Start

Run the command: 'Set up git-guardrails for this project only.'

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 destructive git commands in Claude Code?

To block destructive git commands in Claude Code, you can set up git hooks that intercept and prevent dangerous operations like push, reset --hard, and clean before they execute. This adds a safety layer to your workflow.

What git commands should I prevent AI assistants from running?

You should block git commands that cause irreversible data loss, such as push, reset --hard, clean, and branch -D. Setting up command blocking prevents accidental destructive operations during automated workflows.

Can I apply git safety checks to a single project or globally?

Yes, you can apply git safety checks to either a single project or globally across all projects. This flexibility allows you to customize command blocking based on your specific repository requirements.

How do I customize which git commands are blocked by hooks?

You can customize which git commands are blocked by adding or removing patterns from the blocked list in your project settings. This allows you to tailor the safety checks to your specific workflow needs.

Do I need Claude Code to set up git command blocking?

Yes, you need Claude Code and the ability to modify project settings to set up git command blocking. The hooks integrate directly with Claude Code to intercept and prevent dangerous git commands.

Why do my git hooks not block destructive commands in Claude Code?

Git hooks may not block destructive commands if the patterns are not properly configured in the blocked list or if the hooks are not set up with the correct scope, either project-specific or global.