When you use git in Claude Code, a wrong command can erase your work. This skill adds a safety net. It blocks dangerous git commands like push, reset --hard, clean, and branch -D. A hook script runs before each git command. If the command is risky, Claude stops it and shows a warning message.
You can set up the guardrails for just your current project or for all projects. The hook script is copied to the right folder and made executable. Then it is added to the Claude settings file. You can also customize which commands to block.
This keeps your work safe from accidents. It helps you avoid losing code or overwriting remote branches. The setup is simple and fast.
Global
mkdir -p ~/.claude/skills/git-guardrails-claude-codeProject
mkdir -p .claude/skills/git-guardrails-claude-codeSource Repository
Caveman Commitjuliusbrussee/caveman
Generate ultra-compressed commit messages with Conventional Commits format
Verification Before Completionobra/superpowers
Always run fresh verification before claiming work is complete or passing
Using Git Worktreesobra/superpowers
Isolate your feature work with git worktrees and keep your main branch safe
Finishing A Development Branchobra/superpowers
Finish your development branch with merge, pull request, or cleanup options
Git Guardrails Claude Codemattpocock/skills
Stop dangerous git commands from running automatically with safety hooks
Setup Pre Commitmattpocock/skills
Automate code formatting type checking and tests before every commit
Git Commitgithub/awesome-copilot
Automatically write standardized git commits by analyzing your code changes
Git Advanced Workflowswshobson/agents
Master advanced Git workflows for clean history and confident recovery