agentleFS
nrwlnrwl/nx/.claude/skills/triage-prs/SKILL.md

triage-prs

Skill29k starsChanged 9 days agoMITView on GitHub

Triage open pull requests in nrwl/nx. Decides who handles a PR, converts it to a draft when CI is red, checks for a linked issue (GitHub or Linear), and judges whether an unlinked community PR should stay open at all. Produces a plan you approve before anything is written to GitHub. This is NOT a code review — use review-pr for that. Use on "triage this PR", "triage open PRs", "which PRs need an owner", "should we close this PR", "is this PR ready for review".

10 other projects use a version of this.

Trending

More talk lately.about the whole repository

Jan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 5 mentionsApr 2026: 4 mentionsMay 2026: 1 mentionJun 2026: 0 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 1 mentionOct 2026: 4 mentionsNov 2026: 1 mentionDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the nrwl/nx repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about nrwl/nx

The biggest 5 of 93 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 93

Talked about on GitHub, YouTube, Stack Overflow, Bluesky and Hacker News (93 times).

On GitHub · 26

21 more on GitHub

On YouTube · 25

20 more on YouTube

On Stack Overflow · 25

20 more on Stack Overflow

On Bluesky · 11

6 more on Bluesky

Used with

Projects with it also use clack-cli-patterns, drag-to-reorder and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • openchamberSkill

    clack-cli-patterns

    Use when creating or modifying OpenChamber CLI commands, prompts, terminal output, non-TTY behavior, `--quiet`, or `--json` behavior.

    Also in 3 projects that use this

  • openchamberSkill

    drag-to-reorder

    Use when implementing or modifying OpenChamber sortable or drag-to-reorder behavior, especially `@dnd-kit`, touch/mobile interactions, variable-width items, or wrapping layouts.

    Also in 3 projects that use this

  • gabriellstSkill

    desktop-shell

    Work on the CODM desktop shell — the Tauri v2 host (packages/app/tauri), the react client-side services DI (packages/app/react/src/services — ports + platform services + Container/Token + ServicesProvider), sidecar supervision, or any OS-integration capability (folder picker, notifications, badge, secrets, autostart). Use whenever a task mentions Tauri, the desktop app, sidecars, or an OS capability the react console needs.

    Also in 3 projects that use this

  • +9 more from openchamber

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Do not run review-pr. Do not check the branch out.

    line 20
  2. Distinctive:

    Read both. The rest of this page is only what differs for a pull request.

    line 37
  3. Very specific:

    Never draft a PR that is already isDraft.

    line 217
  4. Very specific:

    Add mergeable and mergeStateStatus to the Step 2 fragment.

    line 237
  5. Distinctive:

    A community PR with no issue leans towards closing: Not because the code is wrong, but because nobody agreed the change should be made, and …

    line 256
  6. Distinctive:

    When it goes that way, two things change from the merged case:

    line 339
  7. Distinctive:

    A superseded PR usually means a resolved issue: If the PR you are closing has a linked issue, the merged work that superseded the PR has …

    line 347
  8. Distinctive:

    Read the issue before doing this rather than assuming it.

    line 360
  9. Very specific:

    Follow triage-shared/owners.md.

    line 371

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “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 an nx pull request

Decide who handles this PR, whether it is ready to be looked at, and whether it should exist. Then stage those decisions for a human to approve.

This is not a review

Do not run review-pr. Do not check the branch out. Do not judge the implementation, the test coverage, or the approach. That is the assignee's job after triage, and doing it here costs the expensive part of a review while burying the cheap decision this workflow exists to make.

The one judgement about content you do make is whether the change should be on the table at all (decision 3 below), and that turns on who opened it and whether anyone agreed to it — not on whether the code is good.

Shared with issue triage

These are identical for issues and PRs, and live in one place so a correction lands once:

  • .claude/skills/triage-shared/owners.md — the owners table, the rotation and its guidance, the git-history fallback, and how a linked PR decides the owner.
  • .claude/skills/triage-shared/staging.md — records, the review pane, the feedback loop, the apply step, and the rules about never clearing the state directory.

