{"id":"d7ad15b7-939e-496c-aeb2-ffed95aebec5","shortId":"pNg2c5","kind":"skill","title":"finishing-a-development-branch","tagline":"Use when implementation is complete, verification has passed, and the user needs to choose merge, PR, branch cleanup, or follow-up integration handling.","description":"# Finishing a Development Branch\n\n## Overview\n\nGuide completion of development work by presenting clear options and handling chosen workflow.\n\n**Core principle:** Verify tests → Present options → Execute choice → Clean up.\n\n**Announce at start:** \"I'm using the finishing-a-development-branch skill to complete this work.\"\n\n## The Process\n\n### Step 1: Verify Tests\n\n**Before presenting options, verify tests pass:**\n\n```bash\n# Run project's test suite\nnpm test / cargo test / pytest / go test ./...\n```\n\n**If tests fail:**\n```\nTests failing (<N> failures). Must fix before completing:\n\n[Show failures]\n\nCannot proceed with merge/PR until tests pass.\n```\n\nStop. Don't proceed to Step 2.\n\n**If tests pass:** Continue to Step 2.\n\n### Step 2: Determine Base Branch\n\n```bash\n# Try common base branches\ngit merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null\n```\n\nOr ask: \"This branch split from main - is that correct?\"\n\n### Step 3: Present Options\n\nPresent exactly these 4 options:\n\n```\nImplementation complete. What would you like to do?\n\n1. Merge back to <base-branch> locally\n2. Push and create a Pull Request\n3. Keep the branch as-is (I'll handle it later)\n4. Discard this work\n\nWhich option?\n```\n\n**Don't add explanation** - keep options concise.\n\n### Step 4: Execute Choice\n\n#### Option 1: Merge Locally\n\n```bash\n# Switch to base branch\ngit checkout <base-branch>\n\n# Pull latest\ngit pull\n\n# Merge feature branch\ngit merge <feature-branch>\n\n# Verify tests on merged result\n<test command>\n\n# If tests pass\ngit branch -d <feature-branch>\n```\n\nThen: Cleanup worktree (Step 5)\n\n#### Option 2: Push and Create PR\n\n```bash\n# Push branch\ngit push -u origin <feature-branch>\n\n# Create PR\ngh pr create --title \"<title>\" --body \"$(cat <<'EOF'\n## Summary\n<2-3 bullets of what changed>\n\n## Test Plan\n- [ ] <verification steps>\nEOF\n)\"\n```\n\nThen: Cleanup worktree (Step 5)\n\n#### Option 3: Keep As-Is\n\nReport: \"Keeping branch <name>. Worktree preserved at <path>.\"\n\n**Don't cleanup worktree.**\n\n#### Option 4: Discard\n\n**Confirm first:**\n```\nThis will permanently delete:\n- Branch <name>\n- All commits: <commit-list>\n- Worktree at <path>\n\nType 'discard' to confirm.\n```\n\nWait for exact confirmation.\n\nIf confirmed:\n```bash\ngit checkout <base-branch>\ngit branch -D <feature-branch>\n```\n\nThen: Cleanup worktree (Step 5)\n\n### Step 5: Cleanup Worktree\n\n**For Options 1, 2, 4:**\n\nCheck if in worktree:\n```bash\ngit worktree list | grep $(git branch --show-current)\n```\n\nIf yes:\n```bash\ngit worktree remove <worktree-path>\n```\n\n**For Option 3:** Keep worktree.\n\n## Quick Reference\n\n| Option | Merge | Push | Keep Worktree | Cleanup Branch |\n|--------|-------|------|---------------|----------------|\n| 1. Merge locally | ✓ | - | - | ✓ |\n| 2. Create PR | - | ✓ | ✓ | - |\n| 3. Keep as-is | - | - | ✓ | - |\n| 4. Discard | - | - | - | ✓ (force) |\n\n## Common Mistakes\n\n**Skipping test verification**\n- **Problem:** Merge broken code, create failing PR\n- **Fix:** Always verify tests before offering options\n\n**Open-ended questions**\n- **Problem:** \"What should I do next?\" → ambiguous\n- **Fix:** Present exactly 4 structured options\n\n**Automatic worktree cleanup**\n- **Problem:** Remove worktree when might need it (Option 2, 3)\n- **Fix:** Only cleanup for Options 1 and 4\n\n**No confirmation for discard**\n- **Problem:** Accidentally delete work\n- **Fix:** Require typed \"discard\" confirmation\n\n## Red Flags\n\n**Never:**\n- Proceed with failing tests\n- Merge without verifying tests on result\n- Delete work without confirmation\n- Force-push without explicit request\n\n**Always:**\n- Verify tests before offering options\n- Present exactly 4 options\n- Get typed confirmation for Option 4\n- Clean up worktree for Options 1 & 4 only\n\n## Integration\n\n**Called by:**\n- **subagent-driven-development** (Step 7) - After all tasks complete\n- **executing-plans** (Step 5) - After all batches complete\n\n**Pairs with:**\n- **using-git-worktrees** - Cleans up worktree created by that skill","tags":["finishing","development","branch","aegis","ganyuanran","add","agent-skills","ai-agents","ai-coding","baseline-first","claude-code","codex"],"capabilities":["skill","source-ganyuanran","skill-finishing-a-development-branch","topic-add","topic-agent-skills","topic-ai-agents","topic-ai-coding","topic-baseline-first","topic-claude-code","topic-codex","topic-coding-agents","topic-evidence-driven","topic-first-principles","topic-opencode","topic-software-architecture"],"categories":["Aegis"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/GanyuanRan/Aegis/finishing-a-development-branch","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add GanyuanRan/Aegis","source_repo":"https://github.com/GanyuanRan/Aegis","install_from":"skills.sh"}},"qualityScore":"0.581","qualityRationale":"deterministic score 0.58 from registry signals: · indexed on github topic:agent-skills · 262 github stars · SKILL.md body (3,969 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:54:49.307Z","embedding":null,"createdAt":"2026-05-04T19:05:08.218Z","updatedAt":"2026-05-18T18:54:49.307Z","lastSeenAt":"2026-05-18T18:54:49.307Z","tsv":"'-3':287 '/dev/null':150,158 '1':78,186,228,357,394,462,522 '2':125,132,134,149,157,191,264,286,358,397,455 '3':170,198,301,382,400,456 '4':176,210,224,317,359,405,441,464,509,516,523 '5':262,299,350,352,542 '7':533 'accident':470 'add':218 'alway':421,501 'ambigu':437 'announc':58 'as-i':202,303,402 'ask':160 'automat':444 'back':188 'base':136,141,146,154,234 'bash':87,138,231,269,340,364,376 'batch':545 'bodi':282 'branch':5,22,33,69,137,142,162,201,235,244,256,271,308,325,344,370,393 'broken':415 'bullet':288 'call':526 'cannot':112 'cargo':95 'cat':283 'chang':291 'check':360 'checkout':237,342 'choic':55,226 'choos':19 'chosen':46 'clean':56,517,553 'cleanup':23,259,296,314,347,353,392,446,459 'clear':42 'code':416 'commit':327 'common':140,408 'complet':10,36,72,109,179,537,546 'concis':222 'confirm':319,333,337,339,466,477,494,513 'continu':129 'core':48 'correct':168 'creat':194,267,276,280,398,417,556 'current':373 'd':257,345 'delet':324,471,491 'determin':135 'develop':4,32,38,68,531 'discard':211,318,331,406,468,476 'driven':530 'end':429 'eof':284,294 'exact':174,336,440,508 'execut':54,225,539 'executing-plan':538 'explan':219 'explicit':499 'fail':102,104,418,483 'failur':105,111 'featur':243 'finish':2,30,66 'finishing-a-development-branch':1,65 'first':320 'fix':107,420,438,457,473 'flag':479 'follow':26 'follow-up':25 'forc':407,496 'force-push':495 'get':511 'gh':278 'git':143,151,236,240,245,255,272,341,343,365,369,377,551 'go':98 'grep':368 'guid':35 'handl':29,45,207 'head':147,155 'implement':8,178 'integr':28,525 'keep':199,220,302,307,383,390,401 'later':209 'latest':239 'like':183 'list':367 'll':206 'local':190,230,396 'm':62 'main':148,165 'master':156 'merg':20,145,153,187,229,242,246,250,388,395,414,485 'merge-bas':144,152 'merge/pr':115 'might':451 'mistak':409 'must':106 'need':17,452 'never':480 'next':436 'npm':93 'offer':425,505 'open':428 'open-end':427 'option':43,53,83,172,177,215,221,227,263,300,316,356,381,387,426,443,454,461,506,510,515,521 'origin':275 'overview':34 'pair':547 'pass':13,86,118,128,254 'perman':323 'plan':293,540 'pr':21,268,277,279,399,419 'present':41,52,82,171,173,439,507 'preserv':310 'principl':49 'problem':413,431,447,469 'proceed':113,122,481 'process':76 'project':89 'pull':196,238,241 'push':192,265,270,273,389,497 'pytest':97 'question':430 'quick':385 'red':478 'refer':386 'remov':379,448 'report':306 'request':197,500 'requir':474 'result':251,490 'run':88 'show':110,372 'show-curr':371 'skill':70,559 'skill-finishing-a-development-branch' 'skip':410 'source-ganyuanran' 'split':163 'start':60 'step':77,124,131,133,169,223,261,298,349,351,532,541 'stop':119 'structur':442 'subag':529 'subagent-driven-develop':528 'suit':92 'summari':285 'switch':232 'task':536 'test':51,80,85,91,94,96,99,101,103,117,127,248,253,292,411,423,484,488,503 'titl':281 'topic-add' 'topic-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-baseline-first' 'topic-claude-code' 'topic-codex' 'topic-coding-agents' 'topic-evidence-driven' 'topic-first-principles' 'topic-opencode' 'topic-software-architecture' 'tri':139 'type':330,475,512 'u':274 'use':6,63,550 'user':16 'using-git-worktre':549 'verif':11,412 'verifi':50,79,84,247,422,487,502 'wait':334 'without':486,493,498 'work':39,74,213,472,492 'workflow':47 'worktre':260,297,309,315,328,348,354,363,366,378,384,391,445,449,519,552,555 'would':181 'yes':375","prices":[{"id":"d065523a-e2ec-4db1-8c83-171fb0031e60","listingId":"d7ad15b7-939e-496c-aeb2-ffed95aebec5","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"GanyuanRan","category":"Aegis","install_from":"skills.sh"},"createdAt":"2026-05-04T19:05:08.218Z"}],"sources":[{"listingId":"d7ad15b7-939e-496c-aeb2-ffed95aebec5","source":"github","sourceId":"GanyuanRan/Aegis/finishing-a-development-branch","sourceUrl":"https://github.com/GanyuanRan/Aegis/tree/main/skills/finishing-a-development-branch","isPrimary":false,"firstSeenAt":"2026-05-04T19:05:08.218Z","lastSeenAt":"2026-05-18T18:54:49.307Z"}],"details":{"listingId":"d7ad15b7-939e-496c-aeb2-ffed95aebec5","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"GanyuanRan","slug":"finishing-a-development-branch","github":{"repo":"GanyuanRan/Aegis","stars":262,"topics":["add","agent-skills","ai-agents","ai-coding","architecture-driven-development","baseline-first","claude-code","codex","coding-agents","evidence-driven","first-principles","opencode","software-architecture","tdd","tlref"],"license":"mit","html_url":"https://github.com/GanyuanRan/Aegis","pushed_at":"2026-05-18T11:05:01Z","description":"Make AI coding agents architecture-aware: baseline-first, evidence-verified, drift-checked, and safe across long tasks.","skill_md_sha":"0a0cce03e9b760077853d7b2ef94f124be22a830","skill_md_path":"skills/finishing-a-development-branch/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/GanyuanRan/Aegis/tree/main/skills/finishing-a-development-branch"},"layout":"multi","source":"github","category":"Aegis","frontmatter":{"name":"finishing-a-development-branch","description":"Use when implementation is complete, verification has passed, and the user needs to choose merge, PR, branch cleanup, or follow-up integration handling."},"skills_sh_url":"https://skills.sh/GanyuanRan/Aegis/finishing-a-development-branch"},"updatedAt":"2026-05-18T18:54:49.307Z"}}