Skip to main content
skill CX Codex

goal-pr — Claude Code skill: what it does, how to install

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.

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

What goal-pr does

The skill targets an existing PR or detects one on your current branch. If a pull request does not exist, it opens one using the companion commit-push-pr skill. It relies on GitHub CLI (gh) to inspect check runs and requires your local branch to match the pull request head branch.

Execution runs in an automated loop. The hard safety cap is 10 iterations. In each round, the review-pr skill categorizes issues by severity. The agent edits code to resolve every finding ranked mid or higher, executes pnpm cicheck, and pushes fixes back to GitHub. If only mid findings remain when reaching the iteration cap and CI is passing, it logs them via create-scrap-issue and finishes the merge.

Workflows touching .github/** or introducing new runtime dependencies halt the automation for human confirmation. The skill will not merge past failing CI checks.

What it helps with

  • drive a pull request to a mergeable state automatically
  • resolve mid-level and critical code review findings iteratively
  • run local checks via pnpm cicheck before pushing fixes
  • track unresolved mid-severity issues in a scrap issue when hitting iteration limits

Example prompts for the agent

  • Use the goal-pr skill to finish and merge PR #123
  • Run goal-pr on the current branch
  • Drive this pull request to merge using goal-pr

How to install goal-pr

1Skills CLI (Vercel)

npx skills add dyoshikawa/rulesync --skill goal-pr -a claude-code

2Manually: put the files in place

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

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

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

Questions about goal-pr

How to install goal-pr in Claude Code?

Run npx skills add dyoshikawa/rulesync --skill goal-pr -a claude-code.

What does goal-pr do?

It inspects a target PR, runs iterative code reviews, patches issues ranked mid or higher, verifies CI status, and merges the PR once checks pass.

When does goal-pr stop and request user confirmation?

The skill halts before merging if the PR modifies workflow files in .github/**, alters release pipelines, or introduces a new runtime dependency.

Source text

SKILL.md · MIT
---
name: goal-pr
description: >-
  Drive a pull request to a clean state and merge it: run the `review-pr` skill,
  fix every mid-or-above finding, and repeat until no mid-or-above findings
  remain, then merge. Use when the user wants to finish a PR by reviewing,
  fixing, and merging it, or triggers on "the `goal-pr` skill".
targets:
  - "*"
---

# Goal PR

target_pr = the user's request

This skill drives a pull request all the way to merge. It repeatedly runs
the `review-pr` skill, fixes every finding of severity `mid` or above, and merges the PR
once a review round reports no `mid`-or-above findings.

## 0. Determine and Prepare the Target PR

1. If `target_pr` is provided (e.g. `123`, `#123`, or a PR URL), use it.
2. Otherwise, look for the PR of the current branch:

   ```bash
   gh pr view --json number,title,state,headRefName 2>/dev/null
   ```

3. If no PR exists yet, create one (this satisfies the "PR is the goal" intent):
   - Use the `commit-push-pr` skill to commit the current changes, push the
     branch, and open a PR.
   - Then resolve `target_pr` to the freshly created PR number.

Confirm that the current local branch is the PR's head branch, because the fix
phase below must commit and push fixes onto that branch. If they differ, ask the
user how to proceed and stop.

## 1. Exit Condition

The loop exits when a single review round satisfies **both** of:

- **0** findings of severity `mid`, `high`, or `critical` (only `low` findings,
  or none at all, may remain).
- The PR's GitHub Actions checks are **green** — no check is `fail` or
  `pending`.

Set a hard safety cap of **10 iterations**. If the exit condition is still not
met at the cap:

- If CI is green and every remaining finding is `mid` (no `high` or
  `critical`), merge anyway: record the remaining findings with the
  `create-scrap-issue` skill so they are tracked, then go to **Section 3**.
  `mid` findings are not merge blockers.
- Otherwise (a `high` / `critical` finding remains, or CI is red), stop the
  loop and report the remaining findings and failing CI instead of merging.

## 2. Iteration Loop

Repeat the following until the exit condition is satisfied or the cap is hit.

### 2-1. Review Phase

Use the `review-pr` skill with `target_pr`. It assigns each finding a
severity (`low` / `mid` / `high` / `critical`) and a sequential number, and also
reports the GitHub Actions workflow status.

Note: the `review-pr` skill only reads remote state and must not switch the local branch.
Keep that constraint intact during the review phase.

### 2-2. Evaluate the Exit Condition

Use both the findings and the GitHub Actions status from the review result.

- If `mid + high + critical == 0` **and** CI is green (no `fail` / `pending`
  check): exit the loop and go to **Section 3**.
- If there are `mid`-or-above findings, or any CI check is failing: proceed to
  the fix phase to address them.
- If the findings are clean but CI is still `pending`: wait for the checks to
  finish (re-check with `gh pr checks <pr>`), then re-evaluate. Do not proceed to
  merge while checks are pending.

### 2-3. Fix Phase

Fix every finding of severity `mid` or above on the current branch (you may also
fix `low` findings opportunistically). Unlike the review phase, this phase works
on the local branch directly:

1. Edit the relevant files to address each `mid`-or-above finding. If you
   intentionally reject a finding, record the reason and treat it as resolved.
2. Run `pnpm cicheck` (or the narrower `pnpm cicheck:code` / `cicheck:content`
   when appropriate) and fix any failures before continuing.
3. Stage only the files you changed for the fix (review `git status` first so
   unrelated or generated files are not swept in), commit with a descriptive
   message, and push to the PR's head branch:

   ```bash
   git status
   git add <changed files>
   git commit -m "<message>"
   git push origin HEAD
   ```

Emit a short status line such as
`Iteration N — mid: X, high: Y, critical: Z; pushed fixes`, then return to
**Section 2-1** so the updated PR (and its CI) is reviewed again.

## 3. Merge

Only reach this step once the exit condition in Section 1 holds — clean findings
**and** green CI. Merge the PR by using the `merge-pr` skill with
`target_pr`. That skill verifies the PR is open, checks GitHub Actions status,
merges with `gh pr merge --admin --merge`, posts a thank-you comment, and cleans
up the local branch.

Safety rules for the merge:

- **Never merge while any check is `fail` or `pending`.** `gh pr merge --admin`
  bypasses required checks, so it must not be used to force past red or
  in-progress CI. If CI is failing, return to the fix phase; if it is pending,
  wait.
- If the PR edits GitHub Actions workflows (`.github/**`) or the
  release/publish pipeline, or adds a **new runtime dependency**, do **not**
  auto-merge. Stop and ask the user to confirm, since these changes carry
  higher risk. Bumping an existing dependency, adding a dev dependency, or
  editing `package.json` scripts and metadata does not need confirmation.

## 4. Final Report

After the loop ends, report to the user:

- **Outcome**: `Merged` (exit condition met and PR merged), `Merged at cap`
  (only `mid` findings left at the cap; merged with a scrap issue), or `Capped`
  (a `high` / `critical` finding or red CI left at the cap; not merged).
- **Iterations**: how many review/fix rounds were executed.
- **Final severity summary**: the counts per severity from the last review
  round.
- **Result**: the merged PR number and title (plus the scrap issue link when
  merged at the cap), or — when capped — the list of remaining findings for
  the user to decide on.

© dyoshikawa · MIT · dyoshikawa/rulesync

Similar skills

All skills for Git and GitHub →

From the same set36

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-pr Merges GitHub pull requests using gh pr merge with the --admin flag, monitors workflow checks, and cleans up local branches. 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-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 git-worktree-runner A skill that teaches the agent to drive git worktrees through the gtr CLI: create, open in an editor, run commands, remove. CX Codex +1 ★ 1,557repo stars explain-pr Summarizes any pull request by fetching its diff and description through GitHub CLI, explaining the core problem and the proposed fix. CX Codex +1 ★ 1,557repo stars 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

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