git-guardrails-claude-code

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

2|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/jupes/agent-forge-harness --skill git-guardrails-claude-code-jupes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/jupes/agent-forge-harness/tree/main/.claude/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/jupes/agent-forge-harness --skill git-guardrails-claude-code-jupes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

The Skill prevents dangerous git commands from being executed, protecting the repository from destructive actions such as force-push, hard reset, clean, and branch deletion.

Core Features & Use Cases

  • Block dangerous commands: Prevents git commands like push, reset, clean, branch deletion, and checkout from being executed.
  • Conditional guidance: Provides guidance on installing hooks and customizing blocked patterns based on user preferences.
  • Project or global scope: Can be installed in project-specific or global settings to apply the guardrails to multiple projects.

Quick Start

Use the 'git-guardrails-claude-code' skill to block the 'git push' command from executing.

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 dangerous git commands like force-push and hard reset from executing?

To prevent dangerous git commands such as force-push, hard reset, and branch deletion from executing, you can use a PreToolUse hook in Claude Code to block these destructive operations before they run.

Can I apply git safety guardrails globally across multiple projects?

Yes, you can apply git safety guardrails globally across multiple projects by installing the hook in global settings, or you can scope it to project-specific settings for localized repository integrity protection.

How do pre-commit hooks protect repository integrity in Claude Code?

PreToolUse hooks protect repository integrity in Claude Code by intercepting and blocking destructive git commands, such as clean and branch deletion, before they execute to prevent accidental data loss.

What is the best way to customize which git commands are blocked?

The best way to customize blocked git commands is to configure the hook patterns based on your specific preferences, receiving conditional guidance on installing and modifying the guardrails to suit your workflow.

Does this git safety hook work without additional dependencies?

Yes, this git automation hook works without additional dependencies, relying solely on the built-in PreToolUse hook mechanism in Claude Code to enforce repository safety checks.

Why should I use a hook to block git push instead of manual code review?

Using a hook to block git push automates repository safety checks instantly before execution, preventing accidental data loss from destructive operations that manual code review might miss.