Read both. The rest of this page is only what differs for a pull request.

1. Find the ones that need it

An open PR is untriaged when nobody owns it. Drafts are excluded — a draft is already out of the queue, which is the state this workflow puts failing PRs into:

gh pr list --repo nrwl/nx --state open --limit 300 --draft=false \
  --json number,title,author,assignees \
  --jq '[.[] | select(.assignees | length == 0)][].number' > /tmp/untriaged-prs.txt

2. Fetch them in one call

Same shape as issue triage — one aliased GraphQL query rather than a gh pr view per PR:

fragment P on PullRequest {
  number
  title
  isDraft
  author {
    login
  }
  authorAssociation
  assignees(first: 5) {
    nodes {
      login
    }
  }
  labels(first: 20) {
    nodes {
      name
    }
  }
  mergeable
  mergeStateStatus
  closingIssuesReferences(first: 5) {
    nodes {
      number
      title
    }
  }
  commits(last: 1) {
    nodes {
      commit {
        statusCheckRollup {
          state
        }
        checkSuites(first: 30) {
          nodes {
            status
            conclusion
            app {
              slug
            }
            workflowRun {
              workflow {
                name
              }
            }
          }
        }
      }
    }
  }
  body
}

statusCheckRollup.state alone is not the CI verdict, and trusting it is a live bug. It does not count a suite whose conclusion is ACTION_REQUIRED, so a fork PR whose workflows have never been allowed to start still rolls up as SUCCESS off a third-party check such as socket-security or netlify. Measured on one sweep of the open queue, 19 of 82 PRs rolled up SUCCESS while the CI workflow sat unapproved. checkSuites is what tells the two apart, which is why it is in the query.

