merge-pr — Claude Code skill: what it does, how to install
Merges GitHub pull requests using gh pr merge with the --admin flag, monitors workflow checks, and cleans up local branches.
npx skills add dyoshikawa/rulesync --skill merge-pr -a claude-codeWhat merge-pr does
This skill guides the agent through merging pull requests via the GitHub CLI. It extracts the PR number from your input or inspects the active branch with gh pr view. If the target is ambiguous, it stops to ask. It confirms the PR is open and mergeable before moving forward.
Workflow checks are verified next using gh pr checks. When workflows are still running, the skill tracks them until completion with --watch. If a test fails, it asks whether to inspect the failures or bypass them using the admin flag. The merge executes through gh pr merge <pr_number> --admin --merge. It handles only one pull request per run.
After merging, the skill comments on the PR to thank the author and checks out main. It then deletes the local head branch. Without GitHub CLI installed and authenticated, the commands will fail immediately.
What it helps with
- merge a pull request using admin privileges
- wait for pending GitHub Actions checks to pass
- post a thank-you comment to the PR author
- clean up the local git branch after merging
Example prompts for the agent
- Merge the pull request for the current branch using admin mode
- Check checks and merge PR #123
- Merge this PR and clean up the local branch
How to install merge-pr
1Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill merge-pr -a claude-code2Manually: put the files in place
~/.claude/skills/merge-pr/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/merge-pr/
1Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill merge-pr -a codex2Manually: put the files in place
.agents/skills/merge-pr/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill merge-pr -a cursor2Manually: put the files in place
.cursor/skills/merge-pr/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dyoshikawa/rulesync merge-pr2Manually: put the files in place
.github/skills/merge-pr/SKILL.md1Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill merge-pr -a gemini-cli2Platform CLI
gemini skills install https://github.com/dyoshikawa/rulesync --path .rulesync/skills/merge-prManually: put the files in place
.devin/skills/merge-pr/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill merge-pr -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about merge-pr
How to install merge-pr in Claude Code?
Run npx skills add dyoshikawa/rulesync --skill merge-pr -a claude-code in your terminal.
What does merge-pr do?
It verifies PR status using the GitHub CLI, waits for running workflows, merges with --admin, posts a thank-you note, and deletes the local branch.
What happens if a GitHub Actions check fails?
The skill alerts you and asks whether to investigate failed checks or bypass required checks by merging with --admin.
Source text
SKILL.md · MIT
--- name: merge-pr description: Merge a pull request using gh pr merge --admin targets: - "*" --- # Merge Pull Request Merge a pull request using `gh pr merge --admin`. ## Input ``` the user's request ``` ## Step 1: Determine the Target PR Parse `the user's request` to identify the PR to merge: ### Case A: PR number or URL is provided - Extract the PR number from the argument - Examples: `123`, `#123`, `https://github.com/owner/repo/pull/123` ### Case B: No argument provided - Get the PR associated with the current branch: ```bash gh pr view --json number,title,state ``` ### Case C: Unable to determine the PR If the PR cannot be determined (e.g., no PR exists for the current branch, or the argument is ambiguous), **ask the user** to specify which PR to merge. ## Step 2: Verify the PR Before merging, confirm the PR details: ```bash gh pr view <pr_number> --json number,title,state,mergeable,author,baseRefName,headRefName ``` Check: 1. The PR state is `OPEN` 2. Display the PR title and number to the user (for visibility; do not wait for a reply) If the PR is not open or not mergeable, inform the user and stop. ## Step 3: Check GitHub Actions Workflow Status Verify that all CI checks have passed before merging: ```bash gh pr checks <pr_number> ``` Check: 1. All workflow checks show `pass` status 2. No checks are `pending` or `fail` If checks are still running, do not ask — wait for them with `gh pr checks <pr_number> --watch` and merge once they all pass. If any check has failed, inform the user and ask whether to: - Investigate failed checks before merging - Proceed with merge anyway (using `--admin` will bypass required checks) ## Step 4: Merge the PR Execute the merge command: ```bash gh pr merge <pr_number> --admin --merge ``` **Important**: Only merge ONE PR at a time. If multiple PRs are somehow specified, ask the user which single PR to merge. ## Step 5: Comment on the PR After the merge succeeds, leave a thank-you comment mentioning the PR author: ```bash gh pr comment <pr_number> --body "@<author_login> Thank you!" ``` Use the `author.login` value obtained in Step 2 for the mention. ## Step 6: Report Result After merging: 1. Confirm the PR was successfully merged 2. Display the merged PR number and title ## Step 7: Clean Up Local Branch If the local branch exists, please clean up the local branch. Execute: ```bash git checkout main && git pull --prune && git branch -d <branch-name> ``` Where `<branch-name>` is the head branch name from Step 2 (e.g., `fix/rulesync-import-targets`).
© dyoshikawa · MIT · dyoshikawa/rulesync