← Back to list

cleanup-issue
by vultuk
⭐ 0🍴 0📅 Jan 12, 2026
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. triggers:
- "clean up issue"
- "finish issue"
- "PR was approved"
- "PR was merged"
- "done with issue" prerequisites:
- gh (GitHub CLI, authenticated)
- git arguments:
- name: ISSUE_NUMBER required: true description: The GitHub issue number to clean up
Cleanup Issue
Finalise and clean up after an issue is complete.
Workflow
1. Merge PR (if not already merged)
Check PR status and merge if approved:
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, prompt for confirmation then merge it
- Remove the worktree
- Delete the local branch
- Update main
- Prune stale worktree references
Options:
--forceor-f: Skip confirmation prompts (useful for automation)
The script provides helpful information when the PR cannot be merged:
- BLOCKED: Required reviews or status checks not met
- BEHIND: Branch needs to be updated from base
- DIRTY: Merge conflicts exist
2. Start fresh session
After cleanup completes successfully:
- Claude Code: output
/newto start a fresh session. - Codex: say "Ready for next task."
Manual Steps
If the script fails or you need manual control:
# 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 |
Related Skills
- fix-github-issue: The workflow that creates the issue branch and PR
- pr-feedback-workflow: Address review comments before cleanup
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon