git-guardrails-claude-code

Block dangerous git commands using a Bash PreToolUse hook.

5|2|Updated Nov 17, 2025
One-click install
npx skills add https://github.com/OutlineDriven/odin-gemini-cli-extension --skill git-guardrails-claude-code-outlinedriven
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/OutlineDriven/odin-gemini-cli-extension/tree/main/skills/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/OutlineDriven/odin-gemini-cli-extension --skill git-guardrails-claude-code-outlinedriven

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Block dangerous git commands before they run by using a Bash PreToolUse hook that blocks destructive actions such as push --force, reset --hard, and more, protecting your repository from accidental damage.

Core Features & Use Cases

  • Detects dangerous git patterns and halts execution with a clear error message.
  • Supports project-local and global hook installation.
  • Safely guards workflows by preventing destructive commands while allowing safe operations.

Quick Start

Install the hook in your repository or globally to enable blocking destructive git commands before they run.

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 like push --force and reset --hard before they run?

Block destructive git commands by installing a Bash PreToolUse hook that scans incoming commands for patterns like push --force and reset --hard, halting execution with a clear error message before damage occurs.

Can I install a git hook globally to prevent force pushes across all my repositories?

Yes, you can install the hook globally to prevent force pushes across all repositories, or apply it project-locally to safeguard specific workflows while allowing safe operations elsewhere.

Do I need jq to use a Bash PreToolUse hook for blocking git actions?

Yes, you need jq because the Bash PreToolUse hook relies on it to read and parse the JSON input from stdin to successfully detect and block destructive git actions.

How does a PreToolUse hook stop dangerous git commands from executing?

A PreToolUse hook stops dangerous git commands by scanning incoming bash commands for destructive patterns and exiting with code 2 to block the execution and return a clear error.

What is the best way to prevent accidental repository damage from destructive git operations?

The best way to prevent accidental repository damage is deploying a Bash hook that blocks destructive git operations before they run, safeguarding your repository by halting execution with clear errors.