git-guardrails

Intercept destructive git commands and suggest safer alternatives via pre_tool_use hooks.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Intercepts destructive git commands before they execute, blocks them, and warns the user, providing safer alternatives and configuration guidance for pre_tool_use hooks.

Core Features & Use Cases

  • Intercepts destructive git commands before execution and blocks them.
  • Warns users and suggests safer alternatives to prevent data loss.
  • Configurable via a pre_tool_use hook in Claude settings, usable across per-project and global installations.

Quick Start

Configure the git-guardrails hook in Claude settings and test that a destructive command is blocked.

Frequently Asked Questions about git-guardrails

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

FAQPage Schema
How do I block destructive git commands before they execute?

To block destructive git commands, configure a pre_tool_use hook in your Claude settings. This intercepts commands like force pushes before execution, blocking them and suggesting safer alternatives to prevent remote history loss.

What is a pre_tool_use hook for git safety?

A pre_tool_use hook for git safety is a configurable snippet in Claude settings that intercepts destructive git commands before execution. It blocks the command, warns the user, and provides actionable guidance on safer alternatives.

Can I configure git guardrails globally or per-project in Claude?

Yes, you can configure git guardrails in both per-project and global installations. You apply the hook snippet to your Claude settings to intercept and block destructive git commands across your desired scope.

What are the safer alternatives when intercepting destructive git commands?

When intercepting destructive git commands, the hook provides actionable guidance by suggesting safer alternatives to prevent accidental remote history loss. It blocks the command and warns the user before any destructive action occurs.

Does git guardrails work with other agents besides Claude Code?

Yes, git guardrails is usable in Claude Code and other agents. You configure the pre_tool_use hook in your settings to intercept and block destructive git commands, ensuring safety across different agent environments.

When should I use a pre-tool hook to block git commands?

Use a pre-tool hook to block git commands when you need to prevent accidental remote history loss from destructive operations. It satisfies safety by intercepting commands, blocking them, and suggesting safer alternatives before execution.