From wukong-code
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
How this skill is triggered — by the user, by Claude, or both
Slash command
/wukong-code:finishing-a-development-branchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Guide completion of development work by verifying tests, then either executing a stated integration intent or presenting clear options.
Guide completion of development work by verifying tests, then either executing a stated integration intent or presenting clear options.
Core principle: Verify tests → Detect environment → Honor stated integration intent or present options → Execute choice → Clean up.
Announce at start: "I'm using the finishing-a-development-branch skill to complete this work."
Before integrating or presenting options, verify tests pass.
Follow verification-before-completion: run the suite, or reuse in-task evidence when Evidence reuse applies (same claim, same HEAD, relevant paths unchanged, full output still in context). Do not re-run a full suite solely because this skill's Step 1 repeats a verification you just completed under those conditions.
# Run project's test suite (when reuse does not apply)
npm test / cargo test / pytest / go test ./...
If tests fail:
Tests failing (<N> failures). Must fix before completing:
[Show failures]
Cannot proceed with merge/PR until tests pass.
Stop. Don't proceed to Step 2.
If tests pass: Continue to Step 2.
Determine workspace state before presenting options or executing intent:
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
This determines which menu to show (when needed) and how cleanup works:
| State | Menu | Cleanup |
|---|---|---|
GIT_DIR == GIT_COMMON (normal repo) | Standard 4 options | No worktree to clean up |
GIT_DIR != GIT_COMMON, named branch | Standard 4 options | Provenance-based (see finish-options) |
GIT_DIR != GIT_COMMON, detached HEAD | Reduced 3 options (no merge) | No cleanup (externally managed) |
# Try common base branches
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
Or ask: "This branch split from main - is that correct?"
If your human partner already specified the integration action (e.g. "open a PR", "merge to dev", "PR then merge"), skip the menu: map that instruction to the matching option below and go to Step 5. Present the menu only when intent is absent or conflicting.
Normal repo and named-branch worktree — when showing the menu, present exactly these 4 options:
Implementation complete. What would you like to do?
1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is (I'll handle it later)
4. Discard this work
Which option?
Detached HEAD — when showing the menu, present exactly these 3 options:
Implementation complete. You're on a detached HEAD (externally managed workspace).
1. Push as new branch and create a Pull Request
2. Keep as-is (I'll handle it later)
3. Discard this work
Which option?
Don't add explanation - keep options concise.
After the user picks an option (or after mapping stated intent to an option), Read skills/finishing-a-development-branch/references/finish-options.md for per-option commands, confirmation prompts, and workspace cleanup (Options 1 and 4 only).
Skipping test verification
Open-ended questions when intent is absent
Cleaning up worktree for Option 2
Deleting branch before removing worktree
git branch -d fails because worktree still references the branchRunning git worktree remove from inside the worktree
cd to main repo root before git worktree removeCleaning up harness-owned worktrees
.worktrees/ or worktrees/No confirmation for discard
Never:
git worktree remove from inside the worktreeAlways:
cd to main repo root before worktree removalgit worktree prune after removalnpx claudepluginhub wukongnotnull/wukong-code --plugin wukong-codeCreates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.