manage-worktrees
Create, reuse, and clean up git worktrees consistently. Use when work needs an isolated checkout, when the user asks for a worktree, or when stale worktrees need cleanup.
How do I install this agent skill?
npx skills add https://github.com/klausborges/workflow-skills --skill manage-worktreesIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides a standardized workflow for managing Git worktrees, including environment detection, isolation best practices, and cleanup procedures. It correctly recommends using native harness tools and maintaining local directory isolation. A potential surface for indirect prompt injection is identified as the skill processes environment-sourced branch names to construct shell commands, which is a common characteristic of development-oriented tools.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Manage Worktrees
Placement rules follow the git-conventions skill. Worktrees are optional: reach for one when isolation helps (parallel agents, work beside an occupied checkout) and work in place otherwise.
Workflow
- Detect existing isolation first: when
git rev-parse --git-dirand--git-common-dirdiffer andgit rev-parse --show-superproject-working-treeprints nothing, this is already a worktree; use it and skip creation. - Prefer the harness's native worktree tool when one exists; it manages placement and cleanup itself.
- Manual fallback: confirm
.worktrees/is ignored (git check-ignore -q .worktrees/wt; add it to.gitignoreand commit when missing), thengit worktree add .worktrees/<flattened-branch> <branch>for an existing branch, adding-b <branch>to create one. - Run the repo's dependency setup in the new worktree when the work needs a build or tests.
- Clean up once a branch merges or is abandoned:
git worktree remove <path>, delete the branch, andgit worktree prunefor broken registrations. Audit withgit worktree listwhen in doubt.
Guardrails
- Never nest a worktree inside another worktree.
- Create worktrees only under
.worktrees/or a native harness home; project folders stay free of bare worktree siblings. - Removal waits until the branch tip is reachable from the remote or the user waives it.
Output
The worktree path and branch, or the cleanup performed per git worktree list.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/klausborges/workflow-skills/manage-worktrees">View manage-worktrees on skillZs</a>