cleanup-issue

Merge related PRs, remove worktrees, and prune local artifacts after issue closure.

1|Updated Dec 28, 2025
One-click install
npx skills add https://github.com/vultuk/coding-agent-skills --skill cleanup-issue-vultuk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-issue
Source: https://github.com/vultuk/coding-agent-skills/tree/main/cleanup-issue
Command: npx skills add https://github.com/vultuk/coding-agent-skills --skill cleanup-issue-vultuk

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Clean up after an issue PR is merged by performing the necessary post-merge cleanup actions: merging the PR if required, removing the Git workspace, deleting the local branch, updating the base branch, and starting a fresh session for the next task.

Core Features & Use Cases

  • Merges PRs when approved and needed to close the issue lifecycle.
  • Removes associated Git worktrees and deletes the local issue branch to keep the repo clean.
  • Updates the default/base branch and prunes stale worktree references to stay in sync with origin.
  • Provides safe prompts and a --force option to automate cleanup in CI environments.

Quick Start

Run the cleanup script for a specific issue number:

  • Example: ./scripts/cleanup-issue.sh 123
  • Example with automation: ./scripts/cleanup-issue.sh 123 --force

Frequently Asked Questions about cleanup-issue

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

FAQPage Schema
How do I clean up local git branches and worktrees after a pull request is merged?

To clean up local git branches and worktrees after a pull request is merged, you can automate the process by merging the PR, removing the Git worktree, deleting the local issue branch, and updating the base branch with a single command.

Can I automate GitHub issue cleanup in a CI environment without manual prompts?

Yes, you can automate GitHub issue cleanup in CI environments without manual prompts by running the cleanup script with the --force option, which skips safe prompts and executes the repository housekeeping automatically.

Does this cleanup workflow require the GitHub CLI to merge pull requests?

Yes, this cleanup workflow requires the GitHub CLI (gh) to interact with GitHub and merge pull requests, alongside standard git commands to manipulate branches and prune stale worktree references.

What is the best way to keep my git repository clean after closing an issue?

The best way to keep your git repository clean after closing an issue is to automate the post-merge lifecycle by removing the associated worktree, deleting the local branch, and pruning stale references to stay in sync with origin.

How to automatically merge a pull request and delete the local issue branch?

You can automatically merge a pull request and delete the local issue branch by executing a cleanup script with the specific issue number, which handles the entire post-merge repository housekeeping workflow.

When should I not use automated git worktree pruning for issue branches?

You should avoid using automated git worktree pruning for issue branches when running interactively without the --force flag, as the script provides safe prompts to prevent accidental deletion of unmerged work.