pr-cleanup

Verify merged GitHub PRs and delete stale local and remote branches.

Updated Mar 2, 2026
One-click install
npx skills add https://github.com/smp4/claude-skills --skill pr-cleanup-smp4
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pr-cleanup
Source: https://github.com/smp4/claude-skills/tree/main/dot_claude/skills/pr-cleanup
Command: npx skills add https://github.com/smp4/claude-skills --skill pr-cleanup-smp4

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Verifies that merged pull requests are truly on main before altering any git refs so teams never accidentally leave behind stale branches, remotes, or worktrees.

Core Features & Use Cases

  • Merge verification using GitHub API state plus base branch confirmation and optional remote ancestry checks before any cleanup commences.
  • Flexible target resolution from PR numbers, explicit branch names, slugs, or automatic worktree detection so the right feature context is chosen every time.
  • Guided cleanup that updates the base branch, removes the worktree, and deletes local and remote branches with safe prompts and reporting for each idempotent step.

Quick Start

Run /pr-cleanup after merging a GitHub PR to confirm the merge, update main, and remove the associated feature branch and worktree.

Frequently Asked Questions about pr-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up merged GitHub PR branches and worktrees safely?

To clean up merged GitHub PR branches safely, run /pr-cleanup to verify the merge state via the GitHub API, update the base branch, and delete both local and remote feature branches with worktrees.

What's the best way to delete stale git feature branches after a PR merge?

Deleting stale git feature branches after a PR merge is best handled by /pr-cleanup, which performs GitHub API state checks and optional remote ancestry validation before guarded branch deletion.

How does squash merge detection work when removing git worktrees?

Squash merge detection triggers human confirmation prompts during worktree removal to prevent accidental data loss, ensuring merged pull requests are verified on main before altering any git refs.

Can I verify a GitHub PR merge state before deleting remote git branches?

Yes, you can verify a GitHub PR merge state before deleting remote git branches by performing GitHub API state checks and base branch confirmation to ensure the feature context is truly merged.

Does pr-cleanup support automatic worktree detection for branch cleanup?

Yes, pr-cleanup supports automatic worktree detection for branch cleanup, allowing flexible target resolution from PR numbers, explicit branch names, slugs, or the current worktree environment.

Why do I need ancestry validation for post-merge git branch deletion?

Ancestry validation is needed for post-merge git branch deletion to confirm the feature branch history is successfully integrated into the remote base branch before removing local and remote resources.