cleanup-worktrees

Clean up git worktrees after verifying merged code and Done/Closed ticket tasks.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/thomfilg/ai-plugin-work --skill cleanup-worktrees-thomfilg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-worktrees
Source: https://github.com/thomfilg/ai-plugin-work/tree/main/plugins/work/skills/cleanup-worktrees
Command: npx skills add https://github.com/thomfilg/ai-plugin-work --skill cleanup-worktrees-thomfilg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps manage and safely clean up git worktrees by verifying that code has been merged to the main branch and checking the status of associated ticket tasks.

Core Features & Use Cases

  • Worktree Verification: Safely removes git worktrees after verifying that all code has been merged to the main branch.
  • Ticket Status Check: Ensures that associated ticket tasks are in the 'Done/Closed' status before deletion.
  • Data Integrity: Verifies the existence of all code changes in the main branch to prevent accidental loss of work.
  • Use Case: For teams managing multiple git worktrees and associated ticket tasks, this Skill automates the cleanup process while ensuring data integrity and compliance with workflow standards.

Quick Start

Use the cleanup-worktrees skill to safely clean up all git worktrees that have no unmerged code and associated ticket tasks are in 'Done/Closed' status.

Frequently Asked Questions about cleanup-worktrees

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

FAQPage Schema
How do I safely clean up git worktrees without losing unmerged code?

To safely clean up git worktrees, verify that all code changes have been merged to the main branch before deletion. This Skill automates that verification process to prevent accidental loss of work.

How do I automate git worktree removal based on ticket tracking status?

You can automate git worktree removal by checking that associated ticket tasks are in a 'Done' or 'Closed' status. This Skill verifies ticket status via API before safely deleting worktrees.

Can I use this git worktree cleanup tool with my existing ticket tracking system?

Yes, this worktree cleanup tool integrates with your ticket tracking system via API access. It requires both git commands and API credentials to verify ticket status before removing worktrees.

What's the best way to manage multiple git worktrees and ensure data integrity?

The best way to manage multiple worktrees is to verify code existence in the main branch and confirm ticket closure before cleanup. This ensures data integrity and compliance with workflow standards.

What happens if a worktree has unmerged code changes during cleanup?

If unmerged code changes exist, the worktree is not removed. The Skill verifies all code exists in the main branch first, preventing accidental deletion of active work.

When should I not use automated git worktree cleanup?

You should not use automated worktree cleanup if you lack API access to your ticket tracking system or if your workflow does not use a main branch for merging code changes.