closingIssuesReferences only populates for real closing keywords (Fixes #N), which is the point: a PR that merely mentions an issue has not linked it.

3. The seven decisions

Has CI run, and did it pass?

Two questions, in that order. A red PR is not ready for a reviewer's time, and a PR that was never built is not ready either. It just looks readier.

Count the GitHub Actions check runs on the head commit. If it is zero, the rollup means nothing, whatever it says. statusCheckRollup aggregates check runs, not check suites. An Actions suite that produced no check runs contributes nothing to it, so the rollup falls through to whatever third-party checks remain, which on a fork PR is usually a green socket-security or netlify. That one mechanism produces every false green below:

what happenedsuite conclusionActions check runsrollup says
never approvedACTION_REQUIRED0SUCCESS
no workflow ever ranno suite at all0SUCCESS
failed before emitting a runFAILURE0SUCCESS

Measured on one sweep: 48 of 82 open PRs rolled up SUCCESS with zero Actions check runs, and only 18 had genuinely passed. Three were the last row, green in the rollup and failed underneath.

So query checkSuites { conclusion checkRuns { totalCount } app { slug } } and decide from that:

  • Zero Actions check runs, and a suite at ACTION_REQUIRED → CI is waiting on a maintainer, not on the author. Record "ci": "AWAITING_APPROVAL" and propose "approve_ci": true. Do not draft it. Nothing has failed, and the person who has to act is us. Approving is part of triage, because a PR nobody has allowed to build is a PR nobody can review, and it can sit that way for months.
  • Zero Actions check runs, and a suite at FAILURE → the workflow failed before it produced any check runs. Record "ci": "FAILED_TO_START" and propose "draft": true. This is a real failure wearing a green rollup, so say in the comment that the rollup is misleading.
  • Zero Actions check runs, and no Actions suite at all → on a fork PR this is almost always an expired approval, not a mystery. Record "ci": "APPROVAL_EXPIRED". Do not draft it and do not call it failed, and do not set approve_ci: there is no run left to approve, so it would resolve to nothing. What it needs is a push, and if the branch also conflicts the rebase it already needs is that push.

    GitHub deletes a workflow run that sits at ACTION_REQUIRED for about 30 days. So this state and AWAITING_APPROVAL are one condition at two ages, and the boundary is sharp. Measured on one sweep: every fork PR with a head commit 24 days old or newer still had an approvable run, every one 36 days or older had none, nothing fell in between across 49 PRs, and 442 of the repo's 444 pending runs were 29 days old or younger. The control is that 7 fork PRs older than 36 days did still have runs, all of them approved and executed at the time, because a run that executes persists.

    This is the argument for approving during triage rather than leaving it. On that sweep 49 of 82 unowned open PRs had never been built, and 30 of them were already past the point where anyone could approve them.

  • FAILURE → propose "draft": true, and name the failing tasks, not the checks.

    .claude/tools/triage ci-tasks <N>     # -> nest:test

    GitHub only names the workflow. On this repo that is main-linux, or a 90-character affected --targets=... string, and neither tells a contributor what broke. ci-tasks resolves the Nx Cloud pipeline behind the check and prints the failing task ids on stdout, with the cache status and run status on stderr. Put the task name in the open prose, since it is what the author acts on.

    The verb owns the credential, the server URL and the lookup chain, so do not improvise any of it. Three things it handles that are easy to get wrong by hand: an Nx Cloud pipeline cannot be found by a fork PR's head ref, because the branch is recorded as the pull request number; an aged-out pipeline returns 404 and means the data is gone rather than that nothing failed; and a run group with a criticalErrorMessage failed as infrastructure, so naming tasks would blame a contributor for our own breakage.

    It needs a credential. nx login --status from the workspace root says whether one is present, and nx login is interactive, so ask rather than running it yourself. Without one the verb says so and exits non-zero, and the honest fallback is to name the workflow and say the task names were not retrievable.

  • PENDING → do not draft. A PR mid-run is not a red PR.
  • SUCCESS with at least one Actions check run → the only case where green means green.

approve_ci runs contributor-authored code on our runners, so it is staged and human-approved like every other mutation here. apply resolves the run ids at apply time rather than reusing ones captured at staging, because any push to the PR supersedes them, and approving a stale id is a silent no-op that still lets the comment claim CI is running.

The tool refuses a record that sets approve_ci alongside ci: SUCCESS or ci: FAILURE. Those describe two different moments. If the run has not been allowed to start, its outcome is not knowable yet, and asserting it is the exact mistake this field exists to prevent.

CI moves while you triage. A sweep of 80 PRs takes long enough that runs start, finish and get superseded by a push underneath you. The ci field is a snapshot, not a promise, and a record staged an hour ago can be stale by the time it is approved. Re-check anything whose CI state decides the action, especially a draft, immediately before applying it.

A draft means the ball is with the author, and red CI is only one reason for that. Anything the author must do before a reviewer can usefully look is grounds for it: files in the diff that were never meant to ship, a change that is really two changes and needs splitting, a branch that cannot be read against current master. Draft it, say plainly what has to change, and let them mark it ready.

Say it as a statement, not a question. "Were these meant to ship?" invites a reply and leaves the PR sitting in the queue; "these should not ship, please drop them" is actionable and can be. A question is right when you genuinely do not know, and wrong when you do.

Never draft a PR that is already isDraft. Check first, or the record applies a no-op while the comment claims something that did not happen.

Can it merge?

A conflicting PR is not reviewable. The reviewer cannot see what the change actually does against current master, and the author has work to do that no review will tell them about.

  • mergeable: CONFLICTING → add blocked: needs rebase, which this repo already carries for exactly this, and record "mergeable": "CONFLICTING". Ask for the rebase in the open prose. This is one of the cases where the open prose earns real content, because the author has to act.
  • mergeable: MERGEABLE → nothing to do.

mergeable is computed lazily, and the first query always lies. GitHub returns UNKNOWN and only schedules the computation, so a single pass over a queue reports UNKNOWN for roughly half of it and finds no conflicts at all. Query, then query the UNKNOWN ones again. On one sweep the first pass returned 40 UNKNOWN out of 82 and the retry resolved every one, taking the conflict count from 16 to 35. The tool refuses to stage mergeable: UNKNOWN for this reason, and refuses CONFLICTING without the label.

Add mergeable and mergeStateStatus to the Step 2 fragment. mergeStateStatus is the finer signal: DIRTY is a real conflict, BEHIND only means the branch is out of date, and BLOCKED usually means a required check has not passed rather than anything wrong with the branch.

Is there a linked issue?

Check in order:

  1. closingIssuesReferences — a real GitHub link.
  2. The body for a Linear reference: an NXC-#### key or a linear.app/… URL. Linear links through the branch name or a body reference, not GitHub's own field, so a Linear-tracked PR shows nothing in step 1 and looks unlinked if you stop there.
  3. Neither → unlinked; go to the next decision.

No linked issue — should this PR exist?

This is the judgement, and it turns on who opened it:

  • A maintainer's PR needs no issue. They have the context; the PR is the record.
  • A community PR with no issue leans towards closing. Not because the code is wrong, but because nobody agreed the change should be made, and merging it commits the team to maintaining behaviour nobody asked for. Close with a comment that says exactly that and points at Discussions or an issue, so the author can come back with agreement rather than a rejected diff.
  • Unless it is a clear win. A one-line fix to an obvious bug, a typo, a dependency bump closing a CVE, a docs correction. The test is whether the change is self-evidently correct and self-evidently wanted — both, not either. If you would merge it without discussion, do not make the author file an issue first.

A close with no explanation on a first-time contributor's PR is the most expensive thing this workflow can produce. The comment does the work; references/replies.md in triage-issues has the voice to use.

Has it just gone cold?

A maintainer's own chore PR that nobody has touched for months is not waiting on anything. There is no reporter to disappoint, no contributor left hanging, and the author can reopen it in one click if they still want it. Leaving it open costs a slot in every future sweep; closing it costs nothing.

Close it when all of these hold:

  • the title is a chore (housekeeping, not a fix or a feature someone is waiting on)
  • the author is a maintainer
  • nothing has touched it for months, measured on updatedAt rather than when it was opened

Say in the comment that it went cold rather than that it was rejected, and that reopening is fine. The decision is "this is not happening right now", not "this was wrong".

Do not apply this to a community PR. A contributor cannot read a close as housekeeping, they read it as a rejection, and they have no standing to reopen. For those, the unlinked-PR judgement above is the one that applies.

Drafting a cold chore is the wrong move even when CI is red. A draft is for work that is coming back, and it just moves the PR out of sight without resolving it.

Has it already been done?

An old PR can be correct, green and pointless, because the thing it asks for landed while it waited. Closing it is kinder than leaving it open, and cheaper than a review that ends the same way.

Two places to look, both cheap:

Master, since the PR was opened. Take the PR's changed files under packages/ and list the commits that have touched those same files since:

CREATED=$(gh pr view <N> --repo nrwl/nx --json createdAt -q '.createdAt[0:10]')
git log --since="$CREATED" --format='%an | %s' --no-merges -- <the PR's changed files>

File overlap alone proves nothing. It is why the PR conflicts, not evidence that it is redundant, and on one sweep 42 of 79 open PRs had it. Filter out the repo-wide sweeps (chore(repo), chore(misc), the codemods) and compare intent: does a commit subject describe the same change the PR title does? That is the signal. On the same sweep, scoring shared words between the PR title and those commit subjects narrowed 42 candidates to 7, of which most were coincidence and one was real.

The rest of the open queue. Compare titles and touched paths across the PRs you are triaging. Duplicate pairs do not cross-reference each other, so nothing surfaces them except looking. One sweep found two pairs this way, both fixing the same defect at different layers.

Ask the linked issue what else references it. This is the cheapest and best of the three checks, and it catches what the other two structurally cannot:

gh api graphql -f query='query { repository(owner:"nrwl",name:"nx"){ issue(number:<N>){
  timelineItems(first:20, itemTypes:[CROSS_REFERENCED_EVENT]){ nodes{ ... on CrossReferencedEvent {
    source { ... on PullRequest { number state isDraft title author{login} } } } } } } } }'

