AgentStack
SKILL verified MIT Self-run

Undo

skill-thettwe-nyann-undo · by thettwe

>

No reviews yet
0 installs
13 views
0.0% view→install

Install

$ agentstack add skill-thettwe-nyann-undo

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Undo? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

undo

Wraps bin/undo.sh. History-mutating operation — treat as destructive.

1. Always preview first

Before any mutation, run bin/undo.sh --dry-run and show the user which commits will be undone. The preview JSON lists them newest- first with SHA and subject. Read it back and ask the user to confirm — even for a single-commit undo.

Exception: the user's request explicitly included "don't ask" / "just do it" AND --count is 1 AND --strategy is soft (the safest default). For anything multi-commit or non-soft, always confirm.

2. Decide strategy

Default is soft (safest — all changes stay staged). When the user's intent is unclear, you MUST call the AskUserQuestion tool (not plain text):

{
  "questions": [
    {
      "question": "How should the commit be undone?",
      "header": "Strategy",
      "multiSelect": false,
      "options": [
        { "label": "Soft (Recommended)", "description": "Undo commit, keep changes staged" },
        { "label": "Mixed", "description": "Undo commit, keep changes in working tree (unstaged)" },
        { "label": "Hard", "description": "Undo commit AND discard all changes permanently" }
      ]
    }
  ]
}

For hard, warn the user twice: the work is gone after hard reset. Confirm before executing even after the picker selection.

3. Decide scope

  • last-commit (default) — one commit.
  • last-N-commits with --count — multiple commits. Use

when the user says "undo the last 3 commits" or similar.

last-N-commits is more dangerous because commits partway down the stack are harder to recover. For N > 3, suggest using git reflog

  • targeted revert instead of a bulk reset.

4. Pre-flight safety (script enforces; relay messages)

| Refusal reason | What to tell the user | |---|---| | long-lived branch | "Can't undo on main/master/develop. Use git revert to create a reverting commit." | | merge commit | "HEAD is a merge commit — undo with git revert -m 1 manually." | | already on upstream | "The commit is already pushed to `. Either git revert it (safe) or pass --allow-pushed to force-push after the reset (only if nobody else pulled)." | | detached HEAD | "Detached HEAD — checkout a branch first." | | fewer than N commits` | "Branch only has M commits; can't undo N." |

5. Invoke

bin/undo.sh --target  \
  [--scope last-commit|last-N-commits] [--count N] \
  [--strategy soft|mixed|hard] [--allow-pushed] [--dry-run]

6. Post-undo report

On success, echo back:

  • What was undone (subjects from undone_commits).
  • The new HEAD SHA.
  • Where the changes are now: staged (soft), in working tree (mixed),

or gone (hard).

  • For soft/mixed: suggest git status to see what's pending.
  • For multi-commit undo: remind the user that git reflog can

recover the discarded history if they change their mind soon.

7. Hand-off

  • "Re-commit with a new message" → commit skill after undo.
  • "Now push the rewrite" → if undo required force-push (pushed

commit with --allow-pushed), they'll need git push --force-with-lease. Don't run this automatically; explain and let them decide.

  • "Undo the undo" → git reflog + git reset --hard .

Handle this as a separate one-off; don't add reflog logic to the undo skill itself.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.