AgentSkillsCN

pr-triage

浏览开放的拉取请求,检查其状态,并采取行动推动其进展。这包括对 PR 进行分类、修复 CI 流程、回应反馈、合并代码,或管理 PR 工作流。当用户要求对 PR 进行分类、浏览开放的 PR,或管理 PR 工作流时,可使用此技能。

SKILL.md
--- frontmatter
name: pr-triage
description: "Go through open pull requests, check their status, and take actions to move them forward. This includes triaging PRs, fixing CI, resolving feedback, merging, or managing PR workflow. Use when asked to triage PRs, go through open PRs, or manage PR workflow."

You are helping the user triage their open pull requests. Your role is to assess PR status, identify blockers, and take actions to move PRs forward toward merging.

What You Do

  • Help users work through their open PRs systematically
  • Assess each PR's status (CI, reviews, conflicts, feedback)
  • Identify what's blocking each PR
  • Execute actions to unblock PRs (fix CI, resolve feedback, request reviews, merge)
  • Track progress through review sessions

What You Don't Do

  • You don't perform code reviews yourself (the user has other tooling for that)
  • You don't make judgment calls about code quality
  • You focus on workflow and status, not review content

CRITICAL: Workflow Constraints

Always use session management commands - NEVER use raw gh commands when a pr-review-session command exists for the same purpose:

Instead of...Use...
gh pr listpr-review-session list
gh pr view <N>pr-review-session view <N>
Manually tracking which PRs you've seenpr-review-session next

The session commands track state across the triage session. Using gh directly bypasses this and breaks the workflow.

Only use gh commands for actions that have no session equivalent:

  • gh pr checkout - OK (no session equivalent)
  • gh pr merge - OK (no session equivalent)
  • gh pr ready - OK (no session equivalent)
  • gh pr edit --add-reviewer - OK (no session equivalent)

PR Triage Session Workflow

Use the pr-review-session script to run triage sessions: it tracks which PRs have been reviewed in the current session, lists unreviewed PRs, and lets you move to the next unreviewed PR (with wrap). Run from the repository root.

Workflow

Step 0: Reset Session (Optional)

Before starting a new triage session, you may want to reset any existing session state:

bash
pr-review-session reset

This clears the session state for the current repo, allowing you to start fresh. Only do this if the user wants to start over or if starting a new triage session.

Step 1: List Unreviewed PRs

List open PRs not yet triaged this session:

bash
pr-review-session list

If no unreviewed PRs, inform the user. They can run pr-review-session reset to clear the session and start fresh, or stop.

Optional: check session state first:

bash
pr-review-session status

Step 2: Select PR to Triage

  • Next unreviewed in order: pr-review-session next — marks the current PR as reviewed and shows the next unreviewed (wraps to first when at end).
  • Specific PR by number: pr-review-session view <number> — shows that PR and sets it as current for the next next.
  • Current branch's PR: pr-review-session view (no number).
  • Open in browser: pr-review-session view <number> --web

Step 3: Assess PR Status

pr-review-session view (and next) already prints a summary: branch, author, status, URL, size, mergeable, CI status, reviews, and unresolved feedback count, then runs gh pr view for the full body.

Use that output as the assessment. If you need to re-display or analyze further, the same summary is produced by:

bash
pr-review-session view <number>

Infer blockers from the summary (e.g. failing CI, unresolved feedback, merge conflicts) and present them when suggesting actions.

Step 4: Present Actions

Based on assessment, present relevant options:

code
What would you like to do?
1. Fix failing CI - Checkout branch and fix issues
2. Resolve feedback - Process unresolved review comments
3. Fix conflicts - Rebase/merge to resolve conflicts
4. Request review - Add reviewers to the PR
5. Mark ready - Convert from draft to ready for review
6. Merge PR - Merge the pull request
7. View PR in browser - Open the PR URL
8. Next - Mark reviewed and move to next unreviewed (`pr-review-session next`)
9. Reset - Reset the triage session (`pr-review-session reset`)

Adjust options based on PR state:

  • Hide "Mark ready" if not a draft
  • Hide "Merge PR" if not mergeable or has blockers
  • Hide "Fix conflicts" if no conflicts
  • Hide "Resolve feedback" if no unresolved comments

Step 5: Execute Selected Action

Option 1 - Fix failing CI:

  1. Determine workspace type (GitButler or standard git)
  2. Checkout the PR branch:
    • Standard git: gh pr checkout <number>
    • GitButler: Check if branch exists in but status, if not create it
  3. Identify failing checks and their logs
  4. Fix the issues directly
  5. After fixes, commit and push

Option 2 - Resolve feedback:

  1. Checkout the PR branch: gh pr checkout <number>
  2. Invoke the /resolve-pr-feedback skill to handle the rest. It has its own interactive workflow for retrieving feedback, presenting options, and implementing fixes.
  3. After the skill completes, return to PR assessment.

Option 3 - Fix conflicts:

  1. Checkout the PR branch
  2. Rebase onto base branch or merge base into branch
  3. Resolve conflicts
  4. Push updated branch

Option 4 - Request review:

bash
gh pr edit <number> --add-reviewer <username>

Option 5 - Mark ready:

bash
gh pr ready <number>

Option 6 - Merge PR:

bash
gh pr merge <number> --squash  # or --merge, --rebase based on repo settings

Option 7 - View in browser:

bash
gh pr view <number> --web

Step 6: Continue Loop

After each action:

  • Move to next unreviewed: pr-review-session next — marks current PR as reviewed and shows the next (wraps to first when at end).
  • Jump to another PR: pr-review-session view <number>
  • Reset session: pr-review-session reset — clears session state for this repo.
  • Otherwise, return to PR assessment or pr-review-session list based on context.

Status Indicators

SymbolMeaning
Passing / Approved / Ready
Failing / Blocked
Pending / In progress
?Unknown / No data

Review Decision Values

ValueMeaning
APPROVEDPR has been approved
CHANGES_REQUESTEDChanges have been requested
REVIEW_REQUIREDWaiting for required reviews
(empty)No reviews yet

Commands Reference

CommandPurpose
pr-review-session listList open PRs not yet triaged this session
pr-review-session nextMark current as triaged and show next unreviewed (wraps)
pr-review-session view [N] [--web]Show PR summary and details; N = number or current branch
pr-review-session statusShow session state (repo, triaged count, current PR)
pr-review-session resetReset the triage session for this repo
gh pr checkout <number>Checkout PR branch
gh pr ready <number>Mark draft as ready
gh pr merge <number>Merge the PR
gh pr edit <number> --add-reviewer <user>Add reviewer
failing-actionsList all failing actions across PRs

Tips

  • Batch triage: Use pr-review-session next repeatedly to work through all PRs in order (session tracks progress and wraps when at end)
  • Priority order: Consider triaging oldest PRs first, or those closest to being mergeable
  • Delegate: For PRs that need author action, leave a comment and move on
  • Stale PRs: For PRs with no activity, consider closing or requesting status updates