git-guardrails-claude-code

Install a Claude Code pre-tool hook that blocks dangerous git commands.

1|Updated Jun 27, 2026
One-click install
npx skills add https://github.com/babually/bongo-template --skill git-guardrails-claude-code-babually
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails-claude-code
Source: https://github.com/babually/bongo-template/tree/main/.agents/skills/git-guardrails-claude-code
Command: npx skills add https://github.com/babually/bongo-template --skill git-guardrails-claude-code-babually

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill protects repositories from destructive or irreversible git commands by inserting a pre-tool hook that stops risky actions before they execute.

Core Features & Use Cases

  • Dangerous Command Blocking: Prevents git push, force push, hard reset, forced clean, branch deletion, and full-file restore or checkout operations.
  • Claude Code Hook Setup: Configures a PreToolUse hook for either one project or all projects through Claude settings.
  • Safe Git Governance: Useful when you want an AI assistant to avoid accidental repository damage during automated workflows or interactive coding sessions.

Quick Start

Ask the user whether to install the guardrail for this project only or for all projects, then follow the skill steps to copy the hook script and add it to the matching Claude settings file.

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 force push in Claude Code?

You can block dangerous git commands by installing a Claude Code pre-tool hook that intercepts Bash tool invocations and stops risky actions like force pushes before they execute.

Can I prevent an AI assistant from running destructive git operations automatically?

Yes, configuring a PreToolUse hook prevents AI assistants from running destructive git operations by returning a blocked response for hard resets, forced cleans, and branch deletions during automated workflows.

How does a pre-tool hook stop git hard resets and branch deletions?

A pre-tool hook stops git hard resets by inserting a shell script into Claude settings that intercepts Bash tool invocations and returns a blocked response before the destructive command executes.

Do I need jq to set up git command blocking in my repository?

Yes, you need jq installed to set up git command blocking, as the hook script relies on this dependency to parse and evaluate Bash tool invocations before execution.

Can I apply repository safety hooks to all projects or just one project?

You can apply repository safety hooks to either one specific project or all projects by adding the hook script and settings entries to the matching Claude settings configuration file.

What git operations should repository safety hooks intercept?

Repository safety hooks should intercept git push, force push, hard reset, forced clean, branch deletion, and full-file restore or checkout operations to prevent irreversible repository damage.