Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dyoshikawa/rulesync --skill merge-pr -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/merge-pr/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/merge-pr/

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

Similar skills

All skills for Git and GitHub →

From the same set36

prs-awaiting-maintainer Finds open pull requests with passing checks that are waiting on a maintainer. Use it to list PRs ready for review, another review, or a merge decision. CX Codex +1 ★ 1,557repo stars prs-awaiting-author Lists open pull requests where the next move belongs to the author: failing CI, unaddressed review comments, or a maintainer question waiting on a reply. CX Codex +1 ★ 1,557repo stars post-issue-comment This skill reads a GitHub issue, drafts a concise English reply, and posts it. Use it when the response needs to reflect the existing discussion. CX Codex +1 ★ 1,557repo stars porting-another-repository Reads a feature in your current repo and the target repo's conventions, then writes a porting plan into tmp/ as files you apply yourself. CX Codex +1 ★ 1,557repo stars merge-contributor-pr Resolve merge blockers in a contributor's pull request while keeping the original commits intact. Useful when a PR conflicts with main and needs a merge commit. CX Codex +1 ★ 1,557repo stars goal-release Drives a release end to end: opens the PR, waits for green CI, merges it and updates the Homebrew formula. Handy when a version has to ship in one go. CX Codex +1 ★ 1,557repo stars goal-pr Drives a pull request to merge by running code reviews, fixing mid-level and critical findings, waiting for green CI checks, and completing the merge. CX Codex +1 ★ 1,557repo stars goal-issues-and-release This skill processes open issues, then starts the release workflow. It makes routine choices on its own while keeping the stated safety checks in place. CX Codex +1 ★ 1,557repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor