返回 Skill 列表
extension
分类: 开发与工程无需 API Key

cleanup-issue

在问题PR合并后进行清理。根据需要合并PR,移除工作树,删除分支,更新主分支,并开始一个新的会话。当被要求清理一个问题、完成一个问题或是在PR被批准后使用。

person作者: jakexiaohubgithub

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:

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:

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