一键导入
finishing-a-development-branch
Guide branch completion — structured options for merge, PR, or cleanup when implementation is done.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide branch completion — structured options for merge, PR, or cleanup when implementation is done.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when starting a new patch session and needing to pick a Plane issue to work on before claiming a version lock and creating a worktree.
Use when starting a new patch session and needing to pick a Plane issue to work on before claiming a version lock and creating a worktree.
Post-deploy verification for both Portainer (home) and Fly.io (cloud) environments. Runs environment-appropriate health checks, log inspection, env var verification, cron validation, and endpoint smoke tests. Covers the gap between "deploy succeeded" and "deploy actually works." Triggers on: "deploy verify", "post-deploy", "verify deploy", "smoke test deploy", "did the deploy work", "check the deploy", "/deploy-verify"
StakTrakr-specific Phase 1 version bump — edits 6 files, trims What's New, delegates sw.js to pre-commit hook.
API feeds, pollers, feed thresholds, data paths, StakTrakrApi structure, Fly.io and health badge issues.
Ship dev→main — PR, resolve threads, GitHub Release. Only on explicit user "ready to ship".
| name | finishing-a-development-branch |
| description | Guide branch completion — structured options for merge, PR, or cleanup when implementation is done. |
Guide completion of development work by presenting clear options and handling chosen workflow.
Core principle: Verify tests → Present options → Execute choice → Clean up.
Announce at start: "I'm using the finishing-a-development-branch skill to complete this work."
Before anything else, verify three things:
0a. Plane issue exists: Every runtime-code branch must trace to a Plane issue (STRK-XXX). If you can't name the issue, STOP — create one or find the existing one before proceeding. Legacy STAK-XXX references are historical only.
0b. Version number exists: The branch must have a version bump (via /release patch). If js/constants.js hasn't been updated with a new version in this branch, STOP — run /release patch before proceeding. Un-versioned PRs are not allowed.
0c. Implementation logs exist: If this branch was implementing a spec-workflow spec:
spec-status to see task completion countslog-implementation entryBefore presenting options, verify tests pass:
# Run project's test suite
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.
First, check the current branch name — this determines the correct base:
git branch --show-current
| Current branch pattern | Correct base | Notes |
|---|---|---|
patch/* or patch-* | dev | StakTrakr patch workflow — NEVER target main |
feature/*, fix/*, etc. | Check AGENTS.md PR Lifecycle section | May still be dev |
dev | main | Only allowed via Phase 4.5, requires explicit user "release" instruction |
# Only fall back to git merge-base if branch name gives no clear signal
git merge-base HEAD dev 2>/dev/null || git merge-base HEAD main 2>/dev/null
⛔ StakTrakr rule: If on a
patch/*branch, the base is alwaysdev. Never propose merging a patch branch tomain. If the detected base would bemainand you are NOT on thedevbranch, STOP and ask the user before proceeding.
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?
Don't add explanation - keep options concise.
# Switch to base branch
git checkout <base-branch>
# Pull latest
git pull
# Merge feature branch
git merge <feature-branch>
# Verify tests on merged result
<test command>
# If tests pass
git branch -d <feature-branch>
Then: Cleanup worktree (Step 5)
# Push branch
git push -u origin <feature-branch>
# Create PR — ALWAYS use the base determined in Step 2 (never assume main)
gh pr create --base <base-branch> --title "<title>" --body "$(cat <<'EOF'
## Summary
<2-3 bullets of what changed>
## Test Plan
- [ ] <verification steps>
EOF
)"
⛔ Reminder:
<base-branch>must come from Step 2. Forpatch/*branches it is alwaysdev.
Then: Cleanup worktree (Step 5)
Report: "Keeping branch . Worktree preserved at ."
Don't cleanup worktree.
Confirm first:
This will permanently delete:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>
Type 'discard' to confirm.
Wait for exact confirmation.
If confirmed:
git checkout <base-branch>
git branch -D <feature-branch>
Then: Cleanup worktree (Step 5)
For Options 1, 2, 4:
Check if in worktree:
git worktree list | grep $(git branch --show-current)
If yes:
git worktree remove <worktree-path>
For Option 3: Keep worktree.
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | ✓ | - | - | ✓ |
| 2. Create PR | - | ✓ | ✓ | - |
| 3. Keep as-is | - | - | ✓ | - |
| 4. Discard | - | - | - | ✓ (force) |
Never:
main from a patch/* branch — the base is always dev for patch branchesdev → main without explicit user "release" instruction — this is a protected actionAlways:
mainRationalization traps — STOP if you think:
dev → main goes to main, and only on user instructionCalled by:
Pairs with: