git-guardrails-claude-code

Block destructive git commands before execution in Claude Code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill ensures Claude Code users do not execute dangerous git commands by setting up safety hooks that block operations like 'push', 'reset --hard', and 'clean'.

Core Features & Use Cases

  • Git Safety Hooks: Blocks destructive git commands before they execute.
  • Customization: Allows users to block additional patterns or exclude certain commands.
  • Scope Flexibility: Can be installed for individual projects or all projects.
  • Use Case: Ideal for preventing accidental destructive operations in Claude Code, especially for users working with sensitive repositories.

Quick Start

Install the 'git-guardrails-claude-code' skill and follow the instructions to set up the PreToolUse hook in your Claude Code settings.

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 prevent destructive git commands in Claude Code?

To prevent destructive git commands in Claude Code, you can use a PreToolUse hook to block dangerous operations like 'push', 'reset --hard', and 'clean' before they execute. This ensures safety for sensitive repositories.

What git operations should be blocked to ensure repository safety?

To ensure repository safety, git operations such as 'push', 'reset --hard', and 'clean' should be blocked. Setting up safety hooks intercepts these destructive commands before execution, preventing accidental data loss.

How do I set up a PreToolUse hook for git safety?

To set up a PreToolUse hook for git safety, install the skill and modify your Claude Code settings to intercept dangerous git commands. This configuration can be applied to individual projects or globally across all projects.

Can I customize which git commands are blocked by Claude Code hooks?

Yes, you can customize which git commands are blocked by Claude Code hooks. The safety configuration allows you to block additional command patterns or exclude certain commands from being intercepted based on your specific project needs.

Does the git guardrails hook apply to all projects or just individual repositories?

The git guardrails hook offers scope flexibility, allowing you to apply the safety configuration either to individual projects or globally across all projects. This ensures appropriate coverage for your Claude Code environment.

What do I need to configure git safety hooks in Claude Code?

To configure git safety hooks in Claude Code, you need the Claude Code environment and the ability to modify settings for PreToolUse hooks. No additional dependencies are required to start blocking dangerous git operations.