git-guardrails-claude-code

Block dangerous Git commands before execution in Claude Code.

Updated May 15, 2026
One-click install
npx skills add https://github.com/ruskibeats/t1d --skill git-guardrails-claude-code-ruskibeats
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/ruskibeats/t1d/tree/main/.agents/skills-archive/misc/git-guardrails-claude-code
Command: npx skills add https://github.com/ruskibeats/t1d --skill git-guardrails-claude-code-ruskibeats

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill ensures the safety of Git operations by blocking dangerous commands like push, reset --hard, and clean before they are executed, providing a safeguard against unintended destructive actions.

Core Features & Use Cases

  • Git Command Blocking: Prevents harmful commands such as push, reset --hard, clean, branch -D, etc.
  • Selective Blocking: Allows for project-specific or global configuration to block these commands.
  • Customization: Offers the option to add or remove patterns from the blocked list.
  • Verification: Includes a test to verify the blocking is functioning correctly.

Quick Start

Install the Git Guardrails for this project by copying the provided script to the project's .claude/hooks/block-dangerous-git.sh and adding the appropriate configuration to .claude/settings.json.

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 like push and reset --hard in Claude Code?

You can block dangerous Git commands in Claude Code by installing a shell script hook that intercepts and rejects specific destructive operations before execution. This safeguard prevents unintended data loss during development.

Can I configure Git command blocking globally across all my projects?

Yes, Git command blocking supports both project-specific and global configuration across all projects in Claude Code. You can selectively apply safety rules to individual repositories or enforce them universally.

What Git commands are prevented by the command blocking hook?

The command blocking hook prevents destructive Git commands such as push, reset --hard, clean, and branch -D. It intercepts these operations before execution to protect your repository from unintended destructive actions.

How do I customize which Git commands are blocked by the hook?

You can customize the blocked command list by adding or removing patterns from the shell script. This allows you to tailor the safety layer to your specific development workflow and repository requirements.

How do I verify that Git command blocking is working correctly?

You can verify Git command blocking is functioning correctly by running the included test. This verification ensures your safety hooks are properly intercepting and rejecting dangerous commands before execution.

Do I need any dependencies to set up Git safety hooks in Claude Code?

No dependencies are required to set up Git safety hooks in Claude Code. You simply copy the provided shell script to your project's hook directory and add the appropriate configuration to your settings file.