git-worktree-manager
Installation
SKILL.md
Git Worktree Manager
Plain git worktree add/remove is the easy part. The agent uses this skill for what git does not do: give every worktree its own port block so dev servers and Docker services do not collide, carry .env files across, spot worktrees that are stale, dirty or tracking deleted branches, and remove merged ones without losing uncommitted work. It suits multi-agent setups where each agent or terminal owns one worktree.
Core Capabilities
- Worktree lifecycle — create worktrees from new or existing branches with deterministic naming, copy
.envfiles, install dependencies by lockfile detection, list with clean/dirty + ahead/behind status, and safely remove with uncommitted-change detection. - Port allocation — deterministic per-worktree assignment (
base + index * stride), collision detection against running processes, persistent map in.worktree-ports.json, and Docker Compose override generation. - Multi-agent isolation — one branch per worktree, one agent per worktree, no shared state, conflict-free parallel execution, task-ID mapping for traceability.
- Cleanup automation — stale detection by age, merged-branch detection for safe removal, dirty-state warnings, and bulk cleanup with safety confirmations.
When to Use
- You need 2+ concurrent branches open with running dev servers.
- You want isolated environments for feature work, hotfixes, and PR review.
- Multiple AI agents need separate workspaces that do not interfere.
- Your current branch is blocked but a hotfix is urgent.
- You want automated cleanup instead of manual
rm -rfoperations.