agentleFS
lglucaslglucas/ai-dev-operating-system/.claude/skills/rollback-safe/SKILL.md

rollback-safe

Skill12 starsChanged 46 days agoMITView on GitHub

Undo the last AI change without losing user work. Use when the latest AI-applied change broke something, the user says "desfaz", "volta", "undo", "estraga tudo", or after `bug-triage-agent` selects a revert as the safest fix. Designed for vibe coders who don't yet trust git.

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    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
  1. Very specific:

    Use git restore <file> for unstaged changes, git restore --staged <file> for staged.

    line 22
  2. Distinctive:

    Use git revert (not git reset --hard) so collaborators / CI / Vercel pick up the undo cleanly.

    line 40
  3. Distinctive:

    Before running ANY rollback command:

    line 47
  4. Very specific:

    Add a one-liner to session-log/ explaining why we rolled back.

    line 75

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rollback Safe

When to run this skill

  • The user says "desfaz isso" / "volta o que você fez" / "anda pra trás" / "tira essa última mudança".
  • bug-triage-agent recommends a revert.
  • A change just shipped and broke something obvious.
  • The user pasted a wrong thing into a config / env file.

Mental model for the vibe coder

Pensa numa máquina do tempo do projeto. Cada commit é uma foto do projeto inteiro. "Desfazer" não apaga a foto — ele só te leva pra foto de antes. Se mudar de ideia, você pode voltar pra foto atual a qualquer momento. Nada que você fez se perde.

Rollback levels (always try the smallest first)

Level 0 — Nothing committed yet

Use git restore <file> for unstaged changes, git restore --staged <file> for staged. Safe and instant.

Level 1 — Last commit is the bad one

git revert HEAD --no-edit

Creates a new commit that undoes the previous one. History stays linear, nothing lost.

Level 2 — Several commits to undo

Pick the last good commit hash and:

git revert <last-good-commit>..HEAD --no-edit

The range excludes its left end, so it reverts every commit after the last good one. Each bad commit gets its own undo commit.

Level 3 — Already pushed and remote needs cleaning

Use git revert (not git reset --hard) so collaborators / CI / Vercel pick up the undo cleanly.

Level 4 — DO NOT default to this

git reset --hard <hash> rewrites local history. Only use after explicitly asking the user, AND backing up untracked files first. Never on a shared branch.

Pre-flight checklist (mandatory)

Before running ANY rollback command:

  1. Snapshot uncommitted work.
    git stash push -u -m "rollback-safe-snapshot-$(date +%s)"
    Even if it looks like "nothing important", stash it. Stashes can be popped back.
  2. Confirm the target. Show the user the exact commit (hash, message, date) you're about to undo.
  3. Show the blast radius. List which files will change.
  4. Confirm with the user in plain Portuguese.
    Vou voltar o projeto pro estado antes de [commit msg].
    Isso vai mudar [N] arquivos.
    Seu trabalho não-commitado tá guardado e dá pra voltar.
    Posso prosseguir?
  5. Apply.
  6. Verify build still works (use verify-build-works).

After rollback

  • Show the user the new commit log (git log --oneline -5).
  • Tell them: "se quiser voltar, é só me pedir 'desfaz o desfaz' — eu reverto o revert".
  • Add a one-liner to session-log/ explaining why we rolled back.

Anti-patterns

  • ❌ git reset --hard HEAD~1 without snapshot.
  • ❌ git push --force to "clean up" remote history on a shared branch.
  • ❌ Deleting files manually because "they shouldn't be there" without checking what they were.
  • ❌ Skipping the snapshot because "the user has nothing important uncommitted" — you don't know that.

Output

↩️  Rollback safe report

Snapshot: stash@{0} (rollback-safe-snapshot-1714329600) — seu rascunho tá aqui se precisar.
Voltei o projeto pra: 7604d32 ("docs: prepare public release metadata")
Arquivos afetados: 11
Build: ✅ ainda passa
Próximo passo: testar o fluxo que estava quebrando.

Se quiser desfazer esse desfazer: me pede "rebobina o rebobina".

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.