SkillAgentSearch skills...

git-safety-net

Audits, preserves and recovers local Git state before cleanup: unpushed or wrong-branch commits, dirty worktrees, duplicate clones, stashes, dangling commits, squash-merge uncertainty

Install / Use

npx skills add daymade/claude-code-skills --skill git-safety-net

Installs into whichever agent you are using.

About this skill
πŸ“„

SKILL.md

Installable skill definition

Quality Score

84/100

Supported Platforms

Universal

Our assessment of git-safety-net

git-safety-net scores 84/100 on our quality scale, 2896th of 4,698 Development & Engineering skills we index.

Its SKILL.md is 65 KB long, well organised into 16 sections with 10 code examples: long enough that it reads more like full documentation than a focused instruction file, which agents can find harder to follow.

With 1,426 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
21/30
Structure
20/20
Description
15/15
Adoption
13/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated about 2 months ago, so git-safety-net is actively maintained.
  • Our last check on 2026-10-14 found the source still online.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit β€” read the skill file before letting an agent act on it.

Safety scan

No issues found

Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.

AI review by kimi-k2.7-code on 2026-10-03. Automated pattern scan on 2026-10-03. It catches known dangerous patterns, not every risk β€” read a skill before letting an agent act on it.

git-safety-net compared with similar skills

All 4 of these similar skills score higher than git-safety-net; compare them before choosing.

SkillScoreStarsUpdatedFormat
git-safety-net (this skill)by daymade841.4k53d agoSKILL.md
taste-skillby Leonxlnx100116.8k8d agoCLAUDE.md
Agent-Reachby Panniantong100112.3k8d agoCLAUDE.md
ai-job-searchby ai-job-search-dev10072.1ktodayCLAUDE.md
claude-howtoby luongnv8910047.3k2d agoCLAUDE.md

Frequently asked questions

How do I install git-safety-net?
Run npx skills add daymade/claude-code-skills --skill git-safety-net. The install tabs above show the steps for each supported agent.
Which AI agents does git-safety-net work with?
It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
Is git-safety-net safe to use?
Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is git-safety-net still maintained?
The repository was last updated about 2 months ago, so git-safety-net is actively maintained.

name: git-safety-net description: >- Audits, preserves and recovers local Git state before cleanup: unpushed or wrong-branch commits, dirty worktrees, duplicate clones, stashes, dangling commits, squash-merge uncertainty. Use when the user fears lost work, wants to recover a commit, asks if a branch is actually merged, asks whether a branch, worktree or clone is safe to delete, or wants one clean main (θ――εˆ εˆ†ζ”― / θΏ˜ζœ‰ζ²‘ζœ‰δΈ’ηš„δΈœθ₯Ώ). Not for GitHub PR operations.

Git Safety Net

Prevent losing work in a tangle of branches/stashes/rebases, and recover it forensically when something already went sideways. The commands here are all non-destructive or additive until a step is explicitly labeled destructive β€” recovery must never make the loss worse.

Outcome contract β€” keep the safety net subordinate to the user's job

Before Mode B/E or any command that writes a ref or backup, state the following in the conversation (do not create another file):

  • Outcome: the user-visible end state, in the user's words.
  • Current phase: what is authorized now. "Later" work is not authorized in this phase.
  • Authorized targets: named objects this phase may inspect, plus the subset it may change.
  • Stop condition: observable facts that end the task.

