Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add tamagui/tamagui --skill git-safety -a claude-code
Open on GitHub

What 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 --hard and 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 run git pull, then git push without --force
  • Undo the last commit — agent will suggest git stash instead of git 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-code

2Manually: put the files in place

~/.claude/skills/git-safety/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/git-safety/

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

Similar skills

All skills for Git and GitHub →

From the same set3

Project sponsors

Companies that keep this analytics open