How this skill is triggered — by the user, by Claude, or both
Slash command
/workbranch:work-doneThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Important:** This command should be run from the main worktree, NOT from inside the work worktree being cleaned up. If you detect the current directory is inside a linked worktree (git-dir differs from git-common-dir), instruct the user to switch to their main repo checkout first, or run `wt switch main` (or `wt switch ^`).
Important: This command should be run from the main worktree, NOT from inside the work worktree being cleaned up. If you detect the current directory is inside a linked worktree (git-dir differs from git-common-dir), instruct the user to switch to their main repo checkout first, or run wt switch main (or wt switch ^).
When this skill is invoked, follow these steps:
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
GIT_COMMON=$(git rev-parse --git-common-dir 2>/dev/null)
If $GIT_DIR differs from $GIT_COMMON, we are inside a linked worktree. Tell the user:
You're inside the worktree that would be deleted. Please switch to your main repo checkout first:
cd /path/to/main/repoThen run
/work-doneagain.
Stop here.
If the user specified a branch name, use that. Otherwise, ask which work branch to clean up. You can list active worktrees:
wt list
Let the user pick.
gh pr view BRANCH_NAME --json state,mergedAt 2>/dev/null
Proceed to cleanup.
Warn the user:
The PR for branch
BRANCH_NAMEhas not been merged yet. Are you sure you want to clean up?
Wait for confirmation before proceeding. If the user says no, stop.
Warn the user:
No PR found for branch
BRANCH_NAME. The work may not be integrated. Are you sure you want to clean up?
Wait for confirmation before proceeding.
wt remove BRANCH_NAME
This removes the worktree and the local branch via worktrunk.
If the branch still exists on the remote:
git push origin --delete BRANCH_NAME
Skip silently if the branch was already deleted (e.g. by GitHub's auto-delete on merge setting).
Cleanup complete:
- Worktree removed for BRANCH_NAME
- Remote branch deleted
- Linear ticket transitioned via PR merge
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub pdodds/workbranch --plugin workbranch