Git Safety Rules

VerifiedSafe

Git safety rules to prevent force pushes and destructive operations, with safe alternatives and a recommended workflow.

Sby Skills Guide Bot
DevelopmentBeginner
11/15/2026
Claude CodeCursorCodex
#git#version-control#guardrails#destructive-commands#workflow

Recommended for

Automated summary

This skill states Git safety rules that forbid destructive operations (force push, reset --hard, clean -fd) and enforce a pull-before-push workflow.

Strengths

  • Explicit list of forbidden commands, each requiring explicit user permission
  • Gives concrete safe alternatives (git stash / stash pop, pull --rebase) for each risky case
  • Simple six-step workflow that includes pulling before committing and before pushing
  • Short, portable format that is easy to drop in as a system rule or agent instruction

Limitations

  • Does not cover merge conflict situations or resolution strategies beyond "ask the user"
  • No guidance on branches, tags, or history rewrites other than force push
  • Relies purely on model discipline: no technical check or hook is provided to enforce the rules
When to use it

Use it whenever an agent may run Git commands, especially in a shared repository where a force push or reset --hard would be costly.

When not to use it

Skip it if your team explicitly allows history rewrites (for example on a personal branch) and these rules would block legitimate operations.

Security analysis

Safe
Quality score78/100

This is a pure prose policy file with no scripts, tool invocations, network access, or destructive commands. It restricts behavior (forbids force push, reset --hard, clean -fd) rather than enabling anything, and contains no obfuscation, exfiltration, or instruction-injection attempts.

No concerns found

How this analysis is made

Examples

Push after a rebase
My local branch diverged from origin/main after a rebase. Push my commits without using --force.
Undo local changes safely
I want to throw away my uncommitted changes on this branch so I can start over. Do it safely without losing anything permanently.
Clean the working tree
There are a bunch of untracked files left over from a build. Remove them, but ask me before running anything destructive.

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)

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/git-safety-rules-mwd1rulh/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/git-safety-rules-mwd1rulh' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/git-safety-rules-mwd1rulh/download' --output '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md.part' && mv '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md.part' '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md' && test -s '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/git-safety' && cp -R '.skill-downloads/git-safety-rules-mwd1rulh' '.claude/skills/git-safety'

Cursor
test -f '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md' && test -s '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/git-safety' && cp -R '.skill-downloads/git-safety-rules-mwd1rulh' '.cursor/skills/git-safety'

Codex
test -f '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md' && test -s '.skill-downloads/git-safety-rules-mwd1rulh/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/git-safety' && cp -R '.skill-downloads/git-safety-rules-mwd1rulh' '.agents/skills/git-safety'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/git-safety-rules-mwd1rulh'

openskills read 'git-safety-rules-mwd1rulh'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/git-safety-rules-mwd1rulh/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills