rollback-safe

rollback-safe is a skill for Claude Code from lglucas/ai-dev-operating-system. It costs 71 tokens per session (903 once invoked), scanned A, original, MIT.

A Git-based rollback guide for undoing recent AI-made code changes while keeping the project's history and other work intact.

In plain words
What is it for?
It covers undoing uncommitted edits, reversing one or more commits, and safely undoing changes that were already shared with others.
Why use it?
It helps when a change breaks something or ends up in the wrong file, without requiring you to delete work or manually reconstruct an earlier version.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Part of the ai-dev-operating-system plugin — 28 skills, 11 commands, 12 agents, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/lglucas/ai-dev-operating-system/rollback-safe
Any agent
npx skills add lglucas/ai-dev-operating-system --skill rollback-safe
Clone the repo
git clone --depth 1 https://github.com/lglucas/ai-dev-operating-system

Made for: Claude Code.

Or install ai-dev-operating-system, the plugin that ships this one along with the rest of its 28 skills, 11 commands, 12 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rollback-safe

README.md
[![agentmods](https://agentmods.dev/badge/skills/lglucas/ai-dev-operating-system/rollback-safe.svg)](https://agentmods.dev/skills/lglucas/ai-dev-operating-system/rollback-safe)
Your own site
<a href="https://agentmods.dev/skills/lglucas/ai-dev-operating-system/rollback-safe"><img src="https://agentmods.dev/badge/skills/lglucas/ai-dev-operating-system/rollback-safe.svg" alt="Measured on agentmods" height="20"></a>
Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 903 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00071 $0.00903
Opus 5 $0.00036 $0.00451
Sonnet 5 $0.00014 $0.00181
Haiku 4.5 $0.00007 $0.00090

Measured 5d ago against content hash 85623c94b8cd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

rollback-safe scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/rollback-safe/SKILL.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 <bad-commit>..<HEAD> --no-edit

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?
    

Read the full file on GitHub · 96 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 96 lines · 71 tokens per session scan A 85623c94b8cd

Subscribe to this mod's changes

rollback-safe is a skill published in the GitHub repository lglucas/ai-dev-operating-system (11 stars, last pushed 27d ago), licensed MIT. It adds 71 tokens to every session and 903 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

adk-git

Writes commit messages and pull request descriptions for the adk-python repository: Conventional Commits types and scopes, subject lines that say why a change was made, and the linked-issue and testing-plan sections the PR template requires. Use when writing or rewording a commit message, squashing commits before a…

google/adk-python · 138 tokens

squash-merge

Squash-merge a PR into zeroclaw-labs/zeroclaw master with fully preserved commit history in the squash message body. Use this skill when the user explicitly mentions squash-merging, merging a specific PR number, landing a PR, or 合入 — e.g. "squash-merge #123", "merge PR 456", "land #789", "合入 #123", "/squash-merge…

zeroclaw-labs/zeroclaw · 0 tokens

work

Handle issue/PR work items with worktree isolation. Triggered by "/work [issuelink|description]" to start focused work.

x-cmd/x-cmd · 29 tokens

meta-pre-commit-quality-gate

Run three quality gates (ruff + mypy + pytest) in parallel over the staged diff, then arbitrate a single BLOCK/APPROVE verdict. Use before committing changes locally when you want a comprehensive pre-commit gate beyond per-file linting — exactly the same gate set CI enforces.

opensquilla/opensquilla · 68 tokens

omh-github-issue-intake

This is a Hermes-native github-issue-intake workflow skill.

rlaope/oh-my-hermes · 75 tokens

commit

Skill "commit" from clacky-ai/openclacky, covering smart commit skill, critical requirement: single-line commits only, core philosophy, usage and process steps.

clacky-ai/openclacky · 0 tokens