worktree-done

Clean up Git worktrees and branches after a merged Pull Request.

1|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/YH-05/finance --skill worktree-done
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-done
Source: https://github.com/YH-05/finance/tree/main/.claude/skills/worktree-done
Command: npx skills add https://github.com/YH-05/finance --skill worktree-done

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gh, and includes scripts (resource) components.

What problem does it solve?

This Skill automates the safe cleanup of Git worktrees and their associated branches after development is complete and the Pull Request has been merged.

Core Features & Use Cases

  • Automated PR Merge Check: Verifies if a Pull Request is merged before proceeding with cleanup.
  • Worktree & Branch Deletion: Safely removes the worktree directory and deletes both local and remote branches.
  • GitHub Project Update: Updates associated GitHub Issues to "Done" status in GitHub Projects.
  • Use Case: After finishing a feature branch, merging the PR, and ensuring all related issues are updated, you can run this command to automatically clean up the worktree and branch, keeping your repository tidy.

Quick Start

Run /worktree-done followed by the name of the branch you want to clean up.

Frequently Asked Questions about worktree-done

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

FAQPage Schema
How do I automatically clean up Git worktrees and branches after a PR is merged?

To clean up Git worktrees and branches after a merged PR, use an automated script that verifies the PR status, updates GitHub Projects, removes the worktree directory, and deletes both local and remote branches safely.

What happens if I try to delete a worktree when the Pull Request is not merged?

When the Pull Request is not merged, the cleanup process pauses and prompts for user confirmation. This safety mechanism prevents accidental deletion of unmerged branches and worktrees, requiring explicit approval or a force option to proceed.

Do I need the GitHub CLI installed to automate branch and worktree deletion?

Yes, you need the GitHub CLI (gh) installed to automate branch and worktree deletion. The cleanup script relies on the gh dependency to verify Pull Request merge status and update associated GitHub Issues to Done status.

How do I update GitHub Projects to Done when removing a worktree?

To update GitHub Projects to Done when removing a worktree, the automation script checks the linked Pull Request and automatically transitions the associated GitHub Issues to the Done status during the branch cleanup workflow.

Can I force delete a Git worktree that has uncommitted changes?

Yes, you can force delete a Git worktree with uncommitted changes. The automation handles uncommitted changes by prompting for user confirmation or accepting a force option to proceed with removing the worktree and deleting branches.

What is the safest way to remove local and remote branches after merging?

The safest way to remove local and remote branches after merging is to use an automated cleanup script that first verifies the Pull Request status, handles unmerged or uncommitted changes with confirmation, and then deletes the branches.