git-guardrails-claude-code

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

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/officechbusinessservices-creator/CompliCore --skill git-guardrails-claude-code-officechbusinessservices-creator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/officechbusinessservices-creator/CompliCore/tree/main/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/officechbusinessservices-creator/CompliCore --skill git-guardrails-claude-code-officechbusinessservices-creator

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill blocks dangerous git commands before Claude code executes them, preventing destructive operations and accidental changes.

Core Features & Use Cases

  • PreToolUse hook intercepts and blocks dangerous git commands (e.g., git push, git reset --hard, git clean) before execution.
  • Scope configuration supports project-local or global installation to suit different workflows.
  • Clear messaging informs users when a command is blocked and what to do next.

Quick Start

Install the hook for the target scope (project or global) and verify that blocked commands are rejected by Claude Code.

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 in Claude Code by installing a PreToolUse hook that intercepts and rejects destructive operations like git push, git reset --hard, and git clean before execution.

How does a PreToolUse hook prevent destructive git actions automatically?

A PreToolUse hook prevents destructive git actions by intercepting git commands before Claude Code executes them, checking against a blocklist of dangerous operations, and aborting the execution with clear messaging on what was blocked.

Can I apply git guardrails globally across all projects or only locally per repository?

You can apply git guardrails in either a project-scoped configuration for individual repositories or a global configuration to enforce safety guards across all projects using the bundled block-dangerous-git.sh script.

Do I need jq installed to set up git hooks for blocking destructive commands?

Yes, you need jq installed to set up these git hooks, as the dependency is required to parse and evaluate the JSON payloads intercepted by the PreToolUse hook during your Claude Code workflows.

What should I do when a git command is blocked by the guardrails hook?

When a git command is blocked by the guardrails hook, clear messaging informs you that the destructive operation was rejected and indicates what safe alternative action or manual step to take next.