git-guardrails-claude-code

Block dangerous Git commands via a PreToolUse hook in Claude Code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Set up Claude Code guardrails to intercept and block dangerous git commands before Claude executes them, preventing destructive operations.

Core Features & Use Cases

  • PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.
  • Blocks commands such as git push, git reset --hard, git clean, git branch -D, and git checkout/restore.
  • Claude reports a blocked message when a dangerous command is attempted, helping teams enforce safe git practices.

Quick Start

Install and configure the guardrails by placing the provided hook script into the target location and selecting project-wide or global scope.

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 dangerous git commands from executing in Claude Code?

You can block dangerous git commands in Claude Code by installing a PreToolUse hook script that intercepts operations like git push, git reset --hard, and git clean before they execute at runtime.

Can I configure git guardrails to protect a single project instead of all projects?

Yes, git guardrails can be configured for either a single project scope or globally across all projects by adjusting the JSON settings integration during the initial setup phase.

How does a PreToolUse hook script prevent destructive git operations?

A PreToolUse hook script prevents destructive git operations by intercepting the command execution request at runtime and blocking it, causing Claude to report a blocked message instead of running the command.

What specific git commands do Claude Code guardrails block by default?

Claude Code guardrails block risky git commands including git push, git reset --hard, git clean, git branch -D, and git checkout and git restore to enforce safe version control practices.

Do I need jq installed to use git guardrails with Claude Code?

Yes, jq is required as a dependency to parse the JSON settings integration and execute the PreToolUse hook script logic that blocks dangerous git commands in Claude Code.

What is the best way to enforce safe git practices when using AI coding assistants?

The best way to enforce safe git practices with AI coding assistants is implementing a pre-use guardrail hook that blocks destructive git commands like git push and git reset --hard before execution.