git-safety
Skill0 starsChanged 41 days agoMITView on GitHub
Run a reversible preflight before git commands that discard work, and recover work that was already lost. Use when about to run `git reset --hard`, `git checkout .`, `git restore`, `git clean -fd`, `git branch -D`, `git rebase`, `git push --force`, or `git stash`; when a command would delete untracked or uncommitted work; when checking whether the working tree is safe to modify; or when someone says git lost their changes. Ships scripts/git-preflight.mjs, which reports dirty, untracked, unpushed, and remote-only state, and marks each destructive command ok, LOST, or ?.
- Deletes or force-pushes
- Commits and pushes
11 other projects use a version of this.
Adopted by
Most recently taken up by
- Adham-Aly/quartermastertheir own version, first seen Nov 1, 2026
- Adham-Aly/implement-looptheir own version, first seen Nov 1, 2026
- haintbotast/coding-agent-instructionstheir own version, first seen Oct 25, 2026
- Tsurai7/agentic-playbooktheir own version, first seen Oct 20, 2026
- tamagui/tamaguitheir own version, first seen Oct 8, 2026
- Effulgent-Point/pawtheir own version, first seen Oct 8, 2026
Used with
Projects with it also use verification-before-completion.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- tamagui/tamagui★ 14ksame name
- waynesutton/convexskills★ 405same name
- waynesutton/builder-skills★ 404same name
- genfeedai/genfeed.ai★ 4same name
- Effulgent-Point/paw★ 2same name
- Adham-Aly/implement-loop★ 1same name
- Adham-Aly/quartermaster★ 1same name
- shaunburdick/skills★ 1same name
- haintbotast/coding-agent-instructions★ 0same name
- kartykk/agent-ready★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- api-doc-recallSkill
- assistant-runtime-architectureSkill
- code-disciplineSkill
- english-requestSkill
- github-repo-opsSkill
- long-task-continuitySkill
- opencode-config-authoringSkill
- opencode-tool-outputSkill
- powershell-windowsSkill
- provider-reconnectSkill
- reference-booksSkill
- release-checklistSkill
- research-synthesisSkill
- self-improvementSkill
- skill-authoringSkill
- subagent-delegationSkill
- task-closureSkill
- test-first-fixSkill
- troubleshooting-treeSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Before reset --hard, checkout ., clean -fd, branch -D, rebase, push --force, or stash.
- Distinctive: line 16
When a command would delete untracked or uncommitted work.
- Distinctive: line 17
When work was already lost and you are looking for where it went.
- Very specific: line 23
The reversible spelling is the default spelling: Prefer, in order: git stash over checkout ..
- Very specific: line 37
A commit is not lost until nothing references it: After a bad reset, look at git reflog before concluding anything: the commit is usually …
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git safety
Most git data loss is not a git bug. It is a destructive command run without knowing what was in the tree. The fix is boring: look first, and prefer the reversible spelling.
When to use this
- Before
reset --hard,checkout .,clean -fd,branch -D,rebase,push --force, orstash. - When a command would delete untracked or uncommitted work.
- When work was already lost and you are looking for where it went.
Rules
- Look before destroying.
git status --porcelainfirst, every time. The cost is one command; the alternative is an afternoon. - The reversible spelling is the default spelling. Prefer, in order:
git stashovercheckout .;git restore <file>overreset --hard;git branch -dover-D;git push --force-with-leaseover--force;git rebase --abortavailability over starting one. - Untracked files are the ones that vanish.
clean -fddeletes work that was never committed, so there is nothing to restore from. Committed work is recoverable from the object store; untracked work is simply gone. - An empty directory is invisible to
git statusbut not togit clean. Git does not track directories, so an empty folder never shows as untracked andclean -fdstill removes it. This is the one case whereclean -ndreports somethingstatusdoes not. Believe the dry run. - Force-push is only safe when the remote has not moved.
--force-with-leaserefuses when the remote has commits you have not fetched. Plain--forceoverwrites them, including someone else's work. - A commit is not lost until nothing references it. After a bad reset, look
at
git reflogbefore concluding anything: the commit is usually still there for weeks.git reset --hard <sha>brings it back.
Preflight
node scripts/git-preflight.mjs [dir] [--json] [--quiet]Reports staged, unstaged, untracked, conflicted, clean-dry-run, ignored,
unpushed, and remote-only state, then marks each common destructive command
ok, LOST, or ? for the tree as it is right now.
? means the tree state cannot decide it — git branch -D depends on the
named branch and on other remotes. Check that branch specifically rather than
reading ? as permission.
Exit codes: 0 nothing at risk, 1 work would be lost, 2 not a git tree.
node scripts/git-preflight.mjs # human report
node scripts/git-preflight.mjs --json # for a script or a hookThe script only reads. git clean -nd and -ndX are dry runs, so running the
preflight never removes anything.
Recovering lost work
In order, cheapest first:
git reflog # find the sha the commit was on
git reset --hard <sha> # or: git checkout -b rescue <sha>
git stash list # for work parked by a stash
git fsck --lost-found # last resort, for unreachable objectsReach for reflog before redoing the work. It is nearly always still there,
and retyping a lost change is strictly worse than a command that seems scary.
When a command must be irreversible anyway
State what is lost before running it, not after. If the answer is "the two
untracked files draft.md and notes.txt", say that in one line, then run it.
An unannounced destructive command is the actual defect, not the command.
Checklist
- Ran
git status --porcelainor the preflight first - Chose the reversible spelling where one existed
- Checked untracked files, which have no recovery path
- Used
--force-with-leaserather than--force - Said out loud what the irreversible command would lose
- Did not conclude data was lost before checking
git reflog
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

