git-safety — Claude Code skill: block force push and reset
git-safety prevents the agent from running destructive git operations without explicit permission: force push, git reset --hard, git clean -fd.
MIT ★ 14,319 updated 2026-10-23
npx skills add tamagui/tamagui --skill git-safety -a claude-codeWhat git-safety does
The skill enforces strict git rules: never run git push --force, git push -f, git reset --hard, git clean -fd, or git checkout -- . without explicit user request. Instead of reset --hard, the agent will suggest git stash. Instead of force push, it will run git pull --rebase and a normal push.
Workflow: git pull before changes, then add, commit, another pull, and a regular push with no flags. Install via npx skills add; the skill saves to ~/.claude/skills/git-safety/SKILL.md. Without it, the agent might accidentally rewrite history or delete uncommitted work — common in projects with shared branches.
Useful for teams where git history matters: if someone has already pulled commits, a force push will break their local repository.
What it helps with
- prevent agent from force pushing without permission
- block accidental
git reset --hardand data loss - replace destructive commands with safe alternatives
- control git operations in shared branches
Example prompts for the agent
- Push changes to
main— agent will rungit pull, thengit pushwithout--force - Undo the last commit — agent will suggest
git stashinstead ofgit reset --hard - Clean the working directory — agent will ask permission before
git clean -fd
How to install git-safety
1Skills CLI (Vercel)
npx skills add tamagui/tamagui --skill git-safety -a claude-code2Manually: put the files in place
~/.claude/skills/git-safety/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/git-safety/
1Skills CLI (Vercel)
npx skills add tamagui/tamagui --skill git-safety -a codex2Manually: put the files in place
.agents/skills/git-safety/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add tamagui/tamagui --skill git-safety -a cursor2Manually: put the files in place
.cursor/skills/git-safety/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install tamagui/tamagui .claude/skills/git-safety2Manually: put the files in place
.github/skills/git-safety/SKILL.md1Skills CLI (Vercel)
npx skills add tamagui/tamagui --skill git-safety -a gemini-cli2Platform CLI
gemini skills install https://github.com/tamagui/tamagui --path .claude/skills/git-safetyManually: put the files in place
.devin/skills/git-safety/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add tamagui/tamagui --skill git-safety -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about git-safety
How to install git-safety in Claude Code?
Run npx skills add tamagui/tamagui --skill git-safety -a claude-code. The skill will save to ~/.claude/skills/git-safety/SKILL.md.
What does git-safety do?
It blocks the agent from running git push --force, git reset --hard, git clean -fd, and other destructive commands without explicit permission. It suggests safe alternatives: git stash instead of reset, git pull --rebase instead of force push.
Can I force push with git-safety installed?
Yes, but the agent will request explicit permission before running git push --force or git push -f. Without confirmation, the command will not execute.
Source text
SKILL.md · MIT
--- name: git-safety description: Git safety rules. INVOKE WHEN: git push, force push, git reset, git clean, destructive git, push force, reset hard. NEVER force push or do destructive git operations. --- # git safety rules for git operations in this repo. ## rules - NEVER force push (`git push --force` or `git push -f`) - NEVER `git reset --hard` without explicit permission - NEVER `git clean -fd` without explicit permission - prefer `git stash` over `git reset` - always `git pull` before `git push` ## forbidden commands these require EXPLICIT user permission: - `git push --force` - `git push -f` - `git push --force-with-lease` - `git reset --hard` - `git clean -fd` - `git checkout -- .` (discards all changes) ## safe alternatives instead of `git reset --hard`: - `git stash` to save changes - `git stash pop` to restore instead of force push: - `git pull --rebase` then normal push - ask user how to resolve conflicts ## workflow 1. `git pull` before making changes 2. make changes 3. `git add` relevant files 4. `git commit` 5. `git pull` again before push 6. `git push` (no force flags)
© tamagui · MIT · tamagui/tamagui