git-safety-guardrails
Installation
SKILL.md
Git Safety Guardrails
Install and maintain deterministic pre-execution guardrails that intercept and block dangerous, destructive, or history-rewriting Git commands before autonomous agents can execute them.
Core Invariants
- Deterministic Interception: Automatically block destructive Git commands (
git push --force,git reset --hard,git clean -f/-fd,git branch -D,git checkout .,git restore .) before execution. - Explicit Authority Gate: Intercepted commands return an explicit non-zero exit code notifying the agent that it lacks authority to execute destructive operations.
- Scope Clarification: Always ask the user whether to apply guardrails locally to the project (
.claude/settings.json) or globally (~/.claude/settings.json). - Settings Merge Safety: Seamlessly merge guardrail hooks into existing
PreToolUseconfigurations without overwriting other tools or settings. - Mandatory Interception Test: Verify that the safety hook triggers correctly on simulated forbidden commands before concluding setup.