원클릭으로
using-git-worktrees
Create isolated git worktrees with E2E port isolation for parallel development
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Create isolated git worktrees with E2E port isolation for parallel development
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
MANDATORY for all multi-step tasks - parallel task execution with sequential per-task workflow (implementer → spec review → quality review) with Linear as source of truth
Structured investigate-iterate-synthesize pipeline (5->5->3->1) that sends parallel agents to explore different facets of a question, iterates on findings, progressively synthesizes, and produces a comprehensive analysis report
Structured investigate-iterate-synthesize pipeline (5->5->3->1) that sends parallel agents to explore different facets of a problem, iterates on findings, progressively synthesizes, and produces a detailed execution plan
| name | using-git-worktrees |
| description | Create isolated git worktrees with E2E port isolation for parallel development |
| disable-model-invocation | true |
Git worktrees allow you to have multiple working directories for the same repository, enabling true parallel development without branch switching. This skill covers creating worktrees with proper E2E test port isolation.
# 1. Create the worktree
git worktree add ../wt-<ISSUE>-<description> -b <branch-name>
# 2. Navigate to worktree
cd ../wt-<ISSUE>-<description>
# 3. Set up E2E port isolation (MANDATORY)
./scripts/setup-worktree-e2e.sh
# 4. Verify setup
cat .env.e2e # Shows your isolated ports
# Create worktree for BEA-330
git worktree add ../wt-BEA-330-login-form -b feat/BEA-330-login-form
cd ../wt-BEA-330-login-form
# Set up port isolation
./scripts/setup-worktree-e2e.sh
# Verify
cat .env.e2e
# Output:
# E2E_PORT_BASE=3573
# BINGO_PORT=3573
# TRIVIA_PORT=3574
# HUB_PORT=3575
./start-e2e-servers.sh
This script:
.env.e2e automatically# Load port configuration
source .env.e2e
# Start each server on its isolated port
PORT=$BINGO_PORT pnpm --filter @hosted-game-night/bingo dev &
PORT=$TRIVIA_PORT pnpm --filter @hosted-game-night/trivia dev &
After servers are running, E2E tests automatically use the correct ports:
# Playwright auto-detects worktree and uses ports from .env.e2e
pnpm test:e2e
# Run specific test file
pnpm test:e2e e2e/bingo/home.spec.ts
The port allocation system uses a deterministic hash of the worktree path:
Main repo: ports 3000, 3001, 3002
Worktree 1: ports 3XXX, 3XXX, 3XXX (based on path hash)
Worktree 2: ports 3YYY, 3YYY, 3YYY (different hash)
Worktree 3: ports 3ZZZ, 3ZZZ, 3ZZZ (different hash)
Range: 3000-3999 (supports up to 333 concurrent worktrees)
# Main repo running on 3000-3002
pnpm dev
# Worktree tries to use same ports
cd ../wt-BEA-330-login-form
pnpm dev # ❌ EADDRINUSE: address already in use :::3000
Result: Port conflicts, servers fail to start, E2E tests cannot run.
# Main repo on 3000-3002
pnpm dev
# Worktree uses isolated ports (e.g., 3573-3575)
cd ../wt-BEA-330-login-form
./scripts/setup-worktree-e2e.sh
./start-e2e-servers.sh # ✅ Servers start on 3573-3575
Result: True parallel development - main repo and multiple worktrees run simultaneously.
When done with a worktree:
# Stop servers (if running in background)
pkill -f "next-server.*3573" # Replace 3573 with your base port
# Remove worktree
cd /path/to/main/repo
git worktree remove ../wt-BEA-330-login-form
Problem: Forgot to run setup script after creating worktree.
Fix:
./scripts/setup-worktree-e2e.sh
Problem: Another worktree or process is using the calculated port.
Fix:
# Override with specific port
E2E_PORT_BASE=3999 ./scripts/setup-worktree-e2e.sh
# Verify new ports
cat .env.e2e
Problem: .env.e2e exists but Playwright config not loading it.
Fix:
# Verify portConfig is exported in playwright.config.ts
grep -A 10 "export const portConfig" playwright.config.ts
# Verify worktree detection
pnpm test:e2e --list # Should show detected worktree in URL
scripts/setup-worktree-e2e.she2e/utils/port-isolation.tsplaywright.config.ts (exports portConfig)docs/E2E_TESTING_GUIDE.md section "Parallel Task Execution with Port Isolation"./start-e2e-servers.sh for consistent server startup.env.e2e exists before running E2E tests.env.e2e to version control (already in .gitignore)When using the subagent workflow:
./start-e2e-servers.sh to start servers.env.e2e exists and servers run on isolated portsThis ensures true parallel execution across multiple Linear issues without port conflicts.