Then enforce these boundaries:

  • Evidence scope is not action scope. A read-only audit may discover another clone, ref, repository, or dangling object. That discovery may widen the report; it does not authorize preserving, uploading, merging, deleting, or otherwise changing the newly found object.
  • Authorization is object-specific, not repository-wide by implication. "Take over", "continue", or "finish the cleanup" applies only to the checkout/ref/PR the user identified. A collaborator-owned worktree, branch, or PR discovered later stays report-only until the user names it as a change target. If the user says to leave it alone, record that exclusion and do not inspect its working-tree contents, back it up, merge it, unlock/remove it, or mutate its refs.
  • Preserve the smallest set threatened by the next authorized destructive action. If the current phase is only commit/push/verify and no deletion, reset, gc, history rewrite, or worktree removal is authorized, do not create an all-refs bundle or pin every dangler.
  • Classify an artifact before choosing its transport. Durable project source follows the repository's normal Git/LFS policy. A temporary recovery artifact (bundle, working-tree diff, snapshot, transport chunk) belongs in a repository-external backup directory. Do not stage, commit, push, or route it through Git LFS merely to make the backup remote; Git LFS is for durable versioned project binaries, not a fallback transport for temporary recovery material.
  • Keep preservation and retirement as separate phases. A verified recovery artifact proves recoverability; it does not prove the business code landed. Keep it through the destructive action and the content-level postconditions. Retire an exact task-owned temporary artifact only when every payload is landed or proven superseded and the artifact itself has explicit cleanup authorization. Keep backup-only, unresolved, and mixed artifacts.
  • Treat a new storage or execution surface as a scope change. A second repository, new remote, cloud upload, Git LFS, or full-history export requires re-planning and explicit authority when the stated outcome actually depends on it. Do not solve a transport problem the user did not ask to create.
  • Prove completion in the user's world. A remote containing the intended commit, preserved WIP, and the requested branch/worktree state are outcomes. Bundle counts, checksums, upload receipts, and audit breadth are supporting evidence, never substitutes for that outcome. Stop when the contract is satisfied; record unrelated findings separately without acting on them.

Entry router β€” pick the mode from what the user is worried about

| The user says / needs… | Go to | |---|---| | "I think I lost a commit / branch / stash", "recover the deleted X", "git reflog" | Mode A β€” Recover | | "did I lose anything?", "what worktrees/stashes/branches remain?", after a messy session | Mode B β€” Audit & preserve | | "is everything merged?", "what's still not on main?", before deleting old branches | Mode C β€” Verify merged | | "so this never happens again", starting parallel/multi-branch work | Mode D β€” Prevent | | "clean up worktrees/stashes/branches", "converge everything onto main", "only keep one main branch" | Mode E β€” Retire safely | | "an audit already said it's clean, but is anything else lost?", "check again" | Mode B, starting at Step 0 β€” a repeat request usually means the first pass had the wrong scope, not that it looked carelessly |

When in doubt, run the smallest read-only probe that selects a mode. Use Mode B Step 0's machine-wide discovery only when the outcome is an exhaustive loss audit or the target checkout is unknown. A named repository/branch/worktree task stays named; findings outside that target are report-only until the user expands the authorized targets.

