ad-merge
SkillProductivityad-merge is a skill that lets your AI evaluate and merge GitHub pull requests. It checks the request for problems before anything is merged, and only completes the merge when the automated checks pass. Anything else it finds is reported to you as a warning, so you stay in control of the decision.
Available today. Use it from your connected AI after setup.
No other account needed.
After adding it, ask your AI to evaluate and merge a specific pull request. It starts by checking your GitHub sign-in, so be ready to authenticate if prompted.
Then ask your AI: use the ad-merge skill
What your AI can do with it
- Verify you are signed in to GitHub and locate the pull request before starting
- Evaluate a pull request with a fresh review plus checks on CI, linked tasks, unresolved comments, and mergeability
- Refuse to merge when the automated checks fail
- Raise non-blocking issues as warnings that yield to your decision
- Confirm the pull request is actually in a mergeable state
- Complete the merge automatically, using the merge mode detected for the situation
What this skill tells your AI
The instructions your AI receives, as published by corridortech/posecap in .agents/skills/ad-merge/SKILL.md and read by ahel’s review.
<background_information>
Implements ADR-0025. Evaluates a PR's mergeability and performs the merge via gh pr merge. CI green is the only hard gate; everything else surfaces as a warning the senior engineer decides on.
Codex auto-trigger on description keywords is less mature than Claude Code's. If auto-invocation does not fire when the user mentions merging a PR or evaluating mergeability, invoke this skill manually. </background_information>
Route elsewhere when:
- No PR exists yet →
ad-prfirst. - Commits are not on the branch yet →
ad-commitfirst.
Phase 1 — preflight. Check gh is installed and authenticated:
gh --version
gh auth status
If absent or not authed, surface the install / gh auth login hint and stop (same soft-fail rule as ad-pr).
Resolve the target PR:
- If the user passed a PR number / URL, use it.
- Else
gh pr view --json number,headRefName,baseRefNameagainst the current branch. If that fails, surface: "No PR found for branch<name>. Open one withad-prfirst."
Phase 2 — evaluate. Run the structured check and report each line:
gh pr checks <num>
gh pr view <num> --json mergeable,mergeStateStatus,reviews,number,title,headRefName,baseRefName
gh api repos/:owner/:repo/pulls/<num>/comments
Findings format (pass / warn / fail):
CI status: <pass | pending | fail>
Fresh-context review: <pass | warn — none found>
Linked task / ADR: <pass | warn — none>
Unresolved comments: <pass | warn — N unresolved>
Mergeability: <pass | dirty | blocked | behind>
Fresh-context review check — scan for either a file under .agentic/reviews/* whose name references the PR's commit range or number, or a gh pr view --json reviews entry with state: APPROVED.
Linked task / ADR — scan commit message bodies under <base>..HEAD and the PR body for task-NNNN, ADR-NNNN, spec-NNNN, #<issue>, Closes, Fixes.
Unresolved comments — count entries from gh api that lack a resolved flag or carry an in-progress thread state.
Phase 3 — decision. Apply the bar:
- CI failing → hard stop. Refuse to merge until CI is green, unless the user explicitly overrides ("merge anyway"). On override, log a loud warning that this is a deliberate CI-failing merge and the responsibility is the user's. Per ADR-0025 §3, even the hard gate yields to explicit user authorization, but the override is surfaced visibly.
- CI pending → ask the user: wait for CI, or proceed anyway? Default = wait.
- CI green + warnings (no fresh-context review / no linked task / unresolved comments) → surface each warning, ask the user to confirm the merge, proceed on confirm.
- All green → proceed.
State the decision back to the user before Phase 4 so they can interject.
Phase 4 — merge. Detect repo's allowed merge modes:
gh repo view --json mergeCommitAllowed,squashMergeAllowed,rebaseMergeAllowed
Decision tree:
- Exactly one mode allowed → use it.
- Multiple modes allowed → ask the user: "Repo allows squash / rebase / merge-commit. Pick one." Wait for their choice.
- None allowed (rare) → surface the policy error and stop.
Run the merge:
gh pr merge <num> --squash --delete-branch
(replace --squash with --rebase or --merge per the chosen mode).
--delete-branch by default for feature branches (feat/*, fix/*, chore/*, docs/*, refactor/*). Skip --delete-branch if the source branch is a long-lived integration branch (e.g., cli, develop, release/*).
Capture and report the merge commit URL.
<output_contract> The output is a merged PR. The skill returns:
- The merge commit URL.
- A one-line summary (
<count> commits merged into <base> via <mode>). - The list of warnings the user proceeded past (if any), for the audit trail. </output_contract>
Next
- After merge: pull the latest base locally (
git checkout <base> && git pull). - If the merge surfaced a recurring drift:
ad-driftfor systemic gaps, or updateWORKFLOW.md§10 / §11. - If the merge closed a task: confirm the task file's Status is
doneand the Notes log captures the merge commit URL. - If the merge shipped a binding decision worth recording:
ad-adr(three-criteria rule).
Signals
- GitHub stars
- 206
- Forks
- 16
- Last commit
- Sep 2026
ahel recommends instead
Advanced
- Catalog kind
- skill
- Gateway key
ad-merge-corridortech- Source
- github.com/corridortech/posecap