git-guardrails

Enforces configurable safety checks to block specified Git commands via a guard script.

12|2|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/alexandrbasis/claudops --skill git-guardrails-alexandrbasis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-guardrails
Source: https://github.com/alexandrbasis/claudops/tree/main/.claude/skills/git-guardrails
Command: npx skills add https://github.com/alexandrbasis/claudops --skill git-guardrails-alexandrbasis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Blocks unsafe Git operations by enforcing harness-level safety checks and ensuring dangerous commands are rejected before execution.

Core Features & Use Cases

  • Inspect, install, customize, or troubleshoot the harness git safety guard at .claude/hooks/guards/git-guardrails.sh.
  • Wire the guard into the PreToolUse Bash hooks in .claude/settings.json and verify it's active across workflows.
  • Perform smoke tests to ensure blocked commands produce a BLOCKED message and exit with code 2.

Quick Start

Enable the hook by wiring .claude/hooks/guards/git-guardrails.sh into the PreToolUse Bash hooks in .claude/settings.json and run a smoke test to confirm the BLOCKED response.

Frequently Asked Questions about git-guardrails

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I block unsafe git commands like git push and git branch -D before execution?

To block unsafe git commands, you can enforce harness-level safety checks using a configurable guard script. It rejects dangerous operations before execution by reporting a BLOCKED message and exiting with code 2.

How do I prevent accidental git checkout . across multiple repositories?

Preventing accidental git checkout . across multiple repositories is achieved by wiring a guard script into the PreToolUse Bash hooks. This enforces workflow security and rejects destructive commands before they run.

How do I configure PreToolUse Bash hooks for git safety guardrails?

Configuring PreToolUse Bash hooks for git safety requires wiring the guard script into .claude/settings.json. Once active, the harness inspects git commands and blocks unsafe operations across developer workflows.

Can I run smoke tests to verify blocked git commands produce a BLOCKED response?

Yes, you can run smoke tests to verify blocked git commands. The harness guard script ensures unsafe operations produce a BLOCKED message and exit with code 2, confirming the safety checks are active.

How do I customize the git safety guard script for my developer workflow?

You can customize the git safety guard script by modifying the file at .claude/hooks/guards/git-guardrails.sh. This allows you to inspect, troubleshoot, and tailor the specific unsafe git operations to block.

What are the limitations of using harness-level hooks for workflow security?

Using harness-level hooks for workflow security requires the guard script to be correctly wired into .claude/settings.json. It relies on the PreToolUse Bash hooks to intercept commands, meaning any git operations bypassing this harness will not be blocked.