merge-authorization-gate
Skill8 starsChanged 6 months agoMITView on GitHub
Hard stop before gh pr merge, glab mr merge, or any forge REST merge endpoint. These call the forge API directly -- git hooks and pre-push gates never fire. Requires an explicit human merge utterance in the current conversation, distinct from PR/MR web-UI approval and distinct from push approval.
- Commits and pushes
In this repository129 other files it gives its agents.
- AGENTS.mdAGENTS.md
- guidance/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- guidance/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- blast-radius-checkSkill
- brainstormingSkill
- branch-flow-gateSkill
- branch-sync-gateSkill
- codebase-reconSkill
- codeowners-drift-auditSkill
- code-review-batterySkill
- cognitive-complexity-refactoringSkill
- debateSkill
- debug-conductorSkill
- dispatching-parallel-agentsSkill
- domain-buildSkill
- evidence-adjudicatorSkill
- executing-plansSkill
- external-cli-auditSkill
- feature-developmentSkill
- field-rename-verificationSkill
- finishing-a-development-branchSkill
- git-branch-conventionsSkill
- gitlab-cliSkill
- hotfix-charterSkill
- implementation-trackerSkill
- incident-revert-reviewSkill
- infra-config-investigatorSkill
- investigation-stateSkill
- kernel-splitSkill
- llm-behavior-investigatorSkill
- llm-skill-reviewSkill
- micro-harsh-reviewSkill
- output-verificationSkill
- pre-commit-gateSkill
- progressive-code-review-gateSkill
- progressive-harsh-reviewSkill
- providing-code-reviewSkill
- pr-triage-gateSkill
- push-authorization-gateSkill
- receiving-code-reviewSkill
- reproduction-experiment-investigatorSkill
- requesting-code-reviewSkill
- requirements-validation-pmSkill
- requirements-validationSkill
- scope-tripwireSkill
- session-handoffSkill
- skills-hierarchy-tuningSkill
- sp-bughuntSkill
- state-consistency-investigatorSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- timeline-trace-investigatorSkill
- token-estimationSkill
- unified-commit-gateSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 55
Ask: Has the human in THIS conversation explicitly said to merge?
- Distinctive: line 102
Do NOT infer approval from context ("the orchestrator asked me to finish the branch", "the PR was open", "CI passed").
- Distinctive: line 103
Do NOT call the merge command without explicit authorization.
- Very specific: line 106
If you are an orchestrator: do NOT delegate merge execution to a sub-agent unless the sub-agent's task prompt contains the human approval …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Merge Authorization Gate
Wrong skill? For
git merge(local, no API -- hooks fire normally) duringfinishing-a-development-branchOption 1, this gate does NOT apply. Forgit push-- usepush-authorization-gate. This gate coversgh pr merge,glab mr merge, and rawgh api/glab apicalls to a merge endpoint.
Announce at start: "I'm using the merge-authorization-gate skill to verify explicit human approval before running an API-level merge."
Why This Exists
gh pr merge and glab mr merge (and gh api .../merges, glab api .../merge) call the forge REST API directly. Git hooks never fire. pre-tool-use-red-autonomy.sh gates git push but not API merges. So an API-level merge is the one integration action with no mechanical gate at all -- this skill is the gate.
An API merge lands code on a protected branch, can trigger a deploy pipeline, and on a squash/rebase merge rewrites history. Treat it as at least as sensitive as a push.
Gate Check (run this before ANY API-level merge command)
Sub-agent context: If you are executing from a task prompt with no live human conversation, skip to Sub-agent Rules below.
Ask: Has the human in THIS conversation explicitly said to merge?
Valid approval phrases (word-bounded, case-insensitive): "merge it", "go ahead and merge", "approve the merge", "run the merge", "you may merge".
Self-trigger note: The phrase that triggered this skill does NOT count as approval -- it is the trigger, not the authorization. The human must confirm after the gate states its requirements. If the human's reply directly to this gate's stop message is "merge it", treat that second utterance as approval; the gate does not re-fire on a direct response to its own requirements statement.
| Situation | Action |
| Human said an approval phrase in this conversation | State the approval, run the merge, confirm the PR/MR status changed to merged |
| No explicit approval found | State the gate fired, present the PR/MR URL, STOP -- do not run the merge |
gh api / glab api call targets a non-merge endpoint (e.g. gh api user, glab api projects/:id) | Gate does not apply -- proceed |
A revoke phrase ("do not merge", "cancel the merge", "hold the merge") in a later message overrides an earlier approval.
What Does NOT Count as Merge Authorization
| This is NOT approval | Why |
| Approval granted in a prior session | Does not transfer -- requires fresh approval per conversation |
| Human approved the PR/MR in the forge web UI | Code-review authorization -- separate from merge-execution authorization |
| "push approved" / "push it" | Push and merge are independent authorizations |
Human chose "merge locally" in finishing-a-development-branch Option 1 | That approves git merge (local, hooks fire) -- NOT an API merge |
| CI green / required checks passed | Quality signal, not authorization |
| "looks good" / "lgtm" on the diff | Review feedback, not a merge instruction |
Permitted Merge Flow
1. git push origin <branch> (push-authorization-gate applies)
2. gh pr create --fill / glab mr create --fill
3. Present the PR/MR URL -- STOP AND WAIT for the human
4. Human approves the PR/MR in the forge web UI (code-review authorization)
5. Human says "merge it" in this conversation (merge-execution authorization)
6. gh pr merge <n> / glab mr merge <iid> -- only after step 5Steps 4 and 5 are independent. Neither substitutes for the other.
dev -> main promotions need explicit human instruction plus a batch review (see AGENTS.md). This gate does not lower those bars.
Sub-agent Rules
Sub-agents are the highest-risk context for this gate -- a sub-agent has no human conversation history and cannot verify approval by scanning the chat.
If you are a sub-agent:
- Your task prompt MUST contain explicit text authorizing the merge, attributed to the human -- canonical form
Human said: merge it. A bare task verb ("finish the branch and merge it") is NOT sufficient; the approval must be attributed to the human. - Do NOT infer approval from context ("the orchestrator asked me to finish the branch", "the PR was open", "CI passed"). None of those are authorization.
- Do NOT call the merge command without explicit authorization. Attempting the call is itself the violation, even if it errors.
- Surface the block with: "Merge gate: no explicit human approval found in the task prompt. Stopping. The human must authorize in their conversation before this can proceed."
If you are an orchestrator: do NOT delegate merge execution to a sub-agent unless the sub-agent's task prompt contains the human approval utterance verbatim in the canonical form (Human said: <utterance>). Approval granted to you does not transfer automatically.
Failure Modes
| Failure | Fix |
| Trigger phrase ("merge it") counted as approval for itself | Approval must be a distinct human utterance after the gate states its requirements; re-read the Self-trigger note |
| Sub-agent infers approval from CI passing or the PR being open | Neither is authorization -- see Sub-agent Rules; surface the block to the orchestrator |
Agent uses gh api -X PUT .../merge or glab api ... /merge directly; gate never fires | Any gh api / glab api call targeting a merge endpoint is in scope -- treat it as gh pr merge for gate purposes |
| Confusing the forge "Approved" badge with agent merge permission | UI approval is code-review auth; agent merge needs a separate human utterance in this conversation |
Treating finishing-a-development-branch Option 1 (merge locally) as API-merge approval | Option 1 uses git merge locally -- hooks fire; it does not authorize an API merge |
| Prior-session approval carried forward | Approval is conversation-scoped; a new session resets the gate |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

