/engineering-advanced-skills:git-worktree-managerfrom engineering-advanced-skills
Manages parallel Git worktrees with port isolation, .env sync, health checks, and safe cleanup. Useful for multi-branch development or multi-agent setups.
Ships in engineering-advanced-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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.
.env files, install dependencies by lockfile detection, list with clean/dirty + ahead/behind status, and safely remove with uncommitted-change detection.base + index * stride), collision detection against running processes, persistent map in .worktree-ports.json, and Docker Compose override generation.rm -rf operations.Before managing worktrees, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
worktree_manager.py action vs port_allocator.py vs worktree_validator.py).Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
worktree_manager.py create <branch> --base main; it names the directory deterministically, copies .env files and installs dependencies from the lockfile it finds.port_allocator.py assign <worktree-name>: a block at base + index * stride, checked against listening processes and recorded in .worktree-ports.json. Use the Docker Compose override in references/setup-and-ports.md to apply it.worktree_validator.py (stale trees, missing directories, deleted branches, .env parity, port conflicts, lockfile drift).worktree_manager.py cleanup --dry-run first, then without --dry-run; dirty worktrees are reported, not deleted. Run port_allocator.py sync afterwards to free released blocks.worktree_validator.py reports no issues and git worktree list matches the port registry.Run inside any git repository:
python3 scripts/worktree_manager.py list # worktrees with clean/dirty and ahead/behind
python3 scripts/port_allocator.py status # current port blocks
python3 scripts/worktree_validator.py --stale-days 14 --json # health report
python3 scripts/worktree_manager.py cleanup --stale-days 30 --dry-run
| Tool | Subcommands and flags | Exit codes |
|---|---|---|
worktree_manager.py | list, create <branch> [--base], remove <name>, cleanup [--stale-days N] [--dry-run]; --json | 0, 1 git operation failed, 2 no subcommand or not inside a repository |
port_allocator.py | status, assign <name> [--index] [--branch], release <name>, check, sync; --json | 0, 1 operation failed, 2 no subcommand or not inside a repository |
worktree_validator.py | --checks stale,missing,branch,env,ports,lockfile, --stale-days, --json | 0 no errors (warnings allowed), 1 errors found, 2 unknown check or not inside a repository |
Mistake: Deleting worktree directories with rm -rf.
Why it happens: It looks like any other folder.
Instead: Use worktree_manager.py remove (or git worktree remove); a raw delete leaves stale metadata and loses uncommitted work without warning.
Mistake: Two worktrees on the same dev-server ports.
Why it happens: Every checkout reads the same default .env.
Instead: Assign a port block per worktree and generate the Compose override from it.
Mistake: Two agents sharing one worktree. Why it happens: It saves a checkout. Instead: One agent per worktree and branch; shared working trees produce interleaved, unreviewable changes.
scripts/worktree_manager.py, scripts/port_allocator.py, scripts/worktree_validator.py — the tools above. They read the current repository; there is no sample data.Load the reference that matches the task — keep this file lean and pull detail on demand:
git worktree commands, the deterministic port-allocation strategy and .worktree-ports.json format, collision-detection snippet, the full setup-worktree.sh script, and the Docker Compose per-worktree override. Read when creating a worktree or wiring up ports/services.cleanup-worktrees.sh safe-cleanup script, the multi-agent assignment pattern and rules, the scenario→action decision matrix, and the post-creation validation checklist. Read when automating cleanup or coordinating agents.This skill covers:
This skill does NOT cover:
pr-review-expert and release-manager)env-secrets-manager)ci-cd-pipeline-builder)monorepo-navigator)Related skills: engineering/env-secrets-manager (the .env files copied into worktrees), engineering/monorepo-navigator (package boundaries inside a worktree).
references/cleanup-and-workflows.md (opens in a new tab)references/operations-playbook.md (opens in a new tab)references/setup-and-ports.md (opens in a new tab)scripts/port_allocator.py (opens in a new tab)scripts/worktree_manager.py (opens in a new tab)scripts/worktree_validator.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub borghei/claude-skills --plugin engineering-advanced-skills100 skills in this plugin
/a11y-auditStatic WCAG scan of HTML files (alt text, headings, labels, ARIA, lang, landmarks) and colour contrast checks for colour pairs or CSS. Use when auditing templates for accessibility, checking contrast, or adding an a11y gate to CI.
/agent-designerDesigns multi-agent system architectures with orchestration patterns, tool schemas, and performance evaluation. Use when building AI agent systems, designing agent workflows, creating tool schemas, or evaluating agent performance.
/agent-harnessTest and evaluation harness for AI agents — scenario suites, deterministic replay, regression diffing, cost and latency budgets. Use when agent quality is vibe-checked, before shipping a prompt or model change, or when evals drift.
/agenthubRuns a multi-agent job as a dependency graph: validates the DAG, tracks each agent's state on a board, then ranks and merges their outputs. Use when spawning parallel agents, monitoring a run, or merging results.
/agentic-evaluation-frameworkBuilds LLM and agent evals: weighted rubrics, LLM-as-judge design, inter-rater agreement and pairwise ranking (Elo, Bradley-Terry) from scores you collect. Use when setting up a judge, scoring outputs, or comparing model or prompt variants.
/agent-protocolDesign AI agent communication protocols: MCP tool schemas, A2A, function calling, and inter- agent messaging. Use when building multi-agent systems, defining tool interfaces, or implementing agent-to-agent communication.
Other plugins' skills for the same job