Git guardrails claude code

From jtenner/starshine-mb · View interactive version

Git guardrails claude code is an AI agent skill from the GitHub repository jtenner/starshine-mb. Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.

How to use this skill

Skill file

Setup Git Guardrails

Install a PreToolUse hook that blocks destructive git commands before they run.

Blocked commands

Workflow

  1. Ask whether to install for this project or globally.
  2. Copy scripts/block-dangerous-git.sh into the target hooks directory.
  3. Make it executable.
  4. Merge the hook into the relevant Claude settings file.
  5. Ask whether the blocked pattern list should be customized.
  6. Verify with a sample blocked command.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.