undo
Skill6 starsChanged 3 months agoMITView on GitHub
Safely undo the most recent git commit(s) on a feature branch. TRIGGER when the user says "undo my last commit", "undo last N commits", "oops revert that commit", "undo the commit but keep my changes", "uncommit", "revert my last change", "take back that commit", "/nyann:undo". Trigger on "revert" only when the user clearly means undoing a local commit (not `git revert` on a published one — see DISAMBIGUATION). DISAMBIGUATION: if the user says "revert a commit that's already on main" / "revert a pushed commit" / mentions a specific remote SHA, this is the `git revert` workflow — undo-skill refuses pushed commits by default. Explain the difference and either use --allow-pushed (risky) or direct them to `git revert <sha>`. Do NOT trigger on "undo the last edit" (that's editor-level) or "rollback the deploy" (that's infrastructure, out of scope). Do NOT trigger on main/master/develop — long-lived branches should never be history-rewritten; use `git revert` instead.
- Deletes or force-pushes
- Commits and pushes
4 other projects use a version of this.
Adopted by
Most recently taken up by
- MFaizR77/turnbacktheir own version, first seen Sep 30, 2026
- buildomator/buildomatortheir own version, first seen Sep 20, 2026
- pravoobi/changelog-claude-plugintheir own version, first seen Jun 18, 2026
- hereinthehive/kickstarttheir own version, first seen May 27, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- buildomator/buildomator★ 90same name
- hereinthehive/kickstart★ 4same name
- MFaizR77/turnback★ 1same name
- pravoobi/changelog-claude-plugin★ 0same name
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 repository41 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-team-sourceSkill
- bootstrap-projectSkill
- check-prereqsSkill
- cleanup-branchesSkill
- commitSkill
- diagnoseSkill
- diff-profileSkill
- doctorSkill
- explain-diffSkill
- explain-stateSkill
- fleet-retrofitSkill
- fleetSkill
- gen-ciSkill
- gen-claudemdSkill
- gen-dependency-updaterSkill
- gen-devcontainerSkill
- gen-templatesSkill
- gh-protectSkill
- hotfixSkill
- iac-applySkill
- iac-planSkill
- inspect-profileSkill
- learn-profileSkill
- migrate-profileSkill
- new-branchSkill
- optimize-claudemdSkill
- prSkill
- record-decisionSkill
- releaseSkill
- retrofitSkill
- route-docsSkill
- settingsSkill
- setupSkill
- shipSkill
- suggestSkill
- syncSkill
- sync-team-profilesSkill
- undo-bootstrapSkill
- wait-for-pr-checksSkill
- watchSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Before any mutation, run bin/undo.sh --dry-run and show the user which commits will be undone.
- Very specific: line 39
Default is soft (safest — all changes stay staged).
- Distinctive: line 108
Don't run this automatically.
“Common” is measured: kept by at least 6 in 10 of the 3 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
undo
Wraps bin/undo.sh. History-mutating operation — treat as destructive.
1. Always preview first
Before any mutation, run bin/undo.sh --dry-run and show the user
which commits will be undone. The preview JSON lists them newest-
first with SHA and subject. Read it back and ask the user to
confirm — even for a single-commit undo.
Exception: the user's request explicitly included "don't ask" / "just
do it" AND --count is 1 AND --strategy is soft (the safest
default). For anything multi-commit or non-soft, always confirm.
2. Decide strategy
Default is soft (safest — all changes stay staged). When the user's
intent is unclear, you MUST call the AskUserQuestion tool (not
plain text):
{
"questions": [
{
"question": "How should the commit be undone?",
"header": "Strategy",
"multiSelect": false,
"options": [
{ "label": "Soft (Recommended)", "description": "Undo commit, keep changes staged" },
{ "label": "Mixed", "description": "Undo commit, keep changes in working tree (unstaged)" },
{ "label": "Hard", "description": "Undo commit AND discard all changes permanently" }
]
}
]
}For hard, warn the user twice: the work is gone after hard reset.
Confirm before executing even after the picker selection.
3. Decide scope
last-commit(default) — one commit.last-N-commitswith--count <N>— multiple commits. Use when the user says "undo the last 3 commits" or similar.
last-N-commits is more dangerous because commits partway down the
stack are harder to recover. For N > 3, suggest using git reflog
- targeted revert instead of a bulk reset.
4. Pre-flight safety (script enforces; relay messages)
| Refusal reason | What to tell the user |
long-lived branch | "Can't undo on main/master/develop. Use git revert <sha> to create a reverting commit." |
merge commit | "HEAD is a merge commit — undo with git revert -m 1 <merge-sha> manually." |
already on upstream | "The commit is already pushed to <upstream>. Either git revert it (safe) or pass --allow-pushed to force-push after the reset (only if nobody else pulled)." |
detached HEAD | "Detached HEAD — checkout a branch first." |
fewer than N commits | "Branch only has M commits; can't undo N." |
5. Invoke
bin/undo.sh --target <cwd> \
[--scope last-commit|last-N-commits] [--count N] \
[--strategy soft|mixed|hard] [--allow-pushed] [--dry-run]6. Post-undo report
On success, echo back:
- What was undone (subjects from
undone_commits). - The new HEAD SHA.
- Where the changes are now: staged (soft), in working tree (mixed), or gone (hard).
- For
soft/mixed: suggestgit statusto see what's pending. - For multi-commit undo: remind the user that
git reflogcan recover the discarded history if they change their mind soon.
7. Hand-off
- "Re-commit with a new message" →
commitskill after undo. - "Now push the rewrite" → if undo required force-push (pushed
commit with
--allow-pushed), they'll needgit push --force-with-lease. Don't run this automatically; explain and let them decide. - "Undo the undo" →
git reflog+git reset --hard <prior-sha>. Handle this as a separate one-off; don't add reflog logic to the undo skill itself.
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.

