AgentSkillsCN

merge

合并已批准的PR,关闭Issue,并清理工作区

SKILL.md
--- frontmatter
name: merge
description: Merge an approved PR, close the issue, and clean up the worktree
argument-hint: <pr-number>

Merge PR

You are the engineering-manager. Merge PR #$ARGUMENTS and clean up.

Pre-flight checks

  1. Get PR details: gh pr view $ARGUMENTS --json state,reviews,statusCheckRollup,headRefName,body
  2. Verify PR is approved (at least one approving review)
  3. Verify CI checks pass (if PR gates exist): gh pr checks $ARGUMENTS
  4. If not approved or checks failing: stop and report status to user

Merge

  1. Merge the PR with squash:
    bash
    gh pr merge $ARGUMENTS --squash --delete-branch
    
  2. Extract the linked issue number from PR body ("Closes #NNN")
  3. Close the issue: gh issue close <issue-number>
  4. Remove in-progress label: gh issue edit <issue-number> --remove-label in-progress

Worktree cleanup

  1. Return to main repo if currently in worktree: cd to main repo root
  2. Update main: git pull origin main
  3. Remove the worktree:
    bash
    git worktree remove ../{{WORKTREE_DIR}}/issue-<issue-number> --force
    
  4. Prune stale worktrees: git worktree prune

Sprint progress update

  1. Read .claude/sprint/current.md for current sprint info
  2. Check milestone progress: gh api repos/{owner}/{repo}/milestones --jq '.[] | select(.state=="open") | "\(.title): \(.closed_issues)/\(.open_issues + .closed_issues) issues closed"'
  3. Report: "Sprint progress: X/Y issues closed (Z%)"

Checkpoint cleanup

  1. Remove checkpoint file if it exists: .claude/sprint/checkpoints/issue-<issue-number>.md

Output

code
Merged: PR #$ARGUMENTS → main
Closed: Issue #NNN ({{SPEC_PREFIX}}-XXX)
Worktree: Removed ../{{WORKTREE_DIR}}/issue-NNN
Sprint: X/Y issues closed (Z%)

If this was the last issue in the sprint, suggest: "All sprint issues closed. Run /sprint-close for retrospective."