git-guardrails

Block dangerous git commands via a PreToolUse hook script.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/mia-cx/.agents --skill git-guardrails-mia-cx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails
Source: https://github.com/mia-cx/.agents/tree/main/skills/git-guardrails
Command: npx skills add https://github.com/mia-cx/.agents --skill git-guardrails-mia-cx

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Block destructive git operations from executing, protecting repositories from accidental pushes, resets, or clean commands.

Core Features & Use Cases

  • PreToolUse hook that blocks dangerous git commands.
  • Configurable per-project or global scope.
  • Easy integration by copying the script and updating settings.

Quick Start

Install the guardrails for your project or globally, then enable the PreToolUse hook in your Claude settings.

Frequently Asked Questions about git-guardrails

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent destructive git commands from executing in my local repository?

You can prevent destructive git commands by applying a PreToolUse hook that blocks operations like git push, git reset --hard, and git clean before they execute.

Can I configure git guardrails globally or do I need a per-project setup?

You can configure git guardrails using either a global scope or a per-project scope, allowing you to apply repository protection across your local workflows based on your specific needs.

What do I need to install to block dangerous git actions with Claude Code?

To block dangerous git actions, you need the jq dependency, a hook script copied to your environment, and a settings merge to enable the PreToolUse hook in your Claude configuration.

How does a PreToolUse hook protect repositories from accidental pushes?

A PreToolUse hook protects repositories by intercepting and blocking dangerous git commands, such as accidental pushes or resets, ensuring they do not execute and corrupt your local project state.

What git commands are blocked by repository protection hooks?

Repository protection hooks block dangerous git commands including git push, git reset --hard, and git clean to prevent accidental repository destruction during automated workflows.