# Git Guardrails

> Soft rules for Claude to avoid dangerous git commands (force-push, hard reset, branch -D). Always-active behavioral guardrail. Don't use for hook setup — use git-guardrails-external instead.

- Skill: `neuron-one/git-guardrails` (Agent Skill)
- Install (CLI): `npx skillmds@latest add neuron-one/git-guardrails`
- Raw SKILL.md: https://api.skillmd.com/api/skills/neuron-one/git-guardrails/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: neuron-one (https://skillmd.com/u/neuron-one)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/neuron-one/git-guardrails

---


# Git Guardrails

BLOCK these git commands and suggest safe alternatives:

## Blocked Commands
- `git push --force` -> Use `git push --force-with-lease` instead
- `git reset --hard` -> Use `git stash` or `git reset --soft` instead
- `git clean -f` / `git clean -fd` -> List files first with `git clean -n`
- `git branch -D` -> Use `git branch -d` (safe delete) instead
- `git checkout .` / `git restore .` -> Restore specific files instead
- `git rebase` on shared branches -> Merge instead

## Always Before Destructive Operations
1. Check if there are uncommitted changes: `git status`
2. Create a backup branch: `git branch backup-[date]`
3. Confirm with user before proceeding

## Never
- Skip hooks with --no-verify
- Force push to main/master
- Delete branches that have unmerged changes
- Amend published commits
