agentleFS
joris887joris887/exosuit/.claude/skills/undo-work/SKILL.md

undo-work

Skill9 starsChanged 3 months agoMITView on GitHub

Safely discard or revert failed implementation attempts and restore a clean working state.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    NEVER discard work without explicit user confirmation.

    line 39
  2. Distinctive:

    Ask the user to confirm one of these rollback levels:

    line 47
  3. Distinctive:

    If a checkpoint tag exists, prefer it as the rollback target — it was set by story-cycle Phase 3.pre at the exact point before …

    line 82
  4. Distinctive:

    If no checkpoint tag exists, identify the commit where the story started:

    line 84
  5. Distinctive:

    NEVER execute destructive git commands without showing the user exactly what will be affected and getting explicit confirmation

    line 130
  6. Distinctive:

    NEVER force push after a reset — the rollback is local only

    line 131
  7. Distinctive:

    Always prefer git stash --include-untracked (recoverable) over destructive alternatives.

    line 132
  8. Distinctive:

    If on main branch, REFUSE to reset — only feature/sprint branches

    line 133
  9. Distinctive:

    If there are commits that have already been pushed to remote, WARN the user that local reset won't affect the remote

    line 134

≈ “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

undo-work

Safely undo work when an implementation attempt has gone wrong. Provides structured rollback with safeguards against accidental data loss.

Arguments: $ARGUMENTS

1. Assess Current State

git status
git log --oneline -10
git stash list

Determine the situation:

  • Uncommitted changes only → Soft or hard reset options
  • One or more commits on feature branch → Revert commits or reset branch
  • Mid-story-cycle → Full story rollback

Present findings to the user before proceeding.

2. Confirm Scope with User

<HARD-GATE> NEVER discard work without explicit user confirmation. Always show exactly what will be lost. </HARD-GATE>

Show the user:

  • Files that will be affected (list modified/added/deleted files)
  • Commits that will be reverted (if any)
  • Whether there's uncommitted work at risk

Ask the user to confirm one of these rollback levels:

LevelWhat it doesWhen to use
SoftStash uncommitted changes (recoverable via git stash pop)"Let me save this aside and try a different approach"
HardDiscard all uncommitted changes"This attempt is wrong, start fresh from last commit"
StoryReset branch to before the story's commits"The whole story implementation needs to restart"

3. Execute Rollback

Soft (stash)

git stash push -m "undo-work: <user-provided reason or auto-description>"

Report: "Changes stashed. Use git stash pop to recover if needed."

Hard (discard uncommitted)

git diff --stat          # Show what will be lost — confirm with user
git stash push --include-untracked -m "undo-work: <user-provided reason>"
git stash drop           # Discard the stash (changes intentionally discarded)

This captures both tracked changes AND untracked files into a stash, achieving a clean working directory. If the user changes their mind before the drop, git stash pop recovers everything.

Story (reset branch to before story commits)

  1. Check for story-cycle checkpoint tags first:
git tag -l 'story-checkpoint-*'

If a checkpoint tag exists, prefer it as the rollback target — it was set by story-cycle Phase 3.pre at the exact point before implementation began.

  1. If no checkpoint tag exists, identify the commit where the story started:
git log --oneline main..HEAD
  1. Show the user exactly which commits will be removed (or that a checkpoint tag was found).
  2. After confirmation:

If checkpoint tag exists:

git stash push --include-untracked -m "undo-work: story rollback backup"
git reset --soft <checkpoint-tag>
git restore .
git tag -d <checkpoint-tag>

If no checkpoint tag (fall back to commit-based):

git reset --soft <commit-before-story>    # Keep changes staged (safest)

<IF>User wants a clean slate (not just unstaged)</IF>

git stash push --include-untracked -m "undo-work: story rollback backup"
git reset --soft <commit-before-story>
git restore .

4. Verify Clean State

git status
git log --oneline -5

Confirm the working directory is in the expected state.

5. Document (Optional)

<IF>The failed attempt has useful learnings</IF>

Suggest the user note what went wrong in the current session context so the next attempt avoids the same pitfalls. Do NOT auto-create documentation files.

Rules

  • NEVER execute destructive git commands without showing the user exactly what will be affected and getting explicit confirmation
  • NEVER force push after a reset — the rollback is local only
  • Always prefer git stash --include-untracked (recoverable) over destructive alternatives. Use git restore . for discarding tracked file changes, git reset --soft for undoing commits while keeping changes staged
  • If on main branch, REFUSE to reset — only feature/sprint branches
  • If there are commits that have already been pushed to remote, WARN the user that local reset won't affect the remote

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.