git-guardrails-claude-code

Block risky git commands like push and reset --hard.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill blocks potentially destructive git commands from executing, helping prevent accidental data loss or repository corruption.

Core Features & Use Cases

  • Command Blocking: Intercepts and prevents commands like push, reset --hard, clean, branch -D, and restore . to avoid harmful operations.
  • Use Case: When working on shared repositories, prevent accidental pushes or resets that could compromise code integrity or cause data loss.
  • Safety: Ensures that in automated scripts or AI assistance, dangerous git commands are detected and blocked before they run.

Quick Start

Install the hook script in your project or globally, add the configuration to your settings, and test it by executing a git command like git push to ensure it gets blocked.

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 push and reset --hard in my repository?

Blocking dangerous git commands requires installing a hook script and configuring your settings. This setup intercepts risky operations like git push, reset --hard, clean, and branch -D before execution to prevent accidental repository damage.

What is the best way to prevent accidental data loss in automated git workflows?

Preventing accidental data loss in automated git workflows is achieved by integrating a hook script that detects and blocks destructive commands. This ensures repository safety by halting risky operations before they execute in collaborative or automated environments.

Can I use this git safety hook to protect shared repositories from AI integrations?

You can use this git safety hook to protect shared repositories from AI integrations. It detects and blocks potentially destructive commands within automated scripts or AI assistance, ensuring code integrity and preventing accidental data loss.

How do I set up a git command blocking hook for my development workflow?

Setting up a git command blocking hook involves installing the script in your project or globally, adding configuration to your settings, and testing it by executing a command like git push to verify it gets blocked successfully.

What specific git commands are intercepted to ensure repository security?

To ensure repository security, the hook intercepts and blocks specific commands including git push, reset --hard, clean, branch -D, and restore. This prevents harmful operations that could compromise code integrity or cause data loss.