git-safety-net
An agent skill by daymade, from daymade/claude-code-skills. Tags: git, resilience, review, troubleshooting, version-control.
What it does
Audits, preserves, recovers, and safely retires local Git state: unpushed or wrong-branch commits, dirty or detached worktrees, forgotten duplicate clones of the same repo, untracked work no bundle can back up, orphaned stashes, dangling commits, stale branches, and squash/rebase merge uncertainty. Use when the user fears work was lost; asks to recover a commit or branch; asks whether a worktree, clone, or scratch directory can be deleted; wants everything converged onto one main branch; or needs proof that cleanup will not drop work. Use it even after an audit reported clean — the usual gap is scope: every in-repo command is blind to a second clone elsewhere on disk. Triggers on "did I lose work", "is everything merged", "is anything else lost", "safe to delete this clone", "clean up old branches/stashes", "only keep one main branch", "git reflog", "dangling commits", "分支灾难", "误删分支/commit", "worktree 能删吗", "还有没有丢的东西", "只保留一个主分支". Covers local-Git forensics, not GitHub PR/API operations or routine sync.
Install
With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:
npx skills add daymade/claude-code-skills --skill git-safety-net
Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):
git clone --depth 1 https://github.com/daymade/claude-code-skills
cp -r claude-code-skills/git-safety-net ~/.claude/skills/git-safety-net
Safety box score
Grade D, elevated risk: 42 of 100 risk points, rated 2026-10-20. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.
This skill is a Git forensics and cleanup toolkit: it inspects local worktrees, refs, stashes, and remotes, can copy backup material into the filesystem, and can also retire branches/worktrees or remote refs once it decides they are safe. The main risks are repository mutation and remote network access; some core helper scripts were not readable in this review, so the exact behavior of the main audit/retirement paths is only partially visible.
| Category | Level | Why |
|---|---|---|
| Code & shell execution | 2 (moderate) | It ships shell scripts that invoke `git`, `find`, `cp`, `tar`, `shasum`, and inline Python (`python3 - ...`), so it executes real commands, but not arbitrary downloaded code or `eval`-style payloads. |
| Network access | 2 (moderate) | It contacts and mutates remotes with `git ls-remote`, `git fetch`, and `git push`/`--delete`, so it can read from and write to hosting services. |
| Filesystem reach | 3 (high) | It writes backup artifacts under `~/.git-backups/...`, copies files into the working tree, and the retirement flow includes `git worktree remove` and branch deletion, so local files and directories can be overwritten or removed. |
| Secrets & credentials | 0 (none) | I saw no code that reads credential stores, keychains, passwords, browser sessions, or `.env` secrets; it uses normal Git auth only. |
| Privilege & persistence | 0 (none) | It does not require sudo, global installs, service registration, or shell-startup edits; the only global-setting mention is an advisory `git config --global fetch.prune true` comment. |
| Instruction hijack surface | 0 (none) | I found no instructions to ignore system/user rules, hide information from the user, follow fetched instructions, or adopt a misleading persona. |
| Irreversible actions | 3 (high) | Mode E explicitly authorizes destructive cleanup such as `git branch -D`, `git worktree remove`, and `git push <remote> --delete <branch>` after verification, which is high-blast-radius repository mutation. |
| Transparency | 2 (moderate) | Several core files were not readable in this review — `scripts/git_loss_audit.sh`, `scripts/git_prepare_clone_retirement.sh`, `scripts/git_verify_branch_merged.sh`, and the large reference docs — so the full behavior of the main audit/retirement/merge paths could not be independently verified. |
Before installing
- Read `scripts/git_loss_audit.sh`, `scripts/git_prepare_clone_retirement.sh`, and `scripts/git_verify_branch_merged.sh` before trusting the cleanup/retirement flow.
- Check whether you’re comfortable with backups being written under `~/.git-backups/` and with `git worktree remove` / remote branch deletion being part of the skill.
- Try `scripts/git_export_before_drop.sh --verify-current <bundle>` and `scripts/git_preserve_danglers.sh` in a scratch clone first, to confirm they only add the refs/files you expect.
- If you intend to use remote operations, verify the target remotes and credentials in a disposable repo before running the skill on a real checkout.
Rated 2026-10-20 by an automated review of 15 files from the skill's repository.
Source
- Repository
- daymade/claude-code-skills (all skills from this repository)
- Path
- git-safety-net/SKILL.md
- Branch
- main
- Updated
- 2026-09-20
Related skills
- fix-merge-conflicts — Resolve merge conflicts non-interactively, validate build and tests, and finalize conflict resolution
- new-branch-and-pr — Create a fresh branch, complete work, and open a pull request
- principle-attack-the-premise — Apply when two or more fixes that share one premise have failed the same gate.
- weekly-review — Produce a weekly synthesis of authored commits with highlights by bugfix, tech debt, and net-new work
- caveman-commit — Write a Conventional Commits message compressed to intent only. Use for "write a commit", "commit message", /commit or /caveman-commit.
- advisor — Advisor mode. Consult a stronger (or different) model at key checkpoints: before major decisions, when stuck on an error, and before declaring a task done.