agentleFS
anderson-c-santosanderson-c-santos/claude-skills-network/skills/merge-pr/SKILL.md

merge-pr

Skill1 starsChanged 5 months agoMITView on GitHub

Merge a GitHub PR after all checks pass. Trigger for: /merge-pr, merge PR, approve and merge, squash merge, ship PR. Verifies CI, draft state, and approvals, then merges with the correct strategy based on branch type.

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use create-pr.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    create-pr

    Create pull requests following Sentry conventions. Use when opening PRs, writing PR descriptions, or preparing changes for review. Follows Sentry's code review guidelines.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default chosen by branch prefix.

    line 19
  2. Distinctive:

    If no PR found → STOP: "No open PR for this branch."

    line 38
  3. Very specific:

    If --squash flag → squash

    line 85
  4. Very specific:

    If --merge flag → merge commit

    line 86
  5. Very specific:

    If --rebase flag → rebase

    line 87
  6. Very specific:

    If this was the last feature for a release → suggest /create-release

    line 115
  7. Very specific:

    If hotfix/* → remind to also merge into develop if it exists

    line 116

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Merge PR

Safely merge a GitHub PR after verifying all gates. After this, use /create-release to ship a version.

Invocation Forms

  • /merge-pr — merge current branch's open PR
  • /merge-pr <PR#> — merge a specific PR
  • /merge-pr <PR#> --squash — force squash (overrides strategy table)
  • /merge-pr <PR#> --merge — force merge commit (overrides strategy table)
  • /merge-pr <PR#> --rebase — force rebase merge

Merge Strategy

Default chosen by branch prefix. Flags override the table.

Branch typeDefault
feat/*squash
fix/*squash
chore/*squash
refactor/*squash
docs/*squash
hotfix/*merge commit — preserve history for incident RCA
release/*merge commit — keep release boundary visible

Workflow

1. Resolve PR number

# If no PR# given, find open PR for current branch
gh pr list --head $(git branch --show-current) --json number --jq '.[0].number'

If no PR found → STOP: "No open PR for this branch."

2. Fetch full PR state

gh pr view <PR#> --json \
  state,isDraft,mergeable,mergeStateStatus,\
  statusCheckRollup,reviews,headRefName,baseRefName,title

3. Run gates in order — stop on first failure

Gate 1 — Not merged/closed:

# state must be "OPEN"
# if MERGED → "Already merged."
# if CLOSED → "PR is closed — reopen it first."

Gate 2 — Not a draft:

gh pr view <PR#> --json isDraft --jq '.isDraft'
# if true → STOP: "PR is still a draft — mark it ready first."

Gate 3 — CI passing:

gh pr view <PR#> --json statusCheckRollup \
  --jq '.statusCheckRollup // [] | .[] | select(.conclusion != "SUCCESS") | "\(.name): \(.conclusion)"'
# if any output → STOP: list failing checks by name
# if statusCheckRollup is empty → no CI configured, proceed (warn once)

Gate 4 — At least one approval:

gh pr view <PR#> --json reviews \
  --jq '[.reviews[] | select(.state=="APPROVED")] | length'
# if 0 → STOP: "No approvals yet."

Gate 5 — No merge conflicts:

gh pr view <PR#> --json mergeable --jq '.mergeable'
# if "CONFLICTING" → STOP: "PR has merge conflicts — resolve and push."
# if "UNKNOWN" → wait a few seconds and retry once

4. Determine strategy

  1. If --squash flag → squash
  2. If --merge flag → merge commit
  3. If --rebase flag → rebase
  4. Else → look up branch prefix in strategy table

5. Merge

# Squash
gh pr merge <PR#> --squash --delete-branch

# Merge commit
gh pr merge <PR#> --merge --delete-branch

# Rebase
gh pr merge <PR#> --rebase --delete-branch

6. Verify

gh pr view <PR#> --json state --jq '.state'
# must return "MERGED"

7. Output

PR #<N> "<title>" merged into <base> via squash — branch deleted.

One line only.

Post-merge hints

  • If this was the last feature for a release → suggest /create-release
  • If hotfix/* → remind to also merge into develop if it exists

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.