audit-worktrees

Audit and clean stale Git worktrees with recovery SHA capture.

1|Updated May 15, 2026
One-click install
npx skills add https://github.com/mslshao/claude-harness --skill audit-worktrees
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-worktrees
Source: https://github.com/mslshao/claude-harness/tree/main/dotclaude/skills/audit-worktrees
Command: npx skills add https://github.com/mslshao/claude-harness --skill audit-worktrees

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you audit and clean up stale Git worktrees created by agent, autopilot, and branch-based workflows without accidentally deleting active work. It reduces the manual effort of checking branch status, PR state, merge status, authorship, and recoverability before cleanup.

Core Features & Use Cases

  • Evidence-based worktree auditing: Enumerates worktrees, checks dirty state, compares unique commits against main, and resolves PR status through multiple search strategies.
  • Safe deletion planning: Classifies branches into delete, in-flight, closed-review, or unshipped-work buckets so cleanup decisions are explicit and reversible.
  • Recovery-aware cleanup: Captures recovery SHAs, deletes in dependency-safe order, and reports final state after pruning.
  • Use cases: Clean up orphaned launch or autopilot worktrees, remove merged-and-shipped branches, and identify abandoned staging areas created from other engineers' commits.

Quick Start

Ask the AI to audit worktrees in /workspaces/main and produce a deletion plan with verification evidence before removing anything.

Frequently Asked Questions about audit-worktrees

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

FAQPage Schema
How do I safely clean up stale Git worktrees in a shared repository?

Safely cleaning up stale Git worktrees requires auditing branch status, PR state, and merge status before deletion. This Skill automates that audit, classifies branches into delete or unshipped-work buckets, and captures recovery SHAs to prevent accidental deletion of active work.

What is the best way to remove orphaned Git worktrees created by automated workflows?

Removing orphaned Git worktrees from autopilot or branch-based workflows requires evidence-based auditing. This Skill enumerates worktrees, checks dirty state, compares unique commits against main, and verifies PR resolution before generating a dependency-safe deletion plan.

How does worktree branch cleanup verify if unshipped work is accidentally deleted?

Worktree cleanup prevents accidental deletion of unshipped work by capturing recovery SHAs and classifying branches. It checks for dirty states and unresolved pull requests, ensuring only merged-and-shipped or abandoned branches are pruned while active work remains untouched.

Can I audit launch, chore, and fix worktree branches under specific repository paths?

Yes, you can audit launch, autopilot, PR-intel, Jira-prefixed, chore, and fix worktree branches. The Skill applies specifically to worktrees under /workspaces/main, checking authorship classification and requiring verification evidence before producing a deletion plan.

Why should I use a multi-strategy PR lookup before deleting Git worktree branches?

Using multi-strategy PR lookup before deleting Git worktree branches ensures accurate merge verification and prevents data loss. This approach resolves pull request status through multiple search strategies, confirming whether branches are safely merged before pruning.

When should I not use automated Git worktree pruning?

Automated Git worktree pruning should be avoided when branches contain uncommitted dirty states or unresolved pull requests. The Skill safeguards against this by applying confirmation gating and dependency-safe deletion order, ensuring active or unshipped work is not removed.