agentleFS
TheGoat395TheGoat395/Codex-Skills/skills/code-change-undo-revert/SKILL.md

code-change-undo-revert

Skill136 starsChanged 5 months agoMITView on GitHub

Restore requested code changes or checkpoints.

  • Deletes or force-pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 13 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when the user wants to go back safely.

    line 8
  2. Distinctive:

    Use these phrases only when the surrounding request establishes code/repository rollback intent:

    line 12
  3. Distinctive:

    Run git status --short --branch when in a git repo.

    line 27
  4. Distinctive:

    If the user wants only your latest edits undone, revert only those files or hunks.

    line 32
  5. Distinctive:

    If the user wants a branch or commit reverted, inspect the commit range first.

    line 33
  6. Distinctive:

    If a local backup exists, compare backup files before copying anything back.

    line 34
  7. Distinctive:

    Avoid broad destructive commands.

    line 36
  8. Distinctive:

    Do not run git reset --hard, git clean -fd, or branch deletion unless explicitly authorized for the resolved scope.

    line 37
  9. Distinctive:

    Do not remove untracked files until you know they are safe to delete.

    line 38
  10. Distinctive:

    Do not overwrite user edits mixed into a file unless the user approves.

    line 39
  11. Very specific:

    Use git restore for the explicitly selected working-tree/index state.

    line 42
  12. Distinctive:

    Prefer patch-level edits when user and assistant changes are mixed.

    line 43
  13. Distinctive:

    Prefer copying from a timestamped backup only for files known to belong to the requested rollback.

    line 44
  14. Distinctive:

    Run relevant tests, builds, or diff checks when possible.

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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

Code Change Undo And Revert

Use this skill when the user wants to go back safely. The job is to identify what changed, preserve user work, and choose the least destructive undo path.

Trigger

Use these phrases only when the surrounding request establishes code/repository rollback intent:

  • undo
  • revert
  • roll back
  • restore
  • recover
  • go back to before
  • remove your changes
  • bring back deleted code
  • compare against the checkpoint

Workflow

  1. Inspect the current state.
    • Run git status --short --branch when in a git repo.
    • Review changed files before reverting anything.
    • Identify whether changes are yours, the user's, generated output, or mixed.
  2. Choose the safest target.
    • If the user wants only your latest edits undone, revert only those files or hunks.
    • If the user wants a branch or commit reverted, inspect the commit range first.
    • If a local backup exists, compare backup files before copying anything back.
  3. Avoid broad destructive commands.
    • Do not run git reset --hard, git clean -fd, or branch deletion unless explicitly authorized for the resolved scope. Do not seek a second confirmation for an already precise authorization.
    • Do not remove untracked files until you know they are safe to delete.
    • Do not overwrite user edits mixed into a file unless the user approves.
  4. Apply the revert.
    • Use git restore for the explicitly selected working-tree/index state; inspect its source first. Use git revert <commit> to reverse a committed change while preserving history when that is the requested operation.
    • Prefer patch-level edits when user and assistant changes are mixed.
    • Prefer copying from a timestamped backup only for files known to belong to the requested rollback.
  5. Verify and report.
    • Run relevant tests, builds, or diff checks when possible.
    • Summarize what was restored, what remains changed, and any files intentionally left alone.

User Communication

Be explicit:

  • what checkpoint or commit you are reverting to
  • which files will change
  • which files contain user changes and are being preserved
  • which commands were run
  • how to inspect the result

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.