merge-pr
Skill100 starsChanged 9 months agoMITView on GitHub
Merge a GitHub PR via squash after /preparepr. Use when asked to merge a ready PR. Do not push to main or modify code. Ensure the PR ends in MERGED state and clean up worktrees after success.
- Commits and pushes
We split this skill into the rules it gives an agent
24 rules. 0 are common, 14 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
14
Distinctive
This author's own choices. Worth a look.
10
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 14
Ask for PR number or URL.
- Distinctive: line 15
If missing, auto-detect from conversation.
- Very specific: line 20
Use gh pr merge --squash as the only path to main.
- Distinctive: line 21
Do not run git push at all during merge.
- Distinctive: line 22
Do not run gateway stop commands.
- Distinctive: line 27
If delegating, require the delegate to run commands and capture outputs.
- Very specific: line 31
If you see "fatal: not a git repository", you are in the wrong directory.
- Very specific: line 32
Read .local/review.md and .local/prep.md in the worktree.
- Very specific: line 39
Ensure PR state is MERGED, never CLOSED.
- Distinctive: line 41
Run cleanup only after merge success.
- Distinctive: line 45
Create a checklist of all merge steps, print it, then continue and execute the commands.
- Distinctive: line 49
Use an isolated worktree for all merge work.
- Distinctive: line 59
Run all commands inside the worktree directory.
- Distinctive: line 101
Stop if any are true:
- Very specific: line 117
If anything is failing or behind, stop and say to run /preparepr.
- Very specific: line 121
If checks are still running, use --auto to queue the merge.
- Very specific: line 135
If merge fails, report the error and stop.
- Very specific: line 136
If the PR needs changes beyond what /preparepr already did, stop and say to run /preparepr again.
- Distinctive: line 147
Use a literal multiline string or heredoc for newlines.
- Distinctive: line 159
Verify PR state is MERGED
- Very specific: line 167
Run cleanup only if step 6 returned MERGED.
- Distinctive: line 181
Do not close PRs.
- Very specific: line 184
Never push to main. Use gh pr merge --squash only.
- Distinctive: line 185
Do not run git push at all in this command.
“Common” is measured: kept by at least 6 in 10 of the 14 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.
Files
Merge PR
Overview
Merge a prepared PR via gh pr merge --squash and clean up the worktree after success.
Inputs
- Ask for PR number or URL.
- If missing, auto-detect from conversation.
- If ambiguous, ask.
Safety
- Use
gh pr merge --squashas the only path tomain. - Do not run
git pushat all during merge. - Do not run gateway stop commands. Do not kill processes. Do not touch port 18792.
Execution Rule
- Execute the workflow. Do not stop after printing the TODO checklist.
- If delegating, require the delegate to run commands and capture outputs.
Known Footguns
- If you see "fatal: not a git repository", you are in the wrong directory. Use
~/Development/openclaw, not~/openclaw. - Read
.local/review.mdand.local/prep.mdin the worktree. Do not skip. - Clean up the real worktree directory
.worktrees/pr-<PR>only after a successful merge. - Expect cleanup to remove
.local/artifacts.
Completion Criteria
- Ensure
gh pr mergesucceeds. - Ensure PR state is
MERGED, neverCLOSED. - Record the merge SHA.
- Run cleanup only after merge success.
First: Create a TODO Checklist
Create a checklist of all merge steps, print it, then continue and execute the commands.
Setup: Use a Worktree
Use an isolated worktree for all merge work.
cd ~/Development/openclaw
# Sanity: confirm you are in the repo
git rev-parse --show-toplevel
WORKTREE_DIR=".worktrees/pr-<PR>"Run all commands inside the worktree directory.
Load Local Artifacts (Mandatory)
Expect these files from earlier steps:
.local/review.mdfrom/reviewpr.local/prep.mdfrom/preparepr
ls -la .local || true
if [ -f .local/review.md ]; then
echo "Found .local/review.md"
sed -n '1,120p' .local/review.md
else
echo "Missing .local/review.md. Stop and run /reviewpr, then /preparepr."
exit 1
fi
if [ -f .local/prep.md ]; then
echo "Found .local/prep.md"
sed -n '1,120p' .local/prep.md
else
echo "Missing .local/prep.md. Stop and run /preparepr first."
exit 1
fiSteps
- Identify PR meta
gh pr view <PR> --json number,title,state,isDraft,author,headRefName,baseRefName,headRepository,body --jq '{number,title,state,isDraft,author:.author.login,head:.headRefName,base:.baseRefName,headRepo:.headRepository.nameWithOwner,body}'
contrib=$(gh pr view <PR> --json author --jq .author.login)
head=$(gh pr view <PR> --json headRefName --jq .headRefName)
head_repo_url=$(gh pr view <PR> --json headRepository --jq .headRepository.url)- Run sanity checks
Stop if any are true:
- PR is a draft.
- Required checks are failing.
- Branch is behind main.
# Checks
gh pr checks <PR>
# Check behind main
git fetch origin main
git fetch origin pull/<PR>/head:pr-<PR>
git merge-base --is-ancestor origin/main pr-<PR> || echo "PR branch is behind main, run /preparepr"If anything is failing or behind, stop and say to run /preparepr.
- Merge PR and delete branch
If checks are still running, use --auto to queue the merge.
# Check status first
check_status=$(gh pr checks <PR> 2>&1)
if echo "$check_status" | grep -q "pending\|queued"; then
echo "Checks still running, using --auto to queue merge"
gh pr merge <PR> --squash --delete-branch --auto
echo "Merge queued. Monitor with: gh pr checks <PR> --watch"
else
gh pr merge <PR> --squash --delete-branch
fiIf merge fails, report the error and stop. Do not retry in a loop.
If the PR needs changes beyond what /preparepr already did, stop and say to run /preparepr again.
- Get merge SHA
merge_sha=$(gh pr view <PR> --json mergeCommit --jq '.mergeCommit.oid')
echo "merge_sha=$merge_sha"- Optional comment
Use a literal multiline string or heredoc for newlines.
gh pr comment <PR> -F - <<'EOF'
Merged via squash.
- Merge commit: $merge_sha
Thanks @$contrib!
EOF- Verify PR state is MERGED
gh pr view <PR> --json state --jq .state- Clean up worktree only on success
Run cleanup only if step 6 returned MERGED.
cd ~/Development/openclaw
git worktree remove ".worktrees/pr-<PR>" --force
git branch -D temp/pr-<PR> 2>/dev/null || true
git branch -D pr-<PR> 2>/dev/null || trueGuardrails
- Worktree only.
- Do not close PRs.
- End in MERGED state.
- Clean up only after merge success.
- Never push to main. Use
gh pr merge --squashonly. - Do not run
git pushat all in this command.
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- neul-labs/openclawMU★ 3325% same
Wrote their own version · 14
- cube-js/cube★ 21ksame name
- bazel-contrib/rules_python★ 687same name
- kkokosa/dotLLM★ 522same name
- r3bl-org/r3bl-open-core★ 486same name
- tbhb/vale-ai-tells★ 118same name
- kdy1/kdy1-scripts★ 27same name
- developerz-ai/open-mmorpg★ 11same name
- phmatray/ai-migration-kit★ 4same name
- phmatray/tagout★ 4same name
- chenson42/stackkeel★ 1same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects 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.
GoogleSkillimplement-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
SentrySkillcreate-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
sahinSkillcreate-issue
Also in 3 projects that use this
In this repository86 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- prepare-prSkill
- review-prSkill
- 1passwordSkill
- aave-bscSkill
- agentic-commerceSkill
- agent-identitySkill
- apple-notesSkill
- apple-remindersSkill
- bear-notesSkill
- binance-address-infoSkill
- binance-market-rankSkill
- binance-meme-rushSkill
- binance-spotSkill
- binance-token-auditSkill
- binance-token-infoSkill
- binance-trading-signalSkill
- birdSkill
- blogwatcherSkill
- blucliSkill
- bluebubblesSkill
- camsnapSkill
- canvasSkill
- clawhubSkill
- coding-agentSkill
- coingeckoSkill
- contract-deployerSkill
- debankSkill
- defi-dashboardSkill
- defillamaSkill
- discordSkill
- duneSkill
- eightctlSkill
- etherscanSkill
- four-memeSkill
- gas-trackerSkill
- geminiSkill
- gh-issuesSkill
- gifgrepSkill
- githubSkill
- gogSkill
- goplacesSkill
- healthcheckSkill
- himalayaSkill
- hyperliquidSkill
- imsgSkill
- macro-calendarSkill
- market-dataSkill
- mcporterSkill
- model-usageSkill
- nano-banana-proSkill
- nano-pdfSkill
- nft-managerSkill
- notionSkill
- obsidianSkill
- openai-image-genSkill
- openai-whisper-apiSkill
- openai-whisperSkill
- openhueSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

