git-guardrails-claude-code

Block dangerous git commands before execution in Claude Code workflows.

4|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/Bailipa/EZTor_FULLBLOOD --skill git-guardrails-claude-code-bailipa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/Bailipa/EZTor_FULLBLOOD/tree/main/.opencode/skills/mattpocock-misc/git-guardrails-claude-code
Command: npx skills add https://github.com/Bailipa/EZTor_FULLBLOOD --skill git-guardrails-claude-code-bailipa

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Block dangerous git commands before Claude Code executes them, preventing destructive operations and reducing risk of accidental damage.

Core Features & Use Cases

  • PreToolUse hook blocks commands like git push (including --force), git reset --hard, git clean, git branch -D, and git checkout . or git restore .
  • Works in both project-scoped and global configurations via .claude/settings.json and the prompt includes installation steps.
  • Use case: teams want to enforce safe git practices during Claude Code sessions to prevent destructive edits.

Quick Start

Install the PreToolUse hook for Claude Code by copying the bundled script to the target hooks location and updating the settings to enable the guardrails.

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 like git push or git reset --hard in Claude Code?

You can block dangerous git commands by installing a PreToolUse hook that intercepts and prevents execution of destructive operations like git push --force, git reset --hard, and git clean in Claude Code.

What git commands should I restrict to prevent accidental damage during AI coding sessions?

To prevent accidental damage, restrict destructive git commands such as git push, git reset --hard, git clean, git branch -D, git checkout ., and git restore . using a safety guardrail hook.

Can I apply git safety guardrails globally or do I need a project-scoped configuration?

You can apply git guardrails in both project-scoped and global configurations by enabling a PreToolUse hook in either the local .claude/settings.json or the global Claude Code settings file.

Do I need jq to set up pre-tool hooks for blocking git operations?

Yes, jq is required as a dependency to set up the pre-tool hooks for blocking git operations, along with a bundled shell script to enforce the guardrails.

How does a PreToolUse hook prevent destructive git actions before they execute?

A PreToolUse hook prevents destructive git actions by intercepting commands before they execute, evaluating the command against a blocklist, and stopping operations like git push or git reset --hard.