git-guardrails-claude-code

Intercept and block destructive git commands via a PreToolUse hook.

45|2|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/hachej/boring-ui --skill git-guardrails-claude-code-hachej
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/hachej/boring-ui/tree/main/.agents/skill-library/miscellaneous/git-guardrails-claude-code
Command: npx skills add https://github.com/hachej/boring-ui --skill git-guardrails-claude-code-hachej

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill prevents accidental execution of destructive git operations like force pushes or hard resets, protecting your repository from irreversible data loss during AI-assisted development.

Core Features & Use Cases

  • Command Interception: Automatically blocks dangerous git commands before they reach the shell.
  • Flexible Scope: Supports both project-specific and global installation configurations.
  • Use Case: Use this to ensure that an AI agent cannot accidentally run git reset --hard or git push --force while working on a sensitive production branch.

Quick Start

Ask the agent to install the git guardrails to protect this project from 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 AI agents from running destructive git commands like force push?

To prevent destructive git commands, you can use a PreToolUse hook that intercepts shell operations and validates them against a predefined list of dangerous patterns like git push --force before they execute.

How do I block git reset hard in my development environment?

You can block git reset hard by injecting a guardrail hook into your project or global settings directory that automatically validates shell commands and stops high-risk git operations from reaching the shell.

Do I need jq to intercept and block git commands in Claude Code?

Yes, you need jq installed because the guardrail hook requires jq for parsing and validating intercepted shell commands against destructive git patterns during standard bash execution.

Can I apply git guardrails globally across all my projects?

Yes, you can apply git guardrails globally by configuring the PreToolUse hook in the global settings directory to intercept and block high-risk git operations across all your projects.

What git commands are considered high-risk and should be blocked?

High-risk git commands include destructive operations like force pushes and hard resets that can cause irreversible repository damage, which the guardrails intercept by validating shell commands against predefined patterns.

Why should I use guardrails for AI-assisted development?

You should use guardrails for AI-assisted development to prevent accidental repository damage, ensuring that AI agents cannot execute irreversible git operations like hard resets on sensitive production branches.