git-guardrails-claude-code

Block destructive Git commands before execution in Claude Code workflows.

Updated Jun 26, 2026
One-click install
npx skills add https://github.com/yash-garg/pi-config --skill git-guardrails-claude-code-yash-garg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/yash-garg/pi-config/tree/main/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/yash-garg/pi-config --skill git-guardrails-claude-code-yash-garg

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill prevents accidental destructive Git operations by adding Claude Code safeguards that intercept risky commands before execution.

Core Features & Use Cases

  • Dangerous Command Blocking: Blocks commands such as git push, git reset --hard, git clean, branch deletion, and destructive restore operations.
  • Claude Code Hook Setup: Installs PreToolUse hooks at project or global scope to enforce Git safety rules.
  • Use Case: Protect a shared codebase by preventing an AI coding assistant from running irreversible Git commands without explicit user control.

Quick Start

Use the git guardrails skill to configure Claude Code hooks that block destructive git commands in this project.

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 before they execute?

You can block destructive git commands by installing a PreToolUse hook script with jq parsing to inspect tool inputs and enforce configurable Git command restrictions before execution.

What git operations should I restrict to prevent accidental repository damage?

To prevent accidental repository damage, restrict git push, git reset --hard, git clean, branch deletion, and destructive restore operations from running without explicit user control.

Can I configure git guardrails at the project level or do they apply globally?

You can configure git guardrails at either the project or global scope by installing Claude Code PreToolUse hooks to enforce Git safety rules across your desired environment.

Does blocking dangerous git actions require any external dependencies to parse commands?

Yes, blocking dangerous git actions requires jq as a dependency to parse tool inputs within the command hook script and accurately inspect incoming Git commands.

Why would I need a hook to intercept git push instead of relying on standard repository settings?

A PreToolUse hook intercepts risky commands before execution, preventing an AI coding assistant from running irreversible Git commands that standard repository settings might not block locally.