This skill should be used when "creating a worktree", "worktree naming", "ephemeral branch", "merge from worktree", "worktree cleanup", or navigating between worktrees. Covers naming conventions, ephemeral branch patterns, the CWD trap, and worktree setup. Do not use for general git workflow.
From forgenpx claudepluginhub flox/forge-plugin --plugin forgeThis skill uses the workspace's default tool permissions.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
Git worktree patterns for parallel development work. Enables working on multiple features/tickets simultaneously without branch switching.
All worktrees live in _worktrees/ subfolder:
{repo}/ # Main checkout (on main)
{repo}/_worktrees/ # Worktrees folder
{repo}/_worktrees/{worktree-name}/ # Individual worktree
| Element | Pattern | Example |
|---|---|---|
| Folder | {slice-slug} | auth-refactor |
| Branch | slice/{slug}-{phase}-{suffix} | slice/auth-refactor-design-a1b2 |
| Element | Pattern | Example |
|---|---|---|
| Folder | {effort-slug} | cloud-migration |
| Branch | effort/{slug}-{suffix} | effort/cloud-migration-a1b2 |
| Element | Pattern | Example |
|---|---|---|
| Folder | {feature-slug}-{ticket-num} | auth-refactor-42 |
| Branch | {feature-slug}/{ticket-num}-{desc} | auth-refactor/42-jwt-validation |
Branches are single-use: create → push → merge → delete
Example lifecycle:
slice/auth-refactor-requirements-a1b2 # Created, merged, deleted
slice/auth-refactor-design-c3d4 # Created, merged, deleted
slice/auth-refactor-impl-e5f6 # Created, merged, deleted
Why? Eliminates the painful reset cycle:
merge → git reset --hard origin/main → git push --force
Always specify the starting branch (typically origin/main)
when creating with -b — omitting it starts the branch from
current HEAD, which may be a feature branch, pulling
unrelated commits into your PR.
mkdir -p _worktrees
# ALWAYS specify origin/main as the starting point
git worktree add _worktrees/auth-refactor \
-b slice/auth-refactor-design-a1b2 origin/main
cd _worktrees/auth-refactor
# WRONG - branches from current HEAD (might be a feature branch!)
git worktree add _worktrees/my-feature -b feature/my-feature
# RIGHT - always specify origin/main
git worktree add _worktrees/my-feature \
-b feature/my-feature origin/main
# Navigate to worktree
cd {repo}/_worktrees/{worktree-name}
# Work normally — all git commands work
git status
git add .
git commit -m "feat(scope): Description"
git push -u origin {branch-name}
IMPORTANT: Always merge from main repository, not from worktrees.
cd _worktrees/my-feature
gh pr merge 123 --rebase --delete-branch
# Error: fatal: 'main' is already used by worktree at '/path/to/repo'
Why: The --rebase merge needs to check out main, which
is already checked out in the main repository directory.
# From your worktree
cd _worktrees/my-feature
git push # Ensure your work is pushed
# Navigate to main repository
cd ../.. # Or: cd /path/to/repo
# Merge from main repository
gh pr merge 123 --rebase --delete-branch
Merge via GitHub's web interface (no worktree limitation). Use "Rebase and merge" to maintain linear history.
# Remove worktree (keeps branch)
git worktree remove _worktrees/{worktree-name}
# Optionally delete the branch if merged
git branch -d {branch-name}
If the shell's CWD is inside a worktree directory when that
directory is deleted, the shell breaks permanently for the
session. Even echo hello will fail.
How it happens:
cd /repo && git worktree remove _worktrees/XPrevention:
# WRONG - cd and remove in same command
cd /repo && git worktree remove _worktrees/X
# RIGHT - separate calls
cd /repo # Call 1 (must succeed)
git worktree remove _worktrees/X # Call 2
Problem: Relative paths (_worktrees/...) only work from
repo root. If you're already inside a worktree, they fail.
# Get absolute path from git (works from anywhere)
WORKTREE_PATH=$(git worktree list | \
grep "my-feature" | awk '{print $1}')
# Check if already there
CURRENT=$(pwd)
if [ "$CURRENT" = "$WORKTREE_PATH" ]; then
echo "Already in worktree"
else
cd "$WORKTREE_PATH"
fi
# Go to repo root, then use relative path
cd "$(git rev-parse --show-toplevel)"
cd _worktrees/my-feature
# Use git as source of truth (works from anywhere)
git worktree list
One Work Item Per Worktree
Clean Up After Merge
Keep Main Clean
Consistent Naming
Merge from Main Checkout
gh pr merge from main repository# Check if worktree exists
git worktree list | grep {name}
# If stale, prune and recreate
git worktree prune
git worktree add _worktrees/{name} -b {branch} origin/main
# If branch exists but no worktree
git worktree add _worktrees/{name} {existing-branch}
# If need to reset
git branch -D {branch}
git worktree add _worktrees/{name} -b {branch} origin/main
Symptom: cd _worktrees/my-feature fails even though
git worktree list shows it exists.
Cause: Using relative path from inside another worktree.
Solution: Use absolute paths from git worktree list.
| Aspect | Pattern |
|---|---|
| Location | {repo}/_worktrees/ |
| Naming | {slug} or {slug}-{ticket-num} |
| Branch | Ephemeral, single-use |
| Creation | ALWAYS specify origin/main as base |
| Merging | ALWAYS from main repo, not worktree |
| Navigation | Use absolute paths, never relative |
Key principles: