git-guardrails-claude-code

Block dangerous git commands via a PreToolUse hook in Claude.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This setup provides a safety net by installing a PreToolUse hook and a blocking script that prevents Claude from executing dangerous git commands, reducing the risk of destructive actions.

Core Features & Use Cases

  • PreToolUse hook that blocks high-risk commands like git push, git reset --hard, and git clean -fd before execution.
  • Project- and global-scope configuration via .claude/settings.json to tailor the policy to your workflow.
  • Simple integration and quick setup to protect collaborative coding sessions, CI workflows, and disaster recovery scenarios.

Quick Start

Copy the hook script to the target location, configure the settings.json to enable PreToolUse, and test that dangerous git commands are 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 in Claude Code?

Block dangerous git commands by installing a PreToolUse hook script that intercepts and prevents high-risk actions like git push, git reset --hard, and git clean -fd before execution. The hook inspects inputs using jq and enforces safety policies defined in your settings.

What is a PreToolUse hook and how does it prevent destructive git operations?

A PreToolUse hook is a safety mechanism in Claude that inspects tool inputs before execution. It uses jq to parse incoming git commands and blocks destructive operations such as git push, git reset --hard, and git clean -fd, preventing irreversible damage to your repository.

Do I need jq installed to set up the git safety hook?

Yes, jq is required to set up the git safety hook. The PreToolUse blocking script relies on jq to inspect and parse incoming tool inputs, ensuring dangerous git commands are accurately identified and blocked before they execute.

Can I configure the git safety hook for global workflows or just local projects?

You can configure the git safety hook for both local projects and global workflows. By updating the .claude/settings.json file, you can tailor the PreToolUse policy to apply across collaborative coding sessions, CI workflows, or disaster recovery scenarios.

How do I install and enable the pretooluse hook for git command blocking?

To install the git command blocking hook, copy the hook script to your target location and update your .claude/settings.json file to enable the PreToolUse rule. After setup, test that dangerous git commands are properly blocked before relying on it.

What are the limitations of using a pretooluse hook to block git commands?

The primary limitation is that the hook only blocks git commands executed through Claude, relying on jq to inspect inputs. It requires manual configuration in .claude/settings.json and does not protect against git commands run outside of the Claude environment.