Step 1 of this workflow filters to PRs with no assignee, so an assigned maintainer PR is never in your dataset, even when it targets the same issue as something you are triaging. The master scan does not see it either, because it has not landed. Only the issue knows about both.

Measured: #36043 from a contributor and #36651 from a maintainer both close #36036, and neither PR mentions the other, so nothing on either thread showed it. The sweep found nothing until the issue was asked.

In-flight overlap is not supersession, but it is not triage's call either. An open or draft PR covering the same ground has not landed, so triage must not close on it unilaterally. Say it in the open prose, because the contributor needs to know their review may end in a close through no fault of the diff, and assign the person driving the other PR.

They can then decide it supersedes, and that is a legitimate call triage was not entitled to make. When it goes that way, two things change from the merged case:

  • The linked issue stays open. Nothing has fixed it yet. Closing it alongside would tell the reporter their problem was solved when it has not been.
  • Say plainly that the other PR is unmerged, so the close reads as a decision about which shape to carry forward rather than as a verdict on the contributor's diff. They did real work and lost to a scheduling decision, which is a different thing from being wrong.

A superseded PR usually means a resolved issue. If the PR you are closing has a linked issue, the merged work that superseded the PR has probably satisfied that issue too, and leaving it open strands a request that has already been met. Read the issue, and if the landed work covers it, stage a second record closing it.

