git-safety-hooks

Sets up PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "git-safety-hooks" with this command: npx skills add helderberto/skills/helderberto-skills-git-safety-hooks

Git Safety Hooks

Sets up PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.

Blocked Commands

  • git push (all variants including --force )

  • git reset --hard

  • git clean -f / git clean -fd

  • git branch -D

  • git checkout . / git restore .

When blocked, Claude sees message that it doesn't have authority to run these commands.

Installation

  1. Ask Scope

Ask user: install for this project (.claude/settings.json ) or all projects (~/.claude/settings.json )?

  1. Copy Hook Script

From: scripts/block-dangerous-git.sh

To:

  • Project: .claude/hooks/block-dangerous-git.sh

  • Global: ~/.claude/hooks/block-dangerous-git.sh

Make executable: chmod +x <path>

  1. Add to Settings

See configuration.md for settings JSON examples

  1. Verify

Test by asking Claude to run git push

  • should be blocked

Customization

Edit blocked commands list in hook script.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

safe-repo

No summary provided by upstream source.

Repository SourceNeeds Review
General

ship

No summary provided by upstream source.

Repository SourceNeeds Review
General

lint

No summary provided by upstream source.

Repository SourceNeeds Review
General

refactor-plan

No summary provided by upstream source.

Repository SourceNeeds Review