Skip to content
Back to skills

Rollback

ASecurity

Emergency cleanup of all autoimprove experiment worktrees. Use this if a session was interrupted, Claude crashed mid-experiment, or you want to abort the loop and clean up all branches and worktrees.

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 26, 2026
devopsbashgit

Security analysis

A93/100
  • highPerforms destructive filesystem operations

Pro shows the line behind each finding and how to fix it

Scanned May 27, 2026

npx -y skills add benmarte/autoimprove --skill rollback --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rollback?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rollback
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/benmarte-rollback/badge)](https://www.skillsdirectory.com/skills/benmarte-rollback)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Emergency cleanup of all autoimprove experiment worktrees. Use this if a session was interrupted, Claude crashed mid-experiment, or you want to abort the loop and clean up all branches and worktrees.
---

# Rollback / Cleanup Skill

Since experiments run in isolated worktrees, there's nothing to "rollback" from the main branch — it was never touched. This skill cleans up any leftover experiment worktrees and branches from an interrupted or aborted session.

## Step 1 — Show what will be removed

```bash
echo "=== Active worktrees ==="
git worktree list

echo "=== Experiment branches ==="
git branch | grep "autoimprove/experiment"

echo "=== Worktree directory ==="
ls .claude/autoimprove/worktrees/ 2>/dev/null || echo "(empty or missing)"
```

Show the user what will be removed and confirm before proceeding.

## Step 2 — Remove all experiment worktrees

```bash
# Remove worktrees
for wt in .claude/autoimprove/worktrees/experiment-*; do
  [ -d "$wt" ] && git worktree remove "$wt" --force && echo "Removed worktree: $wt"
done

# Prune any stale worktree references
git worktree prune
```

## Step 3 — Delete experiment branches

```bash
git branch | grep "autoimprove/experiment" | xargs -r git branch -D
echo "Experiment branches deleted"
```

## Step 4 — Remove the container directory

```bash
rm -rf .claude/autoimprove/worktrees
echo "Cleaned up .claude/autoimprove/worktrees/"
```

## Step 5 — Verify clean state

```bash
echo "=== Main branch status ==="
git status
git branch --show-current

echo "=== Remaining worktrees ==="
git worktree list
```

Report: "✅ Cleanup complete. Main branch is clean and untouched."

## Safety notes
- This skill never touches the main branch
- Already-merged winning experiments stay in the main branch history — only pending/discarded experiments are removed
- If a worktree can't be removed cleanly, use `--force` (already included above)

Attribution

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

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.