← SkillquiverCONTENT HISTORY

Update to Skillquiver

Snapshot Sep 30, 2026 · 23:14 UTC · version 2.1.0

Collection source: not recorded for this historical snapshot.

WHAT CHANGED · RULE-BASED ANALYSIS

First saved snapshot

No earlier snapshot is available to establish a change.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "description": "Guides integration of a finished branch: verify tests, present merge/PR/keep/discard options to the user, and clean up worktrees. Use when implementation is complete, all tests pass, and the work needs to be integrated.",
  "included_files": [
    {
      "relative_path": "agents/openai.yaml",
      "size_in_bytes": 222
    }
  ],
  "name": "finishing-a-development-branch",
  "skill_md_contents": "---\nname: finishing-a-development-branch\ndescription: \"Guides integration of a finished branch: verify tests, present merge/PR/keep/discard options to the user, and clean up worktrees. Use when implementation is complete, all tests pass, and the work needs to be integrated.\"\n---\n\n# Finishing a Development Branch\n\n## Overview\n\n**Core principle:** Verify tests → Detect environment → Present options → Execute choice → Clean up.\n\nShell commands below use Bash syntax — run them in a Bash-capable shell such as Git Bash on Windows.\n\n**Announce at start:** \"I'm using the finishing-a-development-branch skill to complete this work.\"\n\n## Step 1: Verify Tests\n\nRun the project's full test suite (`npm test` / `cargo test` / `pytest` / `go test ./...`). If the project has no test suite, verification is whatever check the project does have (build, lint, smoke run); if there is none, ask the user what should gate completion.\n\n**If tests fail**, report the failures and stop — the menu comes after a green suite:\n\n```\nTests failing (<N> failures). Must fix before completing:\n\n[Show failures]\n```\n\n**If tests pass:** continue to Step 2.\n\n## Step 2: Detect Environment\n\n```bash\nGIT_DIR=$(cd \"$(git rev-parse --git-dir)\" 2>/dev/null && pwd -P)\nGIT_COMMON=$(cd \"$(git rev-parse --git-common-dir)\" 2>/dev/null && pwd -P)\n# Capture now, while still inside the workspace — Step 5 changes directory\n# before cleanup (Step 6) needs this value\nWORKTREE_PATH=$(git rev-parse --show-toplevel)\nBRANCH=$(git branch --show-current)\necho \"GIT_DIR=$GIT_DIR\"\necho \"GIT_COMMON=$GIT_COMMON\"\necho \"WORKTREE_PATH=$WORKTREE_PATH\"\necho \"BRANCH=${BRANCH:-<detached>}\"\n```\n\nNote the printed values — shell variables do not persist between tool calls, and Step 6 needs them.\n\nThis determines which menu to show and how cleanup works:\n\n| State | Menu | Cleanup |\n|-------|------|---------|\n| `GIT_DIR == GIT_COMMON` (normal repo) | Standard 3 options | No worktree to clean up |\n| `GIT_DIR != GIT_COMMON`, named branch | Standard 3 options | Provenance-based (see Step 6) |\n| `GIT_DIR != GIT_COMMON`, detached HEAD | Reduced 2 options (no merge) | Externally managed — leave in place |\n\n## Step 3: Determine Base Branch\n\nThe base branch is whatever this work forked from — usually named in the\nplan, the conversation, or the branch's upstream. If it is not already\nknown, ask: \"This branch split from <your best guess> - is that correct?\"\nConfirm before merging: merging into the wrong base is expensive to undo.\n\n## Step 4: Present Options\n\n**Review checkpoint:** requesting-code-review makes review mandatory before merge (\"When to Request Review\"). If this work has not been reviewed yet, dispatch a review per that skill before offering the merge option.\n\n**Normal repo and named-branch worktree — present exactly these 3 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)\n\nWhich option?\n```\n\n**Detached HEAD — present exactly these 2 options:**\n\n```\nImplementation complete. You're on a detached HEAD (externally managed workspace).\n\n1. Push as new branch and create a Pull Request\n2. Keep as-is (I'll handle it later)\n\nWhich option?\n```\n\nPresent the menu exactly as written — concise, with every option coming\nfrom the list above. Discarding the work happens only in response to the user explicitly asking for it (see \"If the user asks to\ndiscard the work\" below). Wait for their answer; the integration decision\nis theirs.\n\n## Step 5: Execute Choice\n\n### Option 1: Merge Locally\n\n```bash\n# Get main repo root for CWD safety\nMAIN_ROOT=$(git -C \"$(git rev-parse --git-common-dir)/..\" rev-parse --show-toplevel)\ncd \"$MAIN_ROOT\"\n\n# Merge first — verify success before removing anything\ngit checkout <base-branch>\ngit pull\ngit merge <feature-branch>\n\n# Verify tests on merged result\n<test command>\n```\n\nIf tests fail on the merged result: stop, leave the worktree and branch in\nplace, and investigate — nothing has been pushed, so the merge is local\nand recoverable.\n\nOnce the merged result is green: clean up the worktree (Step 6), then\ndelete the branch:\n\n```bash\ngit branch -d <feature-branch>\n```\n\n### Option 2: Push and Create PR\n\n```bash\ngit push -u origin <feature-branch>\n# From a detached HEAD, name the new branch on the remote:\n# git push origin HEAD:refs/heads/<new-branch>\n```\n\nThen create the pull/merge request against <base-branch> with the forge's\ntooling — its CLI if one is available, or the creation URL most forges\nprint when you push — following the repo's PR template and conventions if\npresent, and report the URL to the user.\n\nKeep the worktree — the user iterates on PR feedback there.\n\n### Option 3: Keep As-Is\n\nReport: \"Keeping branch <name>. Worktree preserved at <path>.\"\n\n### If the user asks to discard the work\n\nThis path exists only as a response to an explicit request to throw the\nwork away. Confirm first:\n\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 that exact confirmation. When it arrives:\n\n```bash\nMAIN_ROOT=$(git -C \"$(git rev-parse --git-common-dir)/..\" rev-parse --show-toplevel)\ncd \"$MAIN_ROOT\"\n```\n\nThen clean up the worktree (Step 6) and force-delete the branch:\n\n```bash\ngit branch -D <feature-branch>\n```\n\nIf Step 6 left the worktree in place (externally managed), git refuses to\ndelete a branch still checked out there. Detach it first — `git -C\n\"$WORKTREE_PATH\" checkout --detach` or the platform's workspace-exit tool —\nthen re-run the branch delete.\n\n## Step 6: Cleanup Workspace\n\n**Runs for Option 1 and confirmed discards.** Options 2 and 3 always\npreserve the worktree. Both callers have already changed directory to the\nmain repo root — worktree removal must run from outside the worktree —\nand use the `GIT_DIR`/`GIT_COMMON`/`WORKTREE_PATH` values captured in\nStep 2, from before that directory change.\n\n**If `GIT_DIR == GIT_COMMON`:** Normal repo, no worktree to clean up. Done.\n\n**If `WORKTREE_PATH` is under `.worktrees/` or `worktrees/`** (the ownership\nconvention from the using-git-worktrees skill): This workflow created this\nworktree — we own cleanup:\n\n```bash\ngit worktree remove \"$WORKTREE_PATH\"\ngit worktree prune  # Self-healing: clean up any stale registrations\n```\n\n**Otherwise:** The host environment owns this workspace — leave it in\nplace. If your platform provides a workspace-exit tool, use it.\n\n## Quick Reference\n\n| Option | Merge | Push | Keep Worktree | Cleanup Branch |\n|--------|-------|------|---------------|----------------|\n| 1. Merge locally | yes | - | - | yes |\n| 2. Create PR | - | yes | yes | - |\n| 3. Keep as-is | - | - | yes | - |\n| Discard (explicit request only) | - | - | - | yes (force) |\n\n## Common Rationalizations\n\n| Excuse | Reality |\n|--------|---------|\n| \"Tests passed earlier this session\" | Run the suite on the tree you are about to integrate. A green run only proves the tree it ran on. |\n| \"They obviously want it merged\" | Integration is the user's decision. Present the menu and wait. |\n| \"They seem done with this feature — I'll offer to discard it\" | The menu is complete as written. Discard happens only when the user asks for it in so many words. |\n| \"'Yeah, get rid of it' counts as confirmation\" | Only the typed word `discard` authorizes deletion. |\n| \"The PR is up, so the worktree is clutter now\" | PR feedback gets fixed in that worktree. It stays until the work lands. |\n| \"This other worktree looks stale — I'll clean it too\" | Clean up only worktrees under `.worktrees/` or `worktrees/`. Everything else belongs to the host. |\n| \"The merged-result failure is probably flaky\" | A failing merged result stops everything. Branch and worktree stay put while you investigate. |\n| \"The base branch is obviously main\" | Confirm the fork point or ask. Merging into the wrong base is expensive to undo. |\n| \"The push was rejected — force-push will fix it\" | A rejected push means the remote moved. Investigate; force-push only on the user's explicit request. |\n"
}

SHA-256 of public snapshot: e9243e10e80a77f2dcda456bed9ea180d73bf6b21d1d735222da5afe4915bc16