Skip to main content
skill CX Codex

approve — Claude Code skill: approve a pull request with gh

This skill walks the agent through approving a pull request: it locates the PR, checks its state, and sends the approval through GitHub CLI.

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

What approve does

Give the agent a request to approve a pull request and the skill breaks it into steps. A number or URL in the request tells it which PR to use. With no argument, it reads the PR tied to the current branch via gh pr view --json number,title,state. If the target stays unclear, the skill asks you to name it.

Before approving, the agent pulls details with gh pr view <pr_number> --json number,title,state,author,baseRefName,headRefName,isDraft and checks two things: the PR is open and it is not a draft. Title, number and author are shown to you for confirmation. A closed or draft PR stops the run.

The approval itself runs as gh pr review <pr_number> --approve, and --body attaches a comment. One PR per run — if several are named, the skill asks which single one to approve. You need gh installed and authenticated, or none of the commands will go through.

What it helps with

  • approve a pull request without leaving the terminal
  • confirm a PR is open and not a draft before approving
  • target the PR of the current branch by number or URL
  • attach a review comment along with the approval
  • avoid approving more than one PR by accident

Example prompts for the agent

  • Approve pull request #123
  • Approve the PR on this branch and add the comment "looks good"
  • Check the state of https://github.com/owner/repo/pull/123 and approve it

How to install approve

1Skills CLI (Vercel)

npx skills add dyoshikawa/rulesync --skill approve -a claude-code

2Manually: put the files in place

~/.claude/skills/approve/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/approve/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about approve

How do I install approve in Claude Code?

Run npx skills add dyoshikawa/rulesync --skill approve -a claude-code. The skill file lands at ~/.claude/skills/approve/SKILL.md.

What does the approve skill do?

It finds the pull request you mean, verifies it is open and not a draft, then submits the approval with gh pr review --approve.

What do I need before using approve?

An installed and authenticated GitHub CLI, since the skill calls gh pr view and gh pr review. Without gh the steps cannot run.

Source text

SKILL.md · MIT
---
name: approve
description: Approve a pull request using gh pr review --approve
targets:
  - "*"
---

# Approve Pull Request

Approve a pull request using `gh pr review --approve`.

## Input

```
the user's request
```

## Step 1: Determine the Target PR

Parse `the user's request` to identify the PR to approve:

### 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 approve.

## Step 2: Verify the PR

Before approving, confirm the PR details:

```bash
gh pr view <pr_number> --json number,title,state,author,baseRefName,headRefName,isDraft
```

Check:

1. The PR state is `OPEN`
2. The PR is not a draft (`isDraft` is `false`)
3. Display the PR title, number, and author to the user for confirmation

If the PR is not open or is a draft, inform the user and stop.

## Step 3: Approve the PR

Execute the approve command:

```bash
gh pr review <pr_number> --approve
```

**Important**: Only approve ONE PR at a time. If multiple PRs are somehow specified, ask the user which single PR to approve.

If you want to add a comment along with the approval, use the `--body` option:

```bash
gh pr review <pr_number> --approve --body "<approval_comment>"
```

## Step 4: Report Result

After approving:

1. Confirm the PR was successfully approved
2. Display the approved PR number and title

© dyoshikawa · MIT · dyoshikawa/rulesync

Similar skills

All skills for Git and GitHub →

From the same set21

explain-issue This skill explains the problem behind a GitHub issue and the solution discussed there. Use it to get oriented in an issue and its comments. CX Codex +1 ★ 1,557repo stars draft-issue-to-external-repository Drafts a GitHub issue for a repository you do not own: reads the project's templates and title style, settles scope with you, and saves the body to a file. CX Codex +1 ★ 1,557repo stars create-scrap-issue This skill turns notes and findings into one GitHub issue with context, details, and next steps. Use it when you want to keep project scraps for later. CX Codex +1 ★ 1,557repo stars create-issue A skill that walks through issue creation step by step: gathers context, checks the codebase, drafts English text, and assigns labels. Handy when you want a tidy issue without doing it manually. CX Codex +1 ★ 1,557repo stars clean-branches A skill that walks your local git branches, finds merged and orphaned ones, and deletes them one at a time with a closing report. CX Codex +1 ★ 1,557repo stars batch-all-scrap-issues This skill reviews open maintainer-scrap issues one by one, closes those that need no work, and routes actionable fixes through goal-pr. CX Codex +1 ★ 1,557repo stars batch-all-issues A skill that walks every open issue one at a time: fact-checks each with web research, closes the ones needing no action, and drives the rest to merge. CX Codex +1 ★ 1,557repo stars agent-team This skill pairs an Implementer subagent with a Reviewer subagent and repeats the cycle until the review comes back clean enough. 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