merge-pr

Merge a pull request using gh pr merge --admin

971 stars

Best use case

merge-pr is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Merge a pull request using gh pr merge --admin

Teams using merge-pr should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/merge-pr/SKILL.md --create-dirs "https://raw.githubusercontent.com/dyoshikawa/rulesync/main/.rulesync/skills/merge-pr/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/merge-pr/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How merge-pr Compares

Feature / Agentmerge-prStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Merge a pull request using gh pr merge --admin

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Merge Pull Request

Merge a pull request using `gh pr merge --admin`.

## Input

```
$ARGUMENTS
```

## Step 1: Determine the Target PR

Parse `$ARGUMENTS` 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 confirmation

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 any checks have failed or are still running, inform the user and ask whether to:

- Wait for pending checks to complete
- 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`).

Related Skills

rulesync

986
from dyoshikawa/rulesync

Generates and syncs AI rule configuration files (.cursorrules, CLAUDE.md, copilot-instructions.md) across 20+ coding tools from a single source. Use when syncing AI rules, running rulesync commands, importing or generating rule files, or managing shared AI coding configurations.

skill-creator

986
from dyoshikawa/rulesync

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

security-scan-diff

986
from dyoshikawa/rulesync

Scan for malicious code in git diff between a tag/commit and HEAD

release-dry-run

986
from dyoshikawa/rulesync

Dry run for release: summarize changes since last release and suggest version bump.

playwright-cli

986
from dyoshikawa/rulesync

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

git-worktree-runner

986
from dyoshikawa/rulesync

Manages git worktrees using git-worktree-runner (gtr). Use when the user needs to create, list, remove, or navigate worktrees with `git gtr` commands, open editors or AI tools in worktrees, manage parallel development branches, or check out GitHub PRs (including from forks) into worktrees.

draft-release

986
from dyoshikawa/rulesync

Draft a new release of the project.

create-scrap-issue

986
from dyoshikawa/rulesync

Create a GitHub issue that consolidates passed content into a single scrap issue with background context and solution details, labeled as maintainer-scrap. Use when the user wants to create a scrap issue, jot down notes as a GitHub issue, or save findings for later.

create-issue

986
from dyoshikawa/rulesync

Create a GitHub issue with detailed description, purpose, and appropriate labels

review-pr

971
from dyoshikawa/rulesync

Review a pull request for code quality and security issues. Use when the user wants to review a PR, check PR code changes, or audit a pull request. Triggers on: "review PR", "review pull request", "check this PR", "/review-pr".

review-and-comments

971
from dyoshikawa/rulesync

Review a PR for code quality and security issues, then post review comments on it. Runs review-pr followed by post-review-comments sequentially.

rebase-latest-main

971
from dyoshikawa/rulesync

Fetch latest origin/main and rebase it onto the current branch, resolving conflicts if necessary. Use when the user wants to rebase on main, update their branch with latest main, or sync with upstream.