Agent skill
git-safety-guard
Installs a Git safety guard hook for Claude Code to prevent destructive Git and filesystem commands. Blocks accidental data loss from commands like 'git checkout --', 'git reset --hard', 'git clean -f', 'git push --force', and 'rm -rf'. Use this skill to set up safety rails in a new or existing repository, or globally for the agent.
Install this agent skill to your Project
npx add-skill https://github.com/stars-end/agent-skills/tree/master/git-safety-guard
SKILL.md
Git Safety Guard
Installs a PreToolUse hook that intercepts and blocks destructive Bash commands.
Usage
1. Install Globally (Recommended)
Protects the agent across all projects.
git-safety-guard/install.sh --global
2. Install Per-Project
Protects only the current project.
git-safety-guard/install.sh
What It Blocks
| Command Pattern | Why It's Dangerous |
|---|---|
git checkout -- <files> |
Discards uncommitted changes permanently |
git restore <files> |
Same as checkout -- (newer syntax) |
git reset --hard |
Destroys all uncommitted changes |
git reset --merge |
Can lose uncommitted changes |
git clean -f |
Removes untracked files permanently |
git push --force |
Destroys remote history |
git push -f |
Same as --force |
git branch -D |
Force-deletes branch without merge check |
rm -rf (non-temp paths) |
Recursive file deletion (except /tmp, /var/tmp, $TMPDIR) |
git stash drop |
Permanently deletes stashed changes |
git stash clear |
Deletes ALL stashed changes |
Safety Mechanism
The hook is a Python script (git_safety_guard.py) registered in .claude/settings.json (or ~/.claude/settings.json).
It runs before every Bash command execution.
If a command matches a destructive pattern:
- The command is BLOCKED (never runs).
- The agent receives a "permissionDecision: deny" response with an explanation.
Important Notes
- Restart Required: You must restart the agent/session for the hook to take effect after installation.
- Overrides: If a destructive command is truly needed, the user must run it manually or the agent must ask for explicit permission (though the hook will still block it if the agent tries to run it directly; the agent must guide the user to run it).
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
toolchain-health
Validate Python toolchain alignment between mise, Poetry, and pyproject. Use when changing Python versions, editing pyproject.toml, or seeing Poetry/mise version solver errors. Invokes /toolchain-health to check: - .mise.toml python tool version - pyproject.toml python constraint - Poetry env python interpreter Keywords: python version, mise, poetry, toolchain, env use, lock, install
parallelize-cloud-work
Delegate independent work to Claude Code Web cloud sessions for parallel execution. Generates comprehensive session prompts with context exploration guidance, verifies Beads state, provides tracking commands. Use when user says "parallelize work to cloud", "start cloud sessions", or needs to execute multiple independent tasks simultaneously, or when user mentions cloud sessions, cloud prompts, delegate to cloud, Claude Code Web, generate session prompts, parallel execution, or asks "how do I use cloud sessions".
docs-create
Create epic-specific documentation skill with external reference docs. MUST BE USED for caching external docs. Fetches URLs, caches full content, uses documentation-engineer to generate cohesive summaries, and creates auto-activating skill. Use when starting work on epic that requires external documentation context (API docs, tool guides, reference materials), or when user mentions "cache docs", "external docs", "API documentation", URLs for docs, documentation needs, reference materials, knowledge caching, or epic context documentation.
railway-doctor
beads-guard
Safe Beads workflow helper (warning-only). Use before bd sync/close/create to avoid JSONL conflicts. Ensures you are on a feature branch, up to date with origin/master, and stages Beads files cleanly with Feature-Key commits.
vm-bootstrap
Linux VM bootstrap verification skill. MUST BE USED when setting up new VMs or verifying environment. Supports modes: check (warn-only), install (operator-confirmed), strict (CI-ready). Enforces Linux-only + mise as canonical; honors preference brew→npm (with apt fallback). Verifies required tools: mise, node, pnpm, python, poetry, gh, railway, bd, tmux, jq, rg. Handles optional tools as warnings: tailscale, playwright, docker, bv. Never prints/seeds secrets; never stores tokens in repo/YAML; Railway vars only for app runtime env. Safe on dirty repos (refuses and points to dirty-repo-bootstrap skill, or snapshots WIP branch). Keywords: vm, bootstrap, setup, mise, toolchain, linux, environment, provision, verify, new vm
Didn't find tool you were looking for?