Skip to content
Back to skills

Cleanup Issue

ASecurity

Clean up after an issue PR is merged. Merges the PR if needed, removes the worktree, deletes the branch, updates main, and starts a fresh session. Use when asked to clean up an issue, finish an issue, or after a PR is approved.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
toolsbashgit

Works with

  • claude code

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill cleanup-issue --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cleanup Issue?

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

Security grade badge for Cleanup Issue
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-cleanup-issue/badge)](https://www.skillsdirectory.com/skills/majiayu000-cleanup-issue)

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
---
name: cleanup-issue
description: Clean up after an issue PR is merged. Merges the PR if needed, removes the worktree, deletes the branch, updates main, and starts a fresh session. Use when asked to clean up an issue, finish an issue, or after a PR is approved.
---

# Cleanup Issue

Finalize and clean up after an issue is complete.

## Workflow

### 1. Merge PR (if not already merged)

Check PR status and merge if approved:

```bash
scripts/cleanup-issue.sh $ISSUE_NUMBER
```

This will:
- Find the PR for the issue branch
- Check if it's already merged
- If approved but not merged, merge it
- Remove the worktree
- Delete the local branch
- Update main
- Prune stale worktree references

### 2. Start fresh session

After cleanup completes successfully, output:

```
/new
```

This starts a fresh Claude Code session, ready for the next task.

## Manual Steps

If the script fails or you need manual control:

```bash
# Check PR status
gh pr view issue-$ISSUE_NUMBER --json state,mergeStateStatus

# Merge if ready
gh pr merge issue-$ISSUE_NUMBER --merge --delete-branch

# Remove worktree
git worktree remove .worktrees/issue-$ISSUE_NUMBER

# Delete local branch (if not auto-deleted)
git branch -d issue-$ISSUE_NUMBER

# Update main
git checkout main
git pull --ff-only origin main

# Prune worktree references
git worktree prune
```

## Scripts Reference

| Script | Purpose |
|--------|---------|
| `scripts/cleanup-issue.sh` | Full cleanup: merge, remove worktree, update main |

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.