/merge-flow:merge-flowfrom merge-flow
Guardrail loop for merging one pull request safely. Takes the PR its fire names (labelled `auto-merging`) and merges it only once every safety gate holds; on any unmet gate it comments the blocker and stops rather than merging (a release PR into `main` is left alone without comment). Replaces error-prone manual merges. Repo-agnostic; fired by the Worker through `loop-dispatch`; requires the `github-ops` and `agent-outcomes` skills. Trigger: a PR labelled `auto-merging`.
Ships in merge-flow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A guardrail loop that removes the manual PR merge — the step where mistakes happen
(merging red CI, merging before approval, merging into the wrong base, forgetting
to delete the branch). You label a PR auto-merging; this loop merges it only when
every gate holds, and never otherwise.
One fire is one PR: the one the fire names, and only that one. /goal makes "done"
unambiguous: the loop keeps working until that PR is either merged (branch deleted
where the environment can — see Step 3), flagged with the reason it couldn't be,
left alone without comment (a release PR into main), or found no longer open or
labelled auto-merging (Step 1).
No half-done merges.
For every GitHub action — getting the PR, reading reviews, checking CI, merging,
deleting the branch — use the github-ops skill, which owns the local-vs-web
mechanism (this skill names the operation; github-ops has the command/tool).
Scheduled-routine wiring is set up separately (see
Running as a routine).
| Thing | Value |
|---|---|
| Trigger label | auto-merging |
| Target repos | any repo you point it at (the Umbraco MCP repos, umbraco-mcp-ops, Umbraco-MCP-Base, …) |
| Merge strategy | per repo convention — detect via release-and-branching (gitflow usually squash-into-dev; main-only per that repo) |
Get that PR (github-ops → Get a PR) by the number in the fire. Don't list or look
at any other auto-merging PR. If it is no longer open or no longer carries
auto-merging, stop quietly, with no comment on the PR.
Check gate 4 (right base) first: a gitflow release PR into main stops quietly there, before any other gate comments, waits or pushes. Then all of these must hold for the PR — if any fails, do not merge (go to Step 4):
auto-merging label. The merge stays human-gated: a
maintainer must deliberately apply the auto-merging label after reviewing the PR,
and that label is the human approval signal this loop requires — control who can
apply it. (A GitHub review
"approve" is not used as the signal, because a maintainer cannot approve a PR they
authored — and these PRs are commonly authored by the maintainer or the loop.) The
label being present (Step 1) satisfies this gate. As an added safeguard, check
reviews (github-ops → Get a PR): an unresolved "changes requested" is a human
veto — do not merge despite the label.main on a gitflow repo is a release merge —
the Worker makes it after release_approved, not this loop; don't merge it, and stop without commenting a blocker.Merge the PR (github-ops → Merge a PR) using the repo's convention (see Config).
Never force a merge past a failing gate. Post one short summary comment on the PR: what
was merged, the merge commit, and which gates were checked. No agent-outcome marker: the agent-outcomes skill's
catalog has no merge outcome, because the Worker sees the merge as a native GitHub event.
If the merge
itself fails, report it — never retry with a force.
Then delete the head branch, best-effort.
In a cloud routine it cannot be done — the GitHub MCP server has no branch-delete
tool (see the github-mcp.md Notes), so don't treat a surviving branch as a failed
merge, and don't go hunting for a tool that does it. Two things clean up after you: the
repo's "Automatically delete head branches" setting reaps it at merge time (on for all
three MCP repos), and failing that the weekly local branch-housekeeping run reaps it and
flags any repo where the setting is off.
Comment the specific blocker on the PR ("CI check x failing", "awaiting
approval", "conflicts with base — rebase needed"). For a hard,
human-needed block the orchestrator's gate missed (say a conflict appeared with no CI run
since), first report merge_blocked through the agent-outcomes script and put the body it printed in that comment, with the reason. Then stop.
The orchestrator checks for conflicts and requested changes itself, and sends failing CI to
rework-loop, so on red CI comment the failing checks and stop.
The Worker fires this through loop-dispatch (route merge-flow) when the PR is labelled
auto-merging and its gate passes, on an environment that has this skill (+ github-ops,
agent-outcomes).
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub hifi-phil/umbraco-mcp-ops --plugin merge-flow