Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Undo Work

ASecurity

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

7 stars
0 votes
0 copies
0 views
Added 9/22/2026
ai-agentsgobashgitdocumentation

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add joris887/exosuit --skill undo-work --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Undo Work?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Undo Work
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/joris887-undo-work/badge)](https://www.skillsdirectory.com/skills/joris887-undo-work)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: undo-work
version: 3.0.1
description: Safely discard or revert failed implementation attempts and restore a clean working state.
trigger: manual
depends-on: []
references: []
disable-model-invocation: true
user-invocable: true
allowed-tools: Bash, Read, Glob, Grep
argument-hint: "[--soft | --hard | --story]"
---
______________________________________________________________________

## 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

```bash
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:

| Level | What it does | When to use |
|-------|-------------|-------------|
| **Soft** | Stash uncommitted changes (recoverable via `git stash pop`) | "Let me save this aside and try a different approach" |
| **Hard** | Discard all uncommitted changes | "This attempt is wrong, start fresh from last commit" |
| **Story** | Reset branch to before the story's commits | "The whole story implementation needs to restart" |

## 3. Execute Rollback

### Soft (stash)

```bash
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)

```bash
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:**
```bash
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.

2. If no checkpoint tag exists, identify the commit where the story started:
```bash
git log --oneline main..HEAD
```

3. Show the user exactly which commits will be removed (or that a checkpoint tag was found).

4. After confirmation:

**If checkpoint tag exists:**
```bash
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):**
```bash
git reset --soft <commit-before-story>    # Keep changes staged (safest)
```

<IF>User wants a clean slate (not just unstaged)</IF>
```bash
git stash push --include-untracked -m "undo-work: story rollback backup"
git reset --soft <commit-before-story>
git restore .
```

## 4. Verify Clean State

```bash
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

Attribution

joris887joris887
View sourceMore from joris887 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1066601 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

686011 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

651 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →