Git rollback mode selector
Skill kjuhwa/skills-hub/skills/operations/git-rollback-mode-selector
Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.
npx -y skills add kjuhwa/skills-hub --skill git-rollback-mode-selectorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Let operators pick how failed autonomous changes unwind — hard reset, stash-and-continue, or no-op — via one env var. The three modes trade audit-trail preservation against blast-radius containment.
SKILL.md
2.7 KB, 499 tokens by cl100k_base, as published. Nobody here has run it
Git Rollback Mode Selector
Context
An autonomous process (codegen agent, evolver, migration runner) writes changes into a git worktree. When its own validation fails, you need to decide what happens to those changes. One env var, three modes:
| Mode | Behavior | Cost |
|---|---|---|
hard (default) | git reset --hard to pre-change HEAD; discard working tree & index | Fastest clean state; zero artifact of the failed attempt |
stash | git stash push --include-untracked the failed attempt; HEAD returns to pre-change state | Attempt is preserved for human review; stash accumulates if failures repeat |
none | Leave the tree as-is; log and abort the loop | Lets human inspect the exact failing state in place; next iteration blocked until cleanup |
Env var: EVOLVER_ROLLBACK_MODE={hard|stash|none}.
Rules
- Record the pre-change ref. Capture
git rev-parse HEADat the start of each iteration; that's the rollback target. Never trust "the previous commit" — the previous iteration may have already moved HEAD. - Include untracked.
hardmust alsogit clean -fd(scoped to the working dir, not recursively above it) or agents leave orphaned files.stashmust use--include-untracked. - Fail loud on
none. Whennoneis chosen and rollback is skipped, the loop must refuse to proceed until a human signals resume. Otherwise the next iteration runs on top of broken state. - Never
--forcepush automatically. Rollback is local-only. If the failed attempt was already pushed, open an issue / alert; do not rewrite remote history from an autonomous loop. - Tag the rollback in the audit log. Emit
{iteration_id, rollback_mode, pre_ref, post_ref, reason}to the event stream so you can reconstruct what happened even whenharderased the working tree.
Anti-patterns
- Using
git checkout .as the rollback — leaves untracked files and staged deletions. - Using
git stashwith no--include-untracked— same leak. - Rolling back across iterations (jumping past more than one pre-ref) — that's not rollback, that's revert; different operation, different semantics.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most pr commit review skills give in 499 tokens
Counted across 888 of the 1,342 authors here whose files we hold, read 2026-08-07
- Use conventional commits formatin 127 of 888, across 115 files
- Keep subject line under 72 charactersin 62 of 888, across 48 files
- Delete branches after mergein 51 of 888, across 38 files
- Use imperative mood in subject linein 51 of 888, across 42 files
- Use imperative mood in commit messagesin 44 of 888
- Verify directory is ignored before creating worktreein 43 of 888, across 12 files
- Generate a conventional commit messagein 43 of 888
- Add unignored worktree directories to gitignorein 42 of 888, across 10 files
- Make atomic commitsin 39 of 888, across 27 files
- Run tests before committingin 36 of 888, across 25 files
- Verify clean test baselinein 35 of 888, across 9 files
- Split unrelated changes into separate commitsin 35 of 888, across 30 files
Said here and by no other author read
- read rollback mode from the environment variable
- default to hard reset when mode is unset
- hard reset to pre-change HEAD and clean untracked files
- stash the failed attempt including untracked files
- abort and wait for human resume signal in none mode
- record the pre-change ref before each iteration
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.