The close reasons differ, and the difference is the whole point:

  • The PR closes not planned. This implementation is not the one that landed.
  • The issue closes completed. The thing being asked for was in fact done.

Give the issue its own comment naming the PR that delivered it and the version it shipped in, which is what the reporter actually needs. git tag --contains <sha> gives you the version.

Read the issue before doing this rather than assuming it. An issue can ask for more than the PR would have delivered, in which case it stays open and the comment says what is still missing.

Verify before you close. A title match is a candidate, not a verdict. Read the PR's diff and the current state of the same code, and quote what you found. Closing a working PR on a wrong guess is the most expensive mistake available here, and the author has no way to tell a considered close from a careless one. When it is genuinely superseded, name the PR that replaced it and what it added, so the author can check for themselves and file an issue for anything it missed.

Who handles it?

Follow triage-shared/owners.md. The assignee is whoever is accountable for getting this PR over the line, which is not the same question as who reviews it:

  • A maintainer's own PR is assigned to them. They are already the person driving it to merge. Routing it to a co-owner "because an author cannot review their own work" invents a second owner for work that is already spoken for, and leaves the author's name off the thing they are actually responsible for. Finding a reviewer is their job, and it happens after triage.
  • A community PR goes to the scope owner — the maintainer who will review it, ask for what it still needs, and merge it. Never the contributor, who cannot do any of those things.
  • Continuity beats the rotation either way. A maintainer who has already reviewed a community PR owns landing it.

This is the same rule owners.md already applies from the issue side, where a linked PR authored by a maintainer assigns that maintainer. Do not read "an author is never their own reviewer" — true, and irrelevant here — as a reason to route a maintainer's PR elsewhere.

It also dissolves a routing dead end: scope: repo, scope: devkit, scope: plugins and scope: dotnet each have exactly one configured owner, so excluding the author left those rows unable to produce anyone at all.

4. Stage it

{
  "issue": 36846,
  "kind": "pr",
  "title": "fix(core): handle scoped outputs",
  "add_labels": ["scope: core"],
  "assign": "FrozenPandaz",
  "author": "StalkAltan",
  "author_assoc": "MEMBER",
  "ci": "FAILURE",
  "linked": "none",
  "draft": true,
  "comment": "…",
  "rationale": "…"
}

kind: "pr" is what routes the apply step to gh pr edit / gh pr ready --undo / gh pr comment / gh pr close. It is validated, not coerced: a typo fails loudly rather than quietly applying issue verbs to a pull request.

ci and linked are recorded rather than re-derived so the reviewer approving a draft-or-close sees the evidence the judgement rested on without going to GitHub.

The record number is the PR number. GitHub numbers issues and PRs from one sequence, so a PR record and an issue record can never collide, and both appear in the same queue and the same review pane.

Everything from here — staging as you go, the review pane, feedback, apply — is triage-shared/staging.md.

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.