From scaffolding
Manages git worktree lifecycle: creation, diagnostics, state transitions, and recovery from stuck or corrupt worktrees. Connects to a broader task scaffolding flow.
How this skill is triggered — by the user, by Claude, or both
Slash command
/scaffolding:worktree-managementThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Scaffolding.tool-specific worktree lifecycle management, diagnostics, and recovery procedures.
Scaffolding.tool-specific worktree lifecycle management, diagnostics, and recovery procedures.
Other agents (developer, architect) do NOT commit. The worktree flow is:
If a worktree has no new commits after an agent finishes, the changes are uncommitted — gitops must commit them BEFORE merge.
create_worktree() --> agent executes (no commit) --> gitops: commit
--> gitops: merge_to_main() --> gitops: push --> gitops: cleanup
| Status | Meaning |
|---|---|
ready | Created, waiting for task execution |
merging | Merge in progress |
merged | Successfully merged to main |
conflict | Merge conflict detected |
cleanup | Being removed |
removed | Fully cleaned up |
| Resource | Path |
|---|---|
| Worktrees directory | .scaffolding/worktrees/ |
| Worktree metadata | .scaffolding/worktrees/{task_id[:12]}/worktree.json |
| Branch naming | scaffolding/{task_id[:12]} |
git worktree list
ls -la .scaffolding/worktrees/
for d in .scaffolding/worktrees/*/; do
changes=$(cd "$d" && git status --porcelain 2>/dev/null | wc -l)
if [ "$changes" -gt 0 ]; then
echo "UNCOMMITTED: $d ($changes files)"
fi
done
git worktree remove --force .scaffolding/worktrees/{task_id[:12]}
git branch -D scaffolding/{task_id[:12]}
rm -rf .scaffolding/worktrees/{task_id[:12]}
git worktree prune
cd .scaffolding/worktrees/{task_id[:12]}
git add -A && git stash
cd /project/root && git stash pop
After a merge or discard finishing action, clean up the worktree:
git worktree remove .scaffolding/worktrees/{task_id[:12]} 2>/dev/null
rm -rf .scaffolding/worktrees/{task_id[:12]}
git worktree prune
Note: Only needed for merge and discard actions. PR and keep actions leave the worktree intact.
npx claudepluginhub komluk/scaffolding --plugin scaffoldingManages git worktrees for isolated parallel development sessions with safety checks for uncommitted changes and unpushed commits.
Manages Git worktree lifecycle: creates isolated .claude/worktrees/ for parallel development or experiments, lists rune/* branches, cleans up stale or merged ones. Enforces max 3 active.
Creates isolated git worktrees for feature branches with smart directory selection, gitignore checks, auto project setup detection, and baseline test verification. Use for task isolation from main workspace.