PR Triage
Classify each PR wake-up as noise, CI fix, rebase, finding or merge, and act without wasting tokens.
- Version
- 1.0.0
- Last updated
- Category
- Pull requests
- Works in
- Claude Code, Codex, Cursor, T3 Code
- Requires
- git, gh, python3>=3.8
- Repository
- dxbh0517/skill-pr-triage
Install
npx skills add dxbh0517/skill-pr-triageFinds the skill folder in the repo and installs it for the agents it detects.
Say this
- checks failed on the PR
- Vercel commented on the PR
- what does this PR need now
- PR has conflicts with base
- update on pull request
Or call it by name where your agent has slash commands: /pr-triage.
SKILL.md
name | pr-triage |
|---|---|
description | Decide in one step what a pull-request wake-up needs — nothing (deploy-preview bot comments, duplicate or stale events), a CI fix, a rebase, a review-finding fix, or the merge — and act without spending tokens on noise. Use whenever a PR watcher wakes you ("Update on pull request #N…", "checks failed", "conflicts with its base branch", "new comment", "Vercel commented on the PR"), when a background `gh pr checks --watch` exits, when the user asks "what does this PR need now?", and inside ship, signalbox, or any PR-watch loop. Not for opening a PR, writing a code review of a diff, or a first-time review of someone else's PR; this skill only triages events on a PR you are already driving. |
PR triage
Most PR wake-ups are noise. A Vercel preview comment is not news. Handle each wake in this order and stop at the first match. Do not re-read the diff, re-summarize the PR, or post "still waiting" for noise.
What a wake is
| Harness | Wake |
|---|---|
| T3 Code | the watch_pull_request message ("Update on pull request #N…") |
| Claude Code, Codex, Cursor, other | the one background gh pr checks <n> --watch --fail-fast exiting, or the user re-invoking you |
Outside T3 there is no event payload. Read the state yourself:
gh pr view <n> --json state,isDraft,headRefOid,mergeStateStatus,mergeable,statusCheckRollup,reviews,commentsMap it onto the table below: state → done; mergeStateStatus BEHIND/DIRTY or
mergeable CONFLICTING → rebase; statusCheckRollup entries are the head SHA's
checks (FAILURE/ERROR/TIMED_OUT/CANCELLED → ci-fail, all SUCCESS/NEUTRAL/SKIPPED
→ green, any still running → wait); comments and reviews newer than what you
handled → finding or noise by author; a review whose commit.oid is not
headRefOid is stale. gh pr view omits inline review-thread comments; read
them with gh api repos/{owner}/{repo}/pulls/<n>/comments when a review has no body.
Optional speed-up: pipe that JSON into scripts/classify.py (stdlib Python, no
network). It applies this table and priority order and prints <class>: <reason>.
Keep its state per PR in the scratchpad, or ${TMPDIR:-/tmp}/pr-triage/:
gh pr view <n> --json state,isDraft,headRefOid,mergeStateStatus,mergeable,statusCheckRollup,reviews,comments \
| python3 scripts/classify.py --last-handled "$S" --save "$S" # S=${TMPDIR:-/tmp}/pr-triage/<repo>-<n>.jsongh pr view cannot tell required checks from optional ones; pass
--optional <check> for each check that does not block merge.
1. Classify the event
| Event | Class |
|---|---|
Comment from a deploy-preview bot: vercel, netlify, cloudflare-pages / cloudflare-workers-and-pages, railway-app, render, fly-io, github-actions deploy summaries, [vc]: payloads, "Preview deployment ready/updated" | noise |
Comment from codecov, changeset-bot, sonarcloud summary, dependabot notices, bundle-size or Lighthouse bots, unless they report a failure that blocks merge (that shows up as a failing check) | noise |
| Same event already handled (same SHA, same check, same comment id and body) | noise |
| Event about an older SHA than the current head | noise |
| Required check failed on the head SHA | ci-fail |
| Conflicts with base / BEHIND / DIRTY | rebase |
| Review-bot finding (CodeRabbit, Greptile, Macroscope, Copilot, Cursor Bugbot, Claude) or human comment/review | finding |
| All required checks passed on the head SHA | green |
| PR merged or closed | done |
A deploy-preview comment that says the deployment failed is ci-fail,
not noise. Deploy bots edit one comment in place, so a handled comment id with a
new body is a new event. Read the build log through the host (Vercel MCP
get_deployment + build logs, or vercel inspect --logs <url>; else the
check's details link from gh pr checks <n>).
A wake can carry several events. Handle the highest-impact one first: done > rebase > ci-fail > finding > green > noise.
2. Act
- noise → if the PR is still yours to watch, re-arm the one watcher
(T3:
watch_pull_request; elsewhere: startgh pr checks <n> --watch --fail-fastin the background again) and end the turn with no message. Nothing else: no file reads, no summaries. - ci-fail → read only the failing job's log (T3:
ci_logs; elsewhere:gh run view <id> --log-failed). Infra flake (runner died, network, 5xx, timeout with no test failure, rate limit) → rerun once (T3:ci_rerun; elsewhere:gh run rerun <id> --failed). Second identical failure or a real error → fix it on the branch (or delegate, under signalbox), push, watch again. - rebase →
git fetch, rebase onto the base, resolve, run the checks the conflict touched,git push --force-with-leaseto this PR's branch only, watch again. - finding → verify against the source before changing anything. Real bug in the intended path → fix. Otherwise decline (see below) and resolve. Keep scope: decline speculative edge cases, extra tests, and refactors as follow-ups.
- green → if merging was authorized (ship, signalbox, "merge it", "full
send"), run the merge gate on a fresh
gh pr view: currentheadRefOidequals the SHA that went green (green_headin the--savestate; the reason prints it as "green (head <sha>)"),isDraftis false,mergeStateStatusis not BEHIND, DIRTY or BLOCKED (UNSTABLE is fine: only optional checks failed), no unresolved real findings, review bots finished. Then merge (T3:pull_request_merge; elsewhere:gh pr merge <n>). If not authorized ("full stop" means: leave it ready, never merge), stop watching (T3:unwatch_pull_request) and report "ready" in one line. - done → stop. Run post-merge steps if
shipis driving.
Declining a finding
Reply on the thread, then resolve it:
- One or two sentences. Lead with the conclusion, then the concrete reason: file:line, the check that covers it, or the reproduction that shows it is fine.
- No apology, thanks, or status narration. Separate verified fact from judgment.
- Scan the reply for secrets and private details before posting.
- Resolve the thread only after GitHub returns the reply's URL.
3. Cut the noise at the source (once per repo)
If deploy-preview comments keep waking you, tell the user once (do not change settings without asking):
- Vercel: turn off pull-request comments for the project in the Vercel dashboard's Git settings. Previews still deploy and still report as a GitHub check, which is the signal that matters.
- Netlify / Cloudflare: disable deploy-preview comments in the site's build or Git settings; keep the commit status.
Verify the current option name in the host's docs before giving steps; these settings move.
Rules
- One waiter per PR. T3: one
watch_pull_request. Elsewhere: one backgroundgh pr checks <n> --watch. Never both on the same PR, never a second copy. - Only the thread that owns the PR waits on it. Delegated children never watch.
- Stop waiting when you hand off (ready, blocked, or asking the user).
- Never sleep, poll, or write a watch loop. Re-arm only after you handled a wake.
- If GraphQL is rate-limited (
gh api rate_limit --jq .resources.graphql), read the PR withgh api repos/{owner}/{repo}/pulls/<n>and checks withgh api repos/{owner}/{repo}/commits/<sha>/check-runs; do not re-arm in a tight loop. - Never merge on a stale head or with
--admin.
Files
Changelog
[1.0.0] - 2026-11-28
Added
skills/pr-triage/SKILL.md: classify a PR wake-up (noise, ci-fail, rebase, finding, green, done) with a fixed priority order, then act.- Harness notes: how a wake looks outside T3 Code (a background
gh pr checks --watchexiting, or the user re-invoking) and how to classify fromgh pr view --json. - Inline rules for declining a review finding and for keeping one waiter per PR, so the skill works without other skills installed.
scripts/classify.py: optional stdlib classifier overgh pr viewJSON with handled-state tracking, plus fixture-based tests.skill.json, trigger evals, CI and the vendored validator.