post-merge

A cleanup procedure for the local Git branch immediately after a pull request is merged. Git is the version-control system used to track code changes, and a pull request is a proposed change reviewed before it enters the main branch.

In plain words
What is it for?
Use it after a successful pull-request merge, including an automatic merge, to check the branch, fetch updates, and finish local branch cleanup.
Why use it?
It prevents work from continuing on an old feature branch after its changes are already merged. It also resynchronizes the local main branch with the remote repository.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/swingerman/engineer/post-merge
Any agent
npx skills add swingerman/engineer --skill post-merge
Clone the repo
git clone --depth 1 https://github.com/swingerman/engineer

Made for: Claude Code, Codex.

Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,323 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00068 $0.01323
Opus 5 $0.00034 $0.00661
Sonnet 5 $0.00014 $0.00265
Haiku 4.5 $0.00007 $0.00132

Measured 2d ago against content hash f69abc97593b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

post-merge scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

engineer/skills/post-merge/SKILL.md · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

post-merge

The branch-hygiene skill that runs immediately after a PR merges — not deferred to the next session. next and session-summary already catch a stale branch at session boundaries (v1.7.1); post-merge closes the gap in between, where users were still asking "are we still on the feature branch?" mid-session.

When to use

  • Auto — invoke right after observing a successful gh pr merge, gh pr merge --auto, or a "Merged" PR state in gh pr view --json state. The agent that ran the merge calls this skill before doing anything else.
  • Manual/engineer.post-merge or the trigger phrases above.

Not for: cleanup when the PR isn't merged yet (the work isn't done); session-end teardown (session-summary handles that); session-start survey (next already probes for stale branches as a backstop).

Workflow

  1. Resolve + identify merged branch. Resolve the methodology root via ${CLAUDE_PLUGIN_ROOT}/scripts/dae_resolve.py. Get the current branch (git branch --show-current). If it's main/master/the repo's default branch, there's nothing to clean — stop and report.

  2. Probe merge state. Run git fetch origin --quiet, then check whether the current branch has been merged:

    • GitHub-side check (preferred when gh is available): gh pr view --json state,mergedAt,headRefName --jq '.state' for the PR linked to this branch. State of MERGED is the strongest signal.
    • Git-side check (fallback): git merge-base --is-ancestor HEAD origin/HEAD (or origin/main). True means every commit on this branch is reachable from main.

    If neither check confirms a merge, stop — the work isn't shipped yet. Report what was checked.

  3. Run the cleanup. Run the three commands in order, stopping on any non-zero exit:

    git checkout <default-branch>
    git pull --ff-only
    git branch -d <merged-branch>
    

    git branch -d (not -D) refuses unmerged work — non-destructive by construction. If it refuses, surface what's unmerged and stop; don't escalate to -D without explicit user confirmation.

Read the full file on GitHub · 66 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 66 lines · 68 tokens per session scan A f69abc97593b

Subscribe to this mod's changes

post-merge is a skill published in the GitHub repository swingerman/engineer (146 stars, last pushed 6d ago), licensed MIT. It adds 68 tokens to every session and 1,323 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

writing-tests

Write unit tests, component tests, and integration tests for AiderDesk using Vitest and React Testing Library. Use when creating new tests, adding test coverage, configuring mocks, setting up test files, or debugging failing tests.

hotovo/aider-desk · 48 tokens

release

Cut a sim-use release end-to-end. Use when the user runs /release or asks to "ship a release", "publish a version", "cut a release", or "release to homebrew". Drives scripts/local-release.sh; never reimplement its build/sign/tarball logic.

lycorp-jp/sim-use · 61 tokens

work-summary

Generates a project dashboard from MCP work items. Default is a lean, attention-first view: what's in flight, what's blocked, what to do next, what's queued. Use when the user says: project status, what's active, show me the dashboard, work summary, what should I work on, project health, what's blocked, where did I…

jpicklyk/task-orchestrator · 110 tokens

manage-schemas

Creates, views, edits, deletes, and validates note schemas for the MCP Task Orchestrator in .taskorchestrator/config.yaml — the templates that define which notes agents must fill at each workflow phase. Also recommends schema designs from a library of workflow patterns (autonomous coding loops, spec-driven teams…

jpicklyk/task-orchestrator · 212 tokens

bmad-dev-story

Execute story implementation following a context filled story spec file. Use when the user says "dev this story [story file]" or "implement the next story in the sprint plan".

LarsCowe/bmalph · 40 tokens

bmad-editorial-review-structure

Structural editor that proposes cuts, reorganization, and simplification while preserving comprehension. Use when user requests structural review or editorial review of structure.

LarsCowe/bmalph · 35 tokens