Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Merge Pr Multiple

ASecurity

Merge a set of PRs one at a time — detect stack vs independent set, rebase and resolve conflicts between merges, watch CI, merge each via gh

3 stars
0 votes
0 copies
2 views
Added 9/19/2026
ai-agentsgobashgit

Works with

claude code

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 9/19/2026

$npx -y skills add tony/skills --skill merge-pr-multiple --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Merge Pr Multiple?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Merge Pr Multiple
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tony-merge-pr-multiple/badge)](https://www.skillsdirectory.com/skills/tony-merge-pr-multiple)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: merge-pr-multiple
description: >-
  Merge a set of PRs one at a time — detect stack vs independent set, rebase
  and resolve conflicts between merges, watch CI, merge each via gh
disable-model-invocation: true
allowed-tools: ["Bash", "Read", "Grep", "Edit", "AskUserQuestion"]
metadata:
  argument-hint: "[PR numbers/URLs, e.g. '#31 #32'] [--squash | --rebase | any other gh pr merge flag]"
  source: "plugins/merge-pr/skills/multiple/SKILL.md"
---

# Merge Multiple PRs

Land a set of pull requests one at a time: merge one, refresh trunk,
bring the next PR up to date (rebase, resolve conflicts, force-push,
wait on CI), then merge it — repeating until the set is landed or a
gate halts the run.

Read `references/merge-readiness.md` first; it
defines the readiness gate, the rebase procedure, the merge-message
derivation, flag passthrough, the `--admin` policy, and the rule that
merging is not releasing.

User arguments: $ARGUMENTS

## Context

Trunk — run this command and read the output:

```bash
git rev-parse --verify origin/main >/dev/null 2>&1 && echo main || echo master
```

Open PRs — run this command and read the output:

```bash
gh pr list --json number,title,headRefName,baseRefName,isDraft 2>/dev/null || echo "(gh unavailable)"
```

## Procedure

### 1. Assemble the roster

Take the PR set from the arguments, or from the PRs this
conversation has been working on. If the set is ambiguous — the
conversation touched more PRs than the user likely means, or an
argument doesn't match an open PR — present the candidates via
`ask-user-choice` and let the user pick. Show the final roster
before merging anything.

### 2. Detect the topology

Fetch `baseRefName` and `headRefName` for each PR. If any PR's base
branch is another PR's head branch, the set is a **stack**: order
bottom-up, each PR merging only after its parent. Otherwise the set
is **independent**: honor the order the user gave, falling back to
ascending PR number.

For a stack, plan the retarget: merging a parent with
`--delete-branch` lets GitHub retarget the child to trunk
automatically; when the branch is kept, retarget explicitly with
`gh pr edit <child> --base <trunk>` before rebasing the child.

### 3. Land each PR

For each PR in order:

1. **Readiness gate** — apply the gate from the reference. Failing
   CI, draft state, or `CHANGES_REQUESTED` halts the run with a
   report of what landed and what remains.
2. **Bring up to date** — when the PR is `BEHIND` or `DIRTY`, or an
   earlier merge in this run moved trunk:
   follow the reference's rebase procedure (for a stacked child,
   `git rebase --onto` the new trunk so the parent's merged commits
   drop out), resolve conflicts — asking on any conflict that forces
   a choice between behaviors — verify content did not drift, then
   `git push --force-with-lease`.
3. **Wait on CI** — `gh pr checks <n> --watch` on the rebased head.
4. **Merge** — compose the merge commit message per the reference
   (match `git log --merges`, stay provincial, no release claims)
   and merge via `gh pr merge <n> --merge -t ... -b ...`, passing
   the user's flags through verbatim. `--admin` only within the
   reference's policy, asked-for if the user didn't supply it.
5. **Sync** — checkout trunk, pull, confirm the PR reports merged.

### 4. Halt conditions

Stop and report — never push past — when a rebase produces an
unexpected content diff, CI fails on a rebased head, a PR turned
closed or draft mid-run, or a conflict needs a product decision.
Everything already merged stays merged; the report says exactly
where the run stopped and why.

## Rules

- One PR at a time; never merge two PRs between trunk syncs.
- Merges go through `gh pr merge`, never a local `git merge` pushed
  to trunk.
- Never merge over failing or pending CI, with or without `--admin`.
- Force-pushes use `--force-with-lease` and only ever target PR
  branches.
- When in doubt at any step, ask — do no harm.

## Output

Open with a one-line hero (`✓ Merged N of M PRs` or
`⚠ Halted at #N: <reason>`), then exactly these sections:

1. `## Roster` — the PRs, detected topology (stack or independent),
   and merge order.
2. `## Merges` — per PR: gate result, rebase/conflicts if any, CI
   outcome, merge commit subject.
3. `## Trunk` — the post-run trunk state.

End with an `ask-user-choice` panel offering next steps (for
example: continue with a halted PR after a fix, merge another set,
stop here) — skip the panel only in plan mode.


## Portability notes

- `ask-user-choice` — present the listed options and wait for the user to pick one. Hosts with a structured multiple-choice tool (Claude Code's `AskUserQuestion`) should use it; otherwise print a numbered list and wait for a numbered reply. Never proceed on an assumed answer.
- `$ARGUMENTS` — the text the user passed when invoking this skill. If your host does not substitute it, read it as the user's request in the current turn, and ask when there is none.
- Bundled files — every relative path in this skill points at a file shipped inside this skill directory. Read them from here, not from the host's plugin tree.

Attribution

tonytony
View sourceSee grades on GitHubMore from tony →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698431 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →