agentleFS
BlockKnown publisherblock/proto-fleet/.agents/skills/triage-pr/SKILL.md

triage-pr

Skill57 starsChanged 44 days agoApache-2.0View on GitHub

Triage a pull request — fetch metadata, check status, summarize failing CI logs, ingest reviewer comments, and propose next steps.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When passing pr_ref to a shell command, ALWAYS double-quote it (gh pr view "$pr_ref", not gh pr view $pr_ref).

    line 24
  2. Very specific:

    Pull and triage reviewer feedback: Use the JSON-derived owner, repo, and number from step 2:

    line 58
  3. Distinctive:

    Do NOT push a fix, post a reply, or rerun checks.

    line 84
  4. Very specific:

    If the PR is in another repo, pass the URL form to gh pr view.

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Triage the PR number or URL supplied with the skill invocation. Save it as pr_ref. Goal: give the user a one-screen status read so they can decide what to do next without reading the GitHub UI.

Steps

  1. Validate pr_ref before any shell call. The argument must match exactly one of:

    • Bare PR number: ^[0-9]+$
    • Canonical GitHub PR URL: ^https://github\.com/[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})/[A-Za-z0-9._-]+/pull/[0-9]+$

    The URL pattern matches GitHub's actual username/repo charset (owners are 1–39 chars from [A-Za-z0-9-] with no leading hyphen; repos are [A-Za-z0-9._-]). If neither matches, stop and ask the user for a clean identifier.

    When passing pr_ref to a shell command, ALWAYS double-quote it (gh pr view "$pr_ref", not gh pr view $pr_ref). The regex is the first defense; the quote is the second. After step 2, prefer JSON-derived values (number, parsed owner/repo from the url field) over re-using pr_ref for any further API call.

  2. Fetch PR metadata: gh pr view "$pr_ref" --json number,title,state,isDraft,mergeable,mergeStateStatus,headRefName,baseRefName,author,reviewDecision,statusCheckRollup,url

    Capture from the response:

    • number — the canonical PR number (use this, not pr_ref, in URL paths going forward)
    • owner and repo — parsed from the url field (which is https://github.com/<owner>/<repo>/pull/<n>). The URL is gh's output, not user input, so it's safe to parse via shell parameter expansion or sed.
  3. Fetch check status: gh pr checks "$pr_ref"
  4. Summarize in this shape:
    • PR: number, title, author, branch
    • State: open/closed/merged, draft, mergeable status
    • Reviews: approval state
    • CI: count of pending / failing / passing checks. Name the failing ones explicitly.
  5. For each failing check, fetch logs:
    • Get the run URL via gh pr checks "$pr_ref" --json name,state,link and filter where state == "FAILURE". The integer after /runs/ in the link URL is the run ID.
    • Fetch failing logs: gh run view <run-id> --log-failed. Identify the root-cause line — test name, lint rule, or compile error. Surface that, not the full log.
  6. Map failing checks to likely culprit areas using the PR diff: gh pr diff "$pr_ref" --name-only — match against the workflow that failed (e.g. protofleet-server-checks.yml failing with server/ diffs is straightforward; failing without server/ diffs is suspicious).
  7. Pull and triage reviewer feedback. Use the JSON-derived owner, repo, and number from step 2:

    • Line comments: gh api "repos/$owner/$repo/pulls/$number/comments"
    • Issue comments: gh api "repos/$owner/$repo/issues/$number/comments"
    • Reviews: gh pr view "$pr_ref" --json reviews

    Dedupe findings that appear from multiple sources (the same path:line flagged by both Copilot and Codex is one finding, not two). For each unique finding, classify:

    • Priority — use the comment's own badge (P0/P1/P2, low/medium/high) if present; otherwise infer from severity language.
    • Status — valid (real, needs fix), already-addressed (fixed in a later commit on the branch — re-check the current code on disk), invalid (false positive, with a brief reason), or needs-discussion.

    Output a punch-list table: file:line | source | priority | finding | status. Skip purely informational bot output (e.g. "auto-formatted N files"). Group the table after the CI section in the final summary.

  8. Propose the next concrete action based on the CI summary AND the comment triage. Examples: "Fix the failing test in X", "Address the P1 from Codex re: <thing>", "Rerun CI (probably flaky)", "This needs a rebase against main", "Approval is the only blocker".

Notes

  • Do NOT push a fix, post a reply, or rerun checks. Triage is read-only.
  • If the PR is in another repo, pass the URL form to gh pr view.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.