agentleFS
mihai-dinculescumihai-dinculescu/tapo/.claude/skills/merge-pr/SKILL.md

merge-pr

Skill877 starsChanged 6 days agoMITView on GitHub

Merge a GitHub PR by fast-forwarding main to its head, so every commit lands unchanged with its signature and no merge commit is created

  • Commits and pushes

18 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use implement-issue, create-pr and 1 more.

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.
  • GoogleSkill

    implement-issue

    Implement a Site Kit GitHub issue end-to-end from its implementation brief. Use when the user asks to implement, build, or work on a GitHub issue / feature by number (e.g. "implement issue #12345", "build the feature in issue 12345", "follow the implementation brief for #12345") in the google/site-kit-wp repo.

    Also in 3 projects that use this

  • 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 7 projects that use this

  • sahinSkill

    create-issue

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 3

    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:

    Run every check before touching anything.

    line 14
  2. Very specific:

    If it is not a descendant of origin/main, stop.

    line 33
  3. Very specific:

    Every commit must show true.

    line 42
  4. Very specific:

    Every entry in statusCheckRollup must have concluded SUCCESS, NEUTRAL or SKIPPED, and the required checks Rust / Checks and Rust / Checks …

    line 46
  5. Very specific:

    If reviewDecision is not APPROVED, ask the user to confirm, then run gh pr review <N> --approve.

    line 50
  6. Distinctive:

    Wait for explicit confirmation.

    line 58
  7. Very specific:

    Never use --force. If the push is rejected because main moved, stop and report it.

    line 66
  8. Distinctive:

    If the current branch is main and the working tree is clean, run git pull --ff-only.

    line 78

“Common” is measured: kept by at least 6 in 10 of the 18 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

Merge PR <N> by pushing its head commit to main as a fast-forward. GitHub's "Rebase and merge" rewrites commits without signing them, "Squash" collapses them, and "Merge commit" adds a merge commit, so none of the merge buttons fit.

Usage: /merge-pr <N>. If no number is given, ask for it.

Steps

Run every check before touching anything. On any failed check, stop and report it; do not work around it.

  1. Read the PR

    gh pr view <N> --json number,title,state,isDraft,baseRefName,headRefName,headRefOid,isCrossRepository,headRepositoryOwner,reviewDecision,statusCheckRollup,commits
    • state must be OPEN and isDraft false.
    • baseRefName must be main.
  2. Fetch the head and check it fast-forwards main

    git fetch origin main pull/<N>/head
    git rev-parse FETCH_HEAD   # must equal headRefOid
    git merge-base --is-ancestor origin/main <headRefOid>

    If it is not a descendant of origin/main, stop. Rebasing would replace the author's signatures, so ask the user whether to have the author rebase or to rebase and re-sign the commits themselves. Never rebase on your own.

  3. Verify every commit is signed

    gh api repos/mihai-dinculescu/tapo/pulls/<N>/commits --paginate \
      --jq '.[] | "\(.sha[0:7]) \(.commit.verification.verified) \(.commit.verification.reason) \(.commit.message | split("\n")[0])"'

    Every commit must show true. GitHub's verification is the source of truth; a local git log --show-signature fails for keys not in the local keyring.

  4. Require green CI

    Every entry in statusCheckRollup must have concluded SUCCESS, NEUTRAL or SKIPPED, and the required checks Rust / Checks and Rust / Checks on minimum supported version must be among them. If checks are still running, say so and stop; don't poll.

  5. Approve

    If reviewDecision is not APPROVED, ask the user to confirm, then run gh pr review <N> --approve. Approving is outward-facing, so never do it without the user's go-ahead.

  6. Confirm the push

    Show the user:

    • the commit list from step 3 (short SHA, subject, verified)
    • the exact command: git push origin <headRefOid>:refs/heads/main

    Wait for explicit confirmation. Pushing to main cannot be undone.

  7. Push

    git push origin <headRefOid>:refs/heads/main

    Never use --force. If the push is rejected because main moved, stop and report it; don't retry.

  8. Confirm the merge

    gh pr view <N> --json state,mergedAt,mergeCommit

    state should be MERGED and mergeCommit.oid should equal headRefOid. GitHub can take a few seconds to notice; check once more if it still shows OPEN, then report.

  9. Sync the local checkout

    If the current branch is main and the working tree is clean, run git pull --ff-only. Otherwise just tell the user main moved.

  10. Head branch

    For a same-repo PR (isCrossRepository false), ask whether to delete the head branch (git push origin --delete <headRefName>). Never delete it without asking. For a fork PR, leave it alone.

Notes

  • Branch protection on main requires an approving review and passing checks, but enforce_admins is off, so an admin's direct push is accepted. Steps 4 and 5 enforce those requirements, since the push itself would skip them.
  • Issues referenced by the PR stay open until release; don't close them here.

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.