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.
npx skills add dyoshikawa/rulesync --skill approve -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/approve/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/approve/
1Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill approve -a codex2Manually: put the files in place
.agents/skills/approve/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill approve -a cursor2Manually: put the files in place
.cursor/skills/approve/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dyoshikawa/rulesync approve2Manually: put the files in place
.github/skills/approve/SKILL.md1Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill approve -a gemini-cli2Platform CLI
gemini skills install https://github.com/dyoshikawa/rulesync --path .rulesync/skills/approveManually: put the files in place
.devin/skills/approve/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dyoshikawa/rulesync --skill approve -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 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