git-guardrails-claude-code

Block destructive git commands using Claude Code hooks.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/Jmarques/orford-sur-le-lac_embarcations --skill git-guardrails-claude-code-jmarques
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/Jmarques/orford-sur-le-lac_embarcations/tree/main/.agents/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/Jmarques/orford-sur-le-lac_embarcations --skill git-guardrails-claude-code-jmarques

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill sets up Claude Code hooks to block dangerous git commands before they execute, ensuring safety and integrity in code repositories.

Core Features & Use Cases

  • Blocking Dangerous Commands: Protects against destructive operations like git push, git reset --hard, and git clean.
  • Scope Configuration: Customizable to block commands for specific projects or globally across all projects.
  • Customization: Allows users to add or remove patterns from the blocked list.
  • Quick Test: Offers a simple test to verify the setup works as expected.

Quick Start

Set up git-guardrails for your project by executing the following command: git-guardrails setup

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 and reset --hard using Claude Code?

You can block destructive git commands using Claude Code hooks configured by this Skill. It prevents unauthorized pushes, hard resets, and other risky operations by checking commands against a user-defined restricted list before execution.

Can I customize the list of blocked git commands for specific projects?

Yes, you can customize the blocked git commands list by adding or removing patterns. The scope configuration supports blocking commands for specific projects or globally across all projects using Claude Code hooks.

How do I set up git hooks to prevent unauthorized git push in my repository?

Set up git hooks to prevent unauthorized git push by running the `git-guardrails setup` command in your Claude Code environment. This initializes the hook scripts and applies the default restricted command list to your repository.

What risky git operations should be blocked to ensure code integrity?

Risky git operations that should be blocked to ensure code integrity include `git push`, `git reset --hard`, and `git clean`. Blocking these dangerous commands prevents unauthorized repository changes and potential data loss.

Do I need a specific environment to use Claude Code hooks for git safety?

Yes, you need a Claude Code environment to use these git hooks for git safety. The Skill relies on Claude Code's hook mechanism to intercept and block destructive commands before they execute in your repository.

How can I verify that my git command blocking setup works correctly?

You can verify your git command blocking setup works correctly by using the Skill's built-in quick test feature. This simple test checks whether the Claude Code hooks successfully intercept and block restricted git commands.