/agent-skills:git-clean-worktrees [repository-path]from agent-skills
Remove already-preserved linked worktrees and local branches from one repository, only through an explicit plan the user approves by digest.
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Inspect one repository, propose an exact cleanup plan, and remove only the worktrees and local branches the user approves. The helper proves preservation for every exact branch tip before anything is deleted, and it never forces, prunes, unlocks, or touches a remote.
python3, then python, then py -3 on Windows. Check --version and stop if it is older than 3.11.scripts/git_clean_worktrees.py relative to this skill's own directory. Use that absolute path for every phase; do not resolve it against the current working directory.git fetch and, when needed, the gh api merged-PR lookup. In pi, if the sandbox cannot reach the repository or the network, run the commands with the host_bash tool instead of the sandboxed bash tool. Keep Git, gh, and Python in the same environment; the helper does not translate paths between WSL and native Windows..git directory or a temporary directory.--help if you need the exact flags for the current version.python3 <skill-dir>/scripts/git_clean_worktrees.py inspect [<repository-path>] --output <snapshot.json>
The optional repository path defaults to the current directory. It must be inside the main (non-bare) working tree; a linked worktree is rejected.
Inspection removes nothing, but it does fetch the remote's actual default branch into its origin remote-tracking ref, so it writes Git objects, as documented in references/safety.md.
The snapshot lists every registered worktree and every local branch with an eligibility decision and an explicit reason. Read it, then decide which targets to propose.
topic/x, not refs/heads/topic/x).--allow-ignored is valid only together with removing that same worktree, and only when the snapshot shows the worktree needs the ignored-file override.python3 <skill-dir>/scripts/git_clean_worktrees.py plan --snapshot <snapshot.json> \
[--remove-worktree <id> ...] [--delete-branch <id> ...] [--allow-ignored <id> ...] \
--output <plan.json>
Worktree removal and branch deletion are separate selections. Removing a worktree never authorizes deleting its branch; select --delete-branch explicitly.
Show the user the complete plan and its digest, then wait for explicit approval before continuing. If the user changes any target or ignored-file override, rebuild the plan: the digest changes and the old approval no longer applies.
python3 <skill-dir>/scripts/git_clean_worktrees.py apply --plan <plan.json> --approved-digest <sha256>
Apply revalidates the repository, refreshes the default branch again, rechecks every lock, file protection, fingerprint, and preservation proof, and skips any target that changed or became unsafe. It continues with the other independent approved actions.
Exit codes: 0 every approved action succeeded, 2 some target was skipped or failed, 1 the run aborted before any action.
Summarize the result for the user: removed worktrees, deleted branches with their recorded SHAs, and every skipped or failed target with the helper's reason. Note that deleting a ref removes its reflog, so a recorded SHA is only recoverable while its objects remain.
--force, git worktree unlock, git worktree prune, or hand-rolled deletion.gh authentication cannot see the origin repository, leave those targets retained.Detailed safety and concurrency contracts, limitations, and recovery notes live in references/safety.md.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lucaspimentel/agent-skills --plugin agent-skills20 skills in this plugin
/address-pr-commentsInteractively walk through and address PR review comments one at a time, asking the user what to do for each, committing after each code change, and optionally replying on GitHub. Accepts an optional PR number argument; defaults to the current branch's PR./add-todoCreate or append tasks to TODO.md in the current working directory. Not appropriate for reading, viewing, checking off, removing, or reorganizing TODO.md./chezmoi-diffHelp resolve differences between chezmoi-managed dotfiles and local files, including which direction changes should flow and what the chezmoi file naming conventions (dot_, executable_, .tmpl, symlink_, etc.) mean./diagnosing-bugsDiagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow./git-commitCommit pending changes to git, optionally pushing after. Use when the user says 'commit', 'commit my changes', 'commit all', 'commit everything', 'save my work to git', 'stage and commit', or any variation of wanting to create a git commit. Accepts an optional 'push' keyword to push after committing, and optionally specific file names or a description of what to commit./grill-meA relentless interview about a design that continues until no ambiguities remain. Use when the user asks to be grilled, or when a plan, architecture, API, or design should be stress-tested with questions before implementation.