From harness-engineering
This skill manages Git worktrees for isolated parallel development. It handles creating, listing, switching, and cleaning up worktrees with automatic .env file copying and shared-context configuration. Use when spinning up parallel feature branches, code review in isolation, or multi-agent development.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-engineering:skills-harness-engineering-assets-skills-git-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Manage Git worktrees for isolated parallel development with environment file management
Manage Git worktrees for isolated parallel development with environment file management and shared-context support for multi-agent workflows.
git stash / branch-switching friction is slowing things downNever call git worktree add directly. Always use the manager script — it handles
env file copying, .gitignore management, and writes .worktree-config for agent use.
# Correct
bash .claude/skills/git-worktree/scripts/worktree-manager.sh create feature-name
# Wrong
git worktree add .worktrees/feature-name -b feature-name main
SCRIPT=".claude/skills/git-worktree/scripts/worktree-manager.sh"
# Create new worktree (copies .env files, writes .worktree-config)
bash $SCRIPT create <branch-name> [from-branch]
# List all worktrees
bash $SCRIPT list
# Switch to a worktree
bash $SCRIPT switch <name>
# Refresh .env files from main repo
bash $SCRIPT copy-env [name]
# Clean up inactive worktrees
bash $SCRIPT cleanup
.worktrees/<branch-name>/.env* files from main repo (except .env.example).worktree-config with MAIN_REPO path.worktrees to .gitignore if missingWorktrees are isolated file trees — they do NOT share docs/, plans/, or other
non-git content with the main repo. To avoid drift and duplication:
.worktree-config to get MAIN_REPO path$MAIN_REPO/docs/ — do not duplicate them into the worktree$MAIN_REPO/docs/plans/# Example: read MAIN_REPO from config
source .worktree-config
cat "$MAIN_REPO/docs/plans/my-plan.md"
Symlinks point one direction. If worktree/docs → main/docs, edits in the worktree
modify main's files directly. With multiple agents in multiple worktrees, this creates
race conditions. The config-based approach is explicit and safe.
project-root/
├── .worktrees/ # gitignored
│ ├── feat/new-feature/ # worktree 1
│ │ ├── .git
│ │ ├── .env # copied from main
│ │ ├── .worktree-config # MAIN_REPO pointer
│ │ └── src/
│ └── fix/bug-123/ # worktree 2
│ ├── .git
│ ├── .env
│ ├── .worktree-config
│ └── src/
├── docs/ # single source of truth
│ ├── plans/
│ └── references/
└── .gitignore # includes .worktrees
.worktree-config is auto-generated and should not be committednpx claudepluginhub lattice-technologies-inc/harness-engineering --plugin harness-engineeringManage Git worktrees for isolated parallel development. Automates creation, switching, and cleanup with .env copying and .gitignore management. Useful for code reviews and feature work.
Manages git worktrees via unified bash script for parallel development: creates isolated feature environments, lists/switches status, copies .env files, cleans up merged/stale worktrees.
Manages Git worktrees for parallel development: create from main with .env copying, list status, switch, cleanup interactively via bash script.