Use before any worktree or branch operation — switching branches, pushing outside a ship command, removing a worktree or branch, rewriting history — also when the user says force it, don't check, or hurry. Read branch + worktree list + status first; ASK before destructive or shared-state changes.
7 stars
0 votes
0 copies
0 views
Added December 3, 2026
developmentgobashnodegit
Security analysis
A96/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Worktree Coordination?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ivan-ii-tech-digital-worktree-coordination)
---
name: worktree-coordination
description: >-
Use before any worktree or branch operation — switching branches, pushing outside a ship command, removing a worktree or branch, rewriting history — also when the user says force it, don't check, or hurry. Read branch + worktree list + status first; ASK before destructive or shared-state changes.
user-invocable: false
---
# worktree-coordination
## The rule
Before any branch switch, push, or worktree removal, verify current state first:
```bash
git status -sb
git branch --show-current
git worktree list
```
Then explicitly ASK the user before any of these actions:
- Switching the primary checkout's branch
- Removing a worktree or branch this session did not create (verify clean tree + no unmerged commits)
- Force-pushing or rewriting history
- Pushing outside a ship command
"Force it", "don't check anything" or "I'm in a hurry" waives neither step: the state read is three
read-only commands, and `--force` / `-D` on unchecked work is the loss this rule exists for. Read the state,
say what removing would lose (uncommitted files, commits on no other branch), and ask once.
Spawning agents follows the project's team rules and needs no ask.
Invoking `/commit-pr`, `/merge-pr`, `/sync` or a pipeline command IS the answer for that run: the git operations those skills document are pre-authorized. The ASK rule governs ad-hoc operations outside a command. Nothing but `/commit-pr` ever switches the primary checkout's branch.
The user may be mid-task in the checkout; a silent branch switch has broken their session before.
If the ak-git plugin is installed, its SessionStart hook `ak-cleanup-worktrees` removes clean, landed worktrees under `worktrees.root` (default `.claude/worktrees`) and their branches on startup/clear, pre-authorized like `/sync`; don't redo that by hand. Dirty or unlanded ones are only reported: relay that list, never act on it unasked.
## Broken dependency symlinks after worktree deletion
Worktrees can have broken package-manager symlinks (for example pnpm's `node_modules`) if a sibling worktree is deleted. If commands fail with module-not-found errors, in the affected worktree remove the broken `node_modules` symlinks, then reinstall offline from the lockfile, e.g.:
```bash
CI=true pnpm install --offline --frozen-lockfile
```
`CI=true` skips the interactive install UI, so it is safe in automated contexts.