Load-bearing rules (internalize these; the modes apply them)

  1. Get the EVIDENCE SCOPE right before you trust any verdict, without silently expanding the work scope: every instrument here only sees the repository it runs in. git worktree list, git branch -a, git fsck, git stash list, git log --not --remotes β€” all of them are structurally blind to an independent clone of the same repository elsewhere on the machine. A linked worktree (git worktree add) has a gitlink file pointing home, so it shows up; a second git clone has its own complete .git and no back-reference, so it shows up in nothing. Run git_find_all_checkouts.sh first only for an exhaustive audit or unknown target; otherwise audit the named target. Real incident: a repository audited clean, every branch pushed, while 440 lines of a working feature sat as untracked files in a sibling clone one rm -rf from gone. Scope has a second axis: TIME. Every origin/* ref is a cached snapshot from your last fetch, not the remote β€” so git fetch --all --prune before you trust any verdict that depends on one. Read a stale cache in the right direction: for "what would be lost" it errs safe (it can over-report unpushed work, never hide it), which is why the scripts here still run offline. For "is this already upstream?" it fails the other way β€” work the remote already has reads as unique, so you re-ship it, and if the remote improved it meanwhile your "restore" silently reverts those improvements while looking like a rescue. Real incident: a comparison base one day old made an already-merged change look unshipped; the rescue PR would have reverted three fixes a later review added on top, one of them a security fix. Scope has a third axis: the REF SET itself moves. A branch inventory and a verified bundle prove what existed at one instant; they do not authorize deletion five minutes later. Immediately before deleting, re-enumerate local refs and hosting-service branches, then require every target ref to still equal the object recorded in the bundle. A new branch, a moved tip, or a new parallel PR reopens classification and requires a new bundle. Do not delete against a stale inventory. Scope has a fourth axis: OWNERSHIP. Repository visibility does not make every visible object part of this task. Partition discovered refs/worktrees/PRs into change-authorized, inspect-only, and explicitly excluded sets before acting; compute cleanup success over the authorized set.
  2. Run git_loss_audit.sh for the authoritative "what would be lost" check within a checkout. It compares the current HEAD, every linked-worktree HEAD, local branches, and tags against every remote, then inspects each worktree for tracked/untracked changes plus stashes and dangling commits. The shorter git log HEAD --branches --tags --not --remotes misses a detached HEAD in a different worktree and all uncommitted files. Ahead/behind counts do not answer this. Run it in the named checkout, and in additional Step 0 checkouts only after each is explicitly change-authorized. Run this repository-wide script only when every surface it enumeratesβ€”linked worktrees, local refs/tags, stashes, and dangling commitsβ€”is inside the declared evidence scope. It has no exclusion flags. Otherwise limit the claim to the authorized checkout/ref and use its own status, HEAD, upstream/remote identity, and git log HEAD --not --remotes as scoped evidence; report the other surfaces as not audited.
  3. git reflog is the first move for "I lost a commit," not fsck. Reflog records every HEAD position (commits, checkouts, resets, rebases) for ~90 days and the lost commit is usually in its top few lines. git fsck is the deeper net for commits reflog can't reach.
  4. Preserve before you clean up β€” and know which backup tool can actually reach the work. Pin at-risk/dangling commits somewhere garbage collection can't reach them before deleting a branch, running gc, or force-pushing. Cleanup is reversible only while a ref (or the reflog window) still points at the work. Critical asymmetry: bundle, archive, and format-patch can only reach objects git already knows about. An untracked file that was never git added and never stash -ued is invisible to those formats β€” the copy on disk is the only copy, so preserving it means literally copying the file out. Backing up "the repository" and believing untracked work came along is how a clean-looking backup silently omits the only thing at risk. When the backup is a branch pushed into an already-existing repository rather than this one's own remote, verify shared history before the push (Mode B Step 2) β€” a similar name proves nothing.
  5. Verify "merged" by CONTENT, never by commit count β€” and know that most content checks are also unsound. After a squash-merge, main..branch shows the branch's original commits as "unmerged" even though their content is on main β€” often 100+ phantom commits. But swapping counts for the nearest content check is not enough: in one audit, three successive "surely this is content-level now" instruments each returned a wrong answer β€” git cherry (squash rewrites patch-ids β†’ false UNMERGED), a three-dot diff base...ref used to ask "what does base lack" (three-dot answers a different question and under-reported missing files by 5Γ—), and a file-level existence check (a file present on base can still be missing the ref's lines). Only the trial merge (git merge-tree, what git_verify_branch_merged.sh runs) was right every time. Diff-form and rung-by-rung reliability: references/merge_verification.md.
  6. For a high-stakes exhaustive "is everything merged?" call that will authorize deletion, verify adversarially. One independent reviewer is the default. Use multiple reviewers only when distinct repositories or evidence axes cannot be covered by one pass and the user has authorized that fan-out. Make one pass try to falsify the declared evidence scope (rule 1), but keep any newly found target report-only under the Outcome contract.

Mode A β€” Recover lost work

A commit/branch/stash that "disappeared" is almost always still in the object store for ~90 days β€” why that is true, and what ends it, is references/recovery_playbook.md Β§ Mental model: nothing is gone until gc runs. The ladder there is indexed by symptom, so go straight to your rung β€” Β§ Ladder step 1 β€” git reflog (where most recoveries end), Β§ Ladder step 2 β€” dropp

Truncated for display β€” read the full file on GitHub.

Related Skills

View on GitHub
GitHub Stars1.4k
CategoryDevelopment
Updated1mo ago
Forks219

Languages

Python

Trust signals

100/100

From repository metadata: license, adoption, age and documentation. Not a code audit β€” see the Safety scan above for what the skill file itself contains.

No cautions
git-safety-net β€” Universal Skill: Install & Safety Check | SkillAgent