post-merge

Cleans up merged feature branches and resyncs the local main branch after a PR merge.

150|10|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/swingerman/engineer --skill post-merge-swingerman
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: post-merge
Source: https://github.com/swingerman/engineer/tree/main/engineer/skills/post-merge
Command: npx skills add https://github.com/swingerman/engineer --skill post-merge-swingerman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After a pull request merges, developers often stay on a stale feature branch mid-session, leaving local state out of sync with main and the project tracker showing work as still in progress. This Skill closes that gap immediately after a merge instead of deferring cleanup to the next session. ## Core Features & Use Cases - Merge-state verification: Confirms the PR is actually merged using the GitHub CLI (gh pr view) with a git ancestry check (git merge-base --is-ancestor) as fallback before touching anything. - Non-destructive branch cleanup: Checks out the default branch, fast-forward pulls, deletes the merged branch with git branch -d (refusing unmerged work), and prunes stale remote refs. - Tracker reconciliation: Runs dae_reconcile.py to flip the feature status to done, flags merges lacking verification handoffs, and dispatches progress-log and session-summary follow-ups based on autonomy level. - Use Case: Right after gh pr merge succeeds in a session, invoke the Skill to switch back to main, delete the merged branch, update the feature tracker, and close the session log in one pass. ## Quick Start Ask the agent to run post-merge cleanup now that the pull request for the current feature branch has been merged.

Frequently Asked Questions about post-merge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up local branches after a PR is merged?▼

After confirming the merge, check out the default branch, run git pull --ff-only, delete the merged branch with git branch -d, and prune stale remote refs with git fetch origin --prune. This Skill automates that exact sequence.

How to verify a pull request was actually merged before deleting the branch?▼

Use gh pr view --json state to check for a MERGED state on the GitHub side, or fall back to git merge-base --is-ancestor HEAD origin/main to confirm every branch commit is reachable from main. The Skill stops if neither check confirms a merge.

Does git branch -d work after a squash merge?▼

No, git branch -d refuses after a squash merge because the branch commits are not ancestors of main. The Skill surfaces the unmerged work and stops rather than escalating to -D without explicit user confirmation.

When should I not run post-merge branch cleanup?▼

Skip it when the PR is still open or in review, when the merge happened on a different branch than the one checked out, or when the work has not shipped yet. Session-start and session-end stale-branch checks are handled by other skills.

Why does the feature tracker still show in-progress after merging?▼

The local feature.md status must be flipped to done before the tracker is updated, since progress-log derives its record from local truth. The Skill runs dae_reconcile.py --apply first, then dispatches progress-log to propagate the done state.