finishing-a-development-branch
Use when implementation is complete, branch verification passes, and you need to decide how to integrate the work
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when implementation is complete, branch verification passes, and you need to decide how to integrate the work
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when the user says "ask grok", "get grok's take", "grok review", "have grok look at this", "delegate to grok", or any variation naming Grok/xAI as the perspective they want.
Use when starting any creative work - creating a feature, building a component, adding functionality, or changing designed behavior - before writing code or invoking any implementation skill. Small defect repairs and tweaks triage through razorback:fixing-small-issues first.
Use when a design question resists discussion — a state model with more edge cases than fit in your head, a UI the user keeps flip-flopping on because nobody can picture it, or behavior only knowable by running it — before writing a design doc or implementation plan for that question.
Use when the user says "ask claude", "fresh claude review", "second opinion from another claude", "have another claude look at this", "delegate to a fresh claude", or any variation naming Claude as the second perspective they want.
Use when the user says "ask codex", "get codex's take", "codex review", "have codex look at this", "delegate to codex", or any variation naming Codex/OpenAI as the perspective they want. Also use for a generic "second opinion from a different model" when no other model is named.
Use when planning or reviewing non-trivial code changes, refactoring architecture, evaluating module boundaries, repeated findings reveal coupling, tests are hard to write because interfaces are unclear, or the user asks for codebase design improvements, complexity reduction, deduplication, or cleanup of existing code.
| name | finishing-a-development-branch |
| description | Use when implementation is complete, branch verification passes, and you need to decide how to integrate the work |
Guide completion of development work by selecting a mode, then executing the appropriate flow (autonomous push+PR or interactive menu).
Core principle: Verify the project-defined branch gate -> choose mode (autonomous default) -> execute -> clean up.
Announce at start: "I'm using the finishing-a-development-branch skill to complete this work."
If the agent was just finishing an autonomous execution run (i.e. this skill is being invoked as the final step of razorback:executing-plans or razorback:subagent-driven-development), use Autonomous Mode. If the user invoked the skill directly (e.g. "finish this branch"), use Interactive Mode. In ambiguous cases, default to Autonomous - run-to-completion is the bias.
No menu, no prompts. Push the branch, open a PR with the morning-report summary, write the full report to .memories/, emit a one-line terminal pointer, exit. Merge is never auto-performed.
Use the plan's Verification Strategy and verification ledger.
Run the project-defined branch-gate scope before push or PR. If the verification ledger already has a passing branch-gate entry for the current HEAD, reuse that evidence instead of rerunning the same command. Add any required expensive-specialist scopes when touched areas demand them.
If required verification fails, this is a blocker taxonomy #5 (unresolvable test failures). Do not create a PR. Instead:
Status: Blocked, the failure summary in the Tests section, and the blocker description in Blockers hit..memories/autonomous-run-YYYY-MM-DD-<slug>.md.Blocked. Report: .memories/autonomous-run-YYYY-MM-DD-<slug>.md and exit.If required verification passes, continue.
git merge-base returns a commit SHA, not a branch name. Autonomous Mode needs both: the branch name for gh pr create --base, and the SHA for diff-range computation. Resolve them as two separate values:
# Prefer an explicit base from the plan/user, then the remote's default branch,
# then main/master. Merge-base-with-main alone is wrong for repos whose PRs
# target another branch (develop, release/*) — main almost always shares history.
if [ -n "$PLAN_BASE" ]; then
BASE_BRANCH="$PLAN_BASE"
elif DEFAULT_REF=$(git symbolic-ref --quiet refs/remotes/origin/HEAD 2>/dev/null); then
BASE_BRANCH="${DEFAULT_REF#refs/remotes/origin/}"
elif git show-ref --verify --quiet refs/heads/main; then
BASE_BRANCH=main
elif git show-ref --verify --quiet refs/heads/master; then
BASE_BRANCH=master
fi
if [ -z "$BASE_BRANCH" ] || ! BASE_SHA=$(git merge-base HEAD "$BASE_BRANCH" 2>/dev/null); then
echo "Cannot determine PR base branch/merge-base." >&2
# Blocker taxonomy #3 (plan-contradicting data): the branch doesn't descend
# from a known base. Emit a Blocked report per the failure protocol below and
# exit. Do NOT push.
fi
Use $BASE_SHA for any base..HEAD range computation (e.g. git diff --stat $BASE_SHA..HEAD in Step 3). Use $BASE_BRANCH for gh pr create --base "$BASE_BRANCH" in Step 6.
If both lookups fail (no main, no master ancestor), that's a blocker per taxonomy #3. Render a partial morning report with Status: Blocked, describe the missing base in Blockers hit, write it to .memories/autonomous-run-YYYY-MM-DD-<slug>.md, emit the terminal one-liner, and exit. Do not push.
Fill the placeholders in ./morning-report-template.md using the fields the caller accumulated during execution (plan name + path, branch name, phases complete/total, tasks complete/total, duration, judgment calls log, external review outcome, tests summary, blockers, files changed from git diff --stat $BASE_SHA..HEAD, next steps).
Produce two renderings:
.memories/ and for review..memories/ file instead (committed in Step 4, so the link is live the moment the PR opens).Write the full rendered report to .memories/autonomous-run-YYYY-MM-DD-<slug>.md, where <slug> is a short kebab-case identifier for the plan (e.g. autonomous-execution). Committing it before the push means the PR includes the report from its first revision — no dead link in the PR body. The PR does not exist yet, so render {{pr_url}} as pending — filled in after PR creation; Step 7 writes the real URL back.
git add .memories/autonomous-run-YYYY-MM-DD-<slug>.md
git commit -m "docs: autonomous run report for <plan name>"
This commit (and the Step 7 URL write-back) are metadata-only: they touch nothing outside .memories/, so the Step 1 branch-gate evidence carries over to the new HEAD. If anything outside .memories/ changes after Step 1, the evidence is invalidated — re-run the branch gate before pushing.
git push -u origin <branch>
If the push is rejected (branch already tracks a different remote, non-fast-forward, network failure), log the exact error in the report's Blockers hit section, set Status: Blocked, commit the updated report, emit the terminal pointer, and exit. Do not retry with --force.
gh pr create \
--base "$BASE_BRANCH" \
--title "<plan name or feature name>" \
--body "$(rendered_pr_summary)"
If gh is not installed or the command fails (auth, network, repo not on origin), update the report with the failure in Blockers hit and Status: Partial (the branch was pushed but the PR was not created), commit and push the update, emit the terminal pointer, and exit.
Capture the PR URL from gh's output.
Replace the pending — filled in after PR creation value in the committed report with the captured URL, then commit and push the update. This is a metadata-only commit; the branch-gate evidence still holds (see Step 4).
git add .memories/autonomous-run-YYYY-MM-DD-<slug>.md
git commit -m "docs: record PR URL in run report"
git push
One line, then exit:
Done. PR: <url>. Report: .memories/autonomous-run-YYYY-MM-DD-<slug>.md
gh missing, remote mismatch), emit a partial report with Status: Blocked or Status: Partial as appropriate and let the user resolve from there..memories/, even on blocked/partial outcomes — the report is the user's morning read regardless of outcome.Used when the user invokes this skill directly ("finish this branch"). Presents the classic 4-option menu.
Before presenting options, verify the project-defined branch gate passes or reuse a passing ledger entry for current HEAD:
# Run the command specified by the plan's branch-gate scope
<branch-gate command>
If verification fails:
Branch verification failing (<N> failures). Must fix before completing:
[Show failures]
Cannot proceed with merge/PR until branch verification passes.
Stop. Don't proceed to Step 2.
If verification passes: Continue to Step 2.
git merge-base returns a commit SHA, not a branch name. Downstream steps need the branch name (git checkout <base-branch>, gh pr create --base), so resolve both values the same way Autonomous Step 2 does:
# Prefer an explicit base from the plan/user, then the remote's default branch,
# then main/master. Merge-base-with-main alone is wrong for repos whose PRs
# target another branch (develop, release/*) — main almost always shares history.
if [ -n "$PLAN_BASE" ]; then
BASE_BRANCH="$PLAN_BASE"
elif DEFAULT_REF=$(git symbolic-ref --quiet refs/remotes/origin/HEAD 2>/dev/null); then
BASE_BRANCH="${DEFAULT_REF#refs/remotes/origin/}"
elif git show-ref --verify --quiet refs/heads/main; then
BASE_BRANCH=main
elif git show-ref --verify --quiet refs/heads/master; then
BASE_BRANCH=master
fi
if [ -z "$BASE_BRANCH" ] || ! BASE_SHA=$(git merge-base HEAD "$BASE_BRANCH" 2>/dev/null); then
echo "Cannot determine base branch/merge-base." >&2
# Interactive Mode: nothing resolved, so ask the user instead of guessing.
# Do NOT proceed to Step 3 until the base branch is confirmed.
fi
If nothing resolves, ask: "This branch split from main - is that correct?"
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 branch gate on merged result
<branch-gate command>
# If verification passes
git branch -d <feature-branch>
Then: Cleanup worktree (Step 5)
# Push branch
git push -u origin <feature-branch>
# Create PR
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<2-3 bullets of what changed>
## Test Plan
- [ ] <verification steps>
EOF
)"
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 | Yes | - | - | Yes |
| 2. Create PR | - | Yes | Yes | - |
| 3. Keep as-is | - | - | Yes | - |
| 4. Discard | - | - | - | Yes (force) |
Skipping test verification
Open-ended questions
Automatic worktree cleanup
No confirmation for discard
Never:
gh not installed), emit a partial report with status Blocked and let the user resolve; don't prompt for an optionAlways:
.memories/ file, terminal one-liner) regardless of outcomeCalled by:
razorback:executing-plans (Step 5) — Autonomous mode when the execution skill finishes cleanlyrazorback:subagent-driven-development (Step 5 or 4a+finish) — Autonomous modePairs with: