Skill v1.0.3
currentAutomated scan100/100~6 modified
name: rocm-pr-quality description: Author, review, merge-gate, or check attestation of a ROCm library PR so it is traceable, tested, and safe to merge. Use when preparing or reviewing a PR or judging merge-readiness. Library-agnostic; overlays extend it. argument-hint: '[author | review | pre-merge | check-attestation] [PR URL | branch:<name> | local] [base:<branch>]' allowed-tools: Bash, Read, Grep, Glob, Task, WebFetch metadata: version: "1.0.3"
ROCm PR Quality (base)
This is the library-agnostic base skill for PR quality across ROCm. It exposes four actions the user invokes with a single sentence; the skill does the legwork through the tools already on the desk (gh, the repo, and Jira/GitHub MCPs when available).
- Author assist — "help me write a PR worth reviewing."
- Review assist — "help me review this PR well."
- Pre-merge gate — "is it actually safe to press merge right now?"
- Check attestation — "has this PR been reviewed by the skill?"
Pick the action from the user's request. If it is ambiguous, ask which one they want.
Detailed rubric tables, the PR description template, change classes, the test-level map, waiver codes, and the MUST set live in reference.md in this directory. Read it before running an action. The style guide for written artifacts (PR descriptions, review comments, handoffs) lives in prose-style-context.md, also in this directory. Read it before drafting or rewriting any prose.
Operating principles
- Paved road, not compliance cop. The goal is to make the high-quality path the easy
path. Be the helpful senior reviewer, not the gate guard. "Easy = used" is the point.
- Never write to external systems without explicit human approval. Do not post PR
descriptions, review comments, issue/ticket comments, labels, or merges to GitHub or Jira on your own. Draft the text, show it, and wait for the user to approve or edit. This applies even when the user says "review the PR" — you produce the review, the human posts it.
- Advisory first. This skill raises the floor; it does not approve and it does not
block a merge by itself. Hard enforcement (a required CI status check, a merge queue) is a separate, DevOps-owned lane. Do not assume it exists.
- Conform to the machine gate; it outranks this skill. The repo's contributing guide is the
source of truth for PR policy, but when a machine gate enforces it — a policy bot, a required status check that parses the branch/title/description, a merge queue — that gate is the hoop a PR must actually clear, so make the PR conform to it before anything else. Both the guide and the gate outrank this skill; it defers to them and never works around the gate. A machine gate honors none of this skill's waivers or self-evident exemptions, so where they disagree the gate wins. When you advise the author to do something solely to satisfy the gate that is not in the contributing guide, say so explicitly so they know the requirement came from the gate, not the guide.
- Follow the repo's own standards. When a component repo ships its own
testing/contributing/standards docs (e.g. CONTRIBUTING.md, a docs/testing*.md, a per-repo best-practices file), read and apply them rather than inventing guidance. The skill checks that repo standards are followed; it does not replace them. In particular, ROCm components are rolling out a standard `TESTING.md` — a per-component testing-strategy doc (piloted by hipBLASLt: projects/hipblaslt/TESTING.md and projects/hipblaslt/tensilelite/TESTING.md in rocm-libraries) naming what actually gates a merge versus what is informational, its test tiers, and its known gaps. Where one exists — check the repo root, then walk up from each changed path to the nearest component-level copy — it is the canonical source for testing questions on that component; see "Discover the component's TESTING.md first" in reference.md. Its absence is not a blocker (rollout in progress); fall back to CI-config discovery and this skill's generic guidance instead.
- Discover, do not hardcode. Supported architectures, CI labels, test lanes, and
tracker prefixes drift. Discover them from the repo and CI config at run time.
- Evidence over assertion. Ground every finding in a
file:line, a CI link, a diff
hunk, or a resolved tracker. Do not invent test results or completed runs.
How overlays extend this base
Each ROCm library may publish a thin overlay skill (e.g. hipblaslt-pr-quality) that depends on this base. Overlays may add rules, tighten thresholds, and bind rules to component paths. Overlays may not weaken a base MUST-rule. On any conflict, the base MUST-rule wins.
When invoked through an overlay, read this base first, then apply the overlay's supplements on top.
Shared concepts (used by all four actions)
Change classification (extensible; multiple tags allowed)
Map touched paths + intent to one or more change classes. A PR may carry more than one tag (e.g. defect-fix + kernel/tuning). When ambiguous, pick the stricter class.
Base classes: new-public-api, new-op/dtype/path, heuristic/default-selection, kernel/tuning, build/ci, docs, revert, defect-fix, regression-test-only, other. Overlays may add component-specific classes. The class drives the test/flag bar (see reference.md).
The MUST set (M1–M5, non-overridable by overlays)
- M1 Defect-fix PRs include a regression test, or a tracked two-PR known-bug plan.
- M2 Product-code changes carry tests, a safe-default flag, or a written waiver.
- M3 Never disable, skip, or weaken tests solely to green CI. (hard MUST — no waiver.)
- M4 Non-trivial PRs carry work tracking (ticket, public issue, or credible no-tracker reason).
- M5 PRs link the artifacts they relate to (work-tracking item, the defect they fix,
directly related PRs), and those links must resolve.
M2, M4, M5 are escape-hatch MUSTs: waiver-able with an explicit written reason that a reviewer adjudicates. M1 is waiver-able only via the tracked two-PR plan. M3 has no waiver.
Waivers (author-declared, reviewer-adjudicated)
An exception is never a silent self-override. The author declares a waiver code + a one-to- two-sentence reason (and any required approver); the reviewer accepts (APPROVED, with the waiver recorded) or rejects a weak one (CHANGES REQUESTED). A bare "N/A" is not a waiver — "why" is mandatory even when the rule is waived. Higher-risk waivers need a named approver. Waiver codes are in reference.md.
Waivers govern the human review floor only. They do not override a machine-enforced policy gate (see "Conform to the machine gate" in the operating principles): conform to that gate regardless of any waiver this skill would otherwise allow.
Test substance — the mutation question (and the "why")
Presence of tests is not enough. For 2–3 sampled tests ask: what specific change to the source would make this test fail? If the answer is hand-wavy, it is coverage padding. Smell scan: assert-callable-only, hasattr-guarded bodies, lone is not None/.called assertions, copy-paste that should be parametrized, mock-only assertions that pass against a no-op, and phantom methods that do not exist in the source. A smell is a prompt to inspect behavior, not a verdict: it is BLOCKING only when it demonstrates a missing guarantee (the test passes against a no-op, asserts nothing about behavior, or cannot fail). Duplication or a missing rationale alone is SUGGESTION; see reference.md.
Also ask for the rationale behind non-obvious test choices: where did this tolerance value come from, why this parameter combination and not another? A short paper trail prevents the "author is long gone, nobody knows why this test exists" problem. Prompt the author to record it; flag its absence on non-obvious numeric tolerances or parameter sets.
Blast radius & device/architecture coverage
Judge from what the diff actually changes, not the file's path. Decide whether the change is architecture-independent (wiring/plumbing with no kernel-selection/default/support-surface change → standard CI is enough), behavior-shifting (defaults/dispatch → multi-arch run warranted), arch-scoped (only the affected devices), or support-surface-expanding (full sweep). Kernel/device code generally needs cross-device coverage; host-only code often does not. Discover the supported architecture/label set from the repo's CI config; do not hardcode it. Do not over-escalate: an arch-independent change covered by passing CI needs no sweep, and saying so is a valid outcome.
CI labels: what is acceptable
CI labels decide what CI actually runs, so they are part of a PR's testing. Choosing and checking them is the job of the standalone `pr-ci-labels` skill, which owns the label sources, the selection rules, and the tool that shows which labels each run used. This skill sets the quality bar:
- Minimal safe CI. A PR should carry the smallest label set that still covers everything the
diff can reach, plus whatever GPU families it needs. Too much CI is a cost, not a defect.
- Labels are not tests. They never satisfy M2, and narrowing CI so a red run turns green
violates M3.
- Narrowing moves risk to the author. If a narrowed PR breaks the base branch, a downstream
project, or a downstream submodule bump, the author owns the revert: revert first, then fix.
- Record the choice. The PR description lists the labels with a one-line reason for each.
Review severities and the pre-merge bypass rule are in "CI labels (quality policy)" in reference.md.
Risk level (1–5)
Take any user-provided hint, then independently evaluate the diff. 1 = docs/comments/metadata only; 2 = narrow low-blast-radius change, good coverage; 3 = core subsystem / new feature path / schema-API addition / dispatch-build-test infra; 4 = broad behavior change, compat-sensitive public API, perf-critical path, incomplete coverage; 5 = cross-project/architectural, default behavior change in a critical path, ABI break, large unproven refactor, known unresolved failures. Residual coverage gaps (a required sweep that has not passed) raise the level.
Pick the level through the seven-factor risk-dimension lens in reference.md (component criticality, historical regression risk, blast radius, sensitive-path exposure, code churn, test-coverage delta, release-phase timing). The required validation floor for that level should come from the component's discovered TESTING.md first — its own documented tiers and what actually gates — falling back to the generic floor table in reference.md only when no TESTING.md covers the touched component.
Interlinking — every PR is an entry point
A PR should never be a dead end. From any artifact a reader should follow links outward to the why, the fix, the dependencies, and the predecessors. Forward links should resolve into reverse edges (GitHub back-references; Jira dev-panel auto-linking when the issue key is in the branch/PR title). M5 makes the core links mandatory; broader context (design docs, loosely related PRs) is a SHOULD.
Review attestation (approvals only)
When Action 2 concludes APPROVED, append the machine-checkable attestation block (see reference.md) to the drafted approval comment. Never attach it to CHANGES REQUESTED / REJECTED, and never to a PR description. It is part of the text the human posts; the skill still never posts on its own (operating principle 2). Take the Attestation digest from tools/pr_quality_check.py output; never compute or type it by hand. Explain the block in plain language when you add it: what it is, that it is tied to this PR (not to a commit, so later pushes are fine), and that a pre-review gate can key on it. If an approval was already posted without a block, hand the user the one-line paste form instead of the full block.
Never for your own PR. An attestation records an independent review, so the skill does not produce one for a PR the user authored. That covers Action 1 (never add one to the PR description or a comment on the user's own PR) and Action 2 when the user reviews their own PR. A self-review is still useful feedback; end it without the block and say why. Decide by comparing the PR's author (gh pr view <pr> --json author -q .author.login) with the user (gh api user -q .login). A person with more than one GitHub account is still the same person, so if the logins differ but the user says the PR is theirs, treat it as theirs; if you cannot tell, ask.
Prose and style for written artifacts (SHOULD)
A PR description is often the only explanation a reviewer reads. Apply `prose-style-context.md` to every PR description, review comment, handoff, and design note this skill drafts. It sets the voice (a mass-market magazine covering a technical subject), the reader (a smart engineer new to the component), the order of priorities (correctness, clarity including brevity, necessary context, elegance), a sentence-level gate with a cut check, a length that scales with the size of the change, a list of warning words that tend to stand in for a concrete fact, and evidence-and-scope rules for test and risk claims.
This is a SHOULD, not part of M1 to M5: it governs how findings and descriptions are written, and it never relaxes a MUST. Overlays may tighten it, for example by making the description rewrite below required rather than recommended. The repository's own PR template and any machine gate still decide which headings and tracker line the description must carry; keep them as written.
Recommend a rewrite, not just a critique. When this skill authors a description, run the draft through the sentence-level gate, the cut pass, and the final acceptance test before presenting it. When it reviews a description that fails the gate (an undefined term, a warning word with no fact behind it, a claim with no evidence or scope, repetition that hides the change), name the failed gate items and offer a specific rewrite the author can paste in. The rewrite is advisory and follows operating principle 2: show it in the chat and never post or edit anything on GitHub without approval.
Action 1 — Author assist
Goal: the author pushes a PR a reviewer can evaluate without archaeology, that already passes the obvious quality bar.
Required inputs (ask only for what cannot be discovered from the PR/branch/diff/repo): work-tracking reference (ticket / issue / prior PR / RFC / credible none), a risk hint, testing performed (groups, exact commands when known, status, devices for hardware tests, run/CI links), and the blast-radius/device-coverage picture. Accept N/A/none/not run as answers, but do not render empty N/A fields in the body.
Workflow:
- Detect any machine-enforced PR policy on this repo (a policy bot, required status checks) and
conform the branch name, title, description, and test layout to it first, since it is the gate the PR must clear and it outranks this skill's defaults and waivers. Flag any gate requirement not found in the contributing guide so the author knows where it came from.
- Inspect the diff:
gh pr view,gh pr diff,git diff --stat, targeted file reads. - Classify the change (one or more classes; stricter when unsure).
- Discover the nearest
TESTING.md(s) for the changed paths (repo root, then walk up from each
changed file's directory) — see "Discover the component's TESTING.md first" in reference.md. Use its documented tiers and its real-gate-vs-informational distinction to describe testing accurately in the Testing Summary/Checklist and Device/Architecture Coverage, and explicitly flag in the PR body if the change touches a documented Known Risk/Gap. Check which relevant tests PR CI will actually run and which checks are required (gh pr checks <PR> --required); for a relevant test CI will not run, record the local or manual run (command, devices, log/run link) in the Testing Checklist. If no TESTING.md exists for the touched component yet, fall back to the risk-dimension lens and CI-config discovery, and note the gap as a SUGGESTION.
- Choose the CI labels with the
pr-ci-labelsskill (its Suggest action) and record them, with
their reasons, in the Testing Summary. Draft the label commands; apply them only after the user approves, and before the PR is marked ready, so the first full run uses them.
- Scan branch name, commit messages, and diff for tracker keys, issue numbers, and referenced
PRs; pre-fill the Related section; prompt for anything obviously missing (e.g. "this fixes a defect — link the defect ticket").
- Check the test/flag/waiver obligation for the class (see
reference.md). If product code
changed, require at least one of: tests exercising the change, a safe-default flag guard plus a follow-up tracker, or a documented waiver. "Disable/skip/weaken tests to green CI" is never valid.
- Draft a complete PR description from the template in
reference.md, then run it through the
sentence-level gate, cut pass, and final acceptance test in prose-style-context.md and present the revised text. New PRs are draft by default; open ready-for-review only when the user explicitly asks.
- Prompt for the things authors skip: work tracking, flags for default-path/experimental
behavior, and adjacent tests ("what else exercises this code path that you should run?").
Output: a suggested PR title + body (Markdown), a per-step checklist (pass / warn / fail), the proposed CI labels with their reasons and drafted commands, and open questions for the author — all before the push. Do not create or edit the PR on GitHub unless the user explicitly approves the exact text. Never include a review attestation in the description or a comment on the author's own PR (see "Review attestation").
Action 2 — Review assist
Goal: a consistent, substance-focused review floor, so every reviewer checks the same fundamentals. Lead with findings ordered by severity, each grounded in file:line.
Setup: determine the repo root (git rev-parse --show-toplevel); inspect changed files (gh pr view --json ..., gh pr diff --name-only); save the full diff to a temp file rather than pasting it into the conversation; prefer local source for cross-reference (a review from a web diff alone has lower confidence). Do not modify files during review.
Workflow:
- Classify changed files into scope buckets (overlays define component buckets; generic buckets:
public API, core/runtime, build/CI, tests, docs/tooling).
- Run the rubric (
reference.md): scope, change class, work tracking, test/flag obligation,
work type, and any defect-specific extras (regression test + evidence, or a documented two-PR plan).
- Review for correctness, resource/memory ownership (leaks, RAII, lifetime on failure paths),
code reuse (flag copy-paste where a helper exists), and build/packaging where touched.
- Testing review is required every time, even when no test files changed. Do not equate "tests
added" with "behavior covered" — read assertions, run the mutation question, run the smell scan, and check the test "why" for non-obvious choices.
- Discover the nearest
TESTING.md(s) for the changed paths and reconcile the PR's testing
claims against them (see "Discover the component's TESTING.md first" in reference.md). A claim that a lane "passed"/"gates" the change when the doc marks that lane informational-only or a documented known gap is a finding (BLOCKING, per the finding-tiers table). For each relevant test, check whether PR CI runs it and whether it is required or informational; if CI does not run it, check that the PR description shows it was run and passed (IMPORTANT if missing). If the PR touches an area a Known Risks/Gaps row already names, check whether that row should be updated (closed, tightened, or left with a note) alongside the code change.
- Assess blast radius and device/arch coverage; reconcile what the content warrants against what
the PR actually tested/claimed. Flag gaps; do not over-escalate.
- Check the CI labels with the
pr-ci-labelsskill (its Check action), then grade what it finds
with the severities in "CI labels (quality policy)" in reference.md. Narrowing that drops coverage the diff can reach is BLOCKING; too much CI is only a SUGGESTION.
- Answer the four review questions explicitly: (1) what new/changed functionality lands,
(2) what test level is appropriate, (3) if tests/flags are omitted, is that acceptable (waiver?), (4) what adjacent tests should have been considered.
- Adjudicate any author-declared waiver: accept a well-justified one, reject a weak one.
- Read the PR description against
prose-style-context.md. When it fails the gate, list the
failed items as SUGGESTIONs and include a recommended rewrite (see "Prose and style for written artifacts").
Evidence-based review (CI validation). Treat CI as data, not a binary. Look at all CI runs on the PR, not only the one linked in the description — a green rollup can hide a skipped lane, a flaky retry that masked a real failure, or a required check that never ran. Where a baseline exists (the target branch's latest run, or the PR's own earlier run), compare against it: new failures, newly-skipped tests, and large step-timing deltas (a job that suddenly runs much longer or shorter) are signals worth a finding. Calibrate severity against this data instead of asserting risk — "this lane was green on the base and now fails here" is BLOCKING; "the build step is 3× slower" is at least IMPORTANT to ask about. Ground each finding in the specific run/step link.
Finding tiers (severity-ordered): BLOCKING / IMPORTANT / SUGGESTION / FUTURE WORK (see reference.md). Quick decision framework: correctness / security / incomplete cleanup of code being modified → BLOCKING; will bite users or developers soon → IMPORTANT; nice-to-have on code already being touched → SUGGESTION; genuinely out of scope for this PR → FUTURE WORK.
Overall assessment for the PR: APPROVED (policy met — may still carry documented, reviewer-accepted waivers and optional recommendations), CHANGES REQUESTED (one or more BLOCKING items: missing tests/flags/waiver, bad/absent tracking, a defect without a regression plan, or an unresolved correctness/security finding), or REJECTED (fundamental problem with the approach that needs rework). A valid, documented waiver does not block: that is APPROVED with the waiver recorded.
Optional delegation: for broad PRs, you may split the review by scope bucket via subagents and add cross-cutting testing/reuse passes; otherwise do a single-pass review.
Output: the overall assessment + the four answers + a severity-ordered findings list + a BLOCKING-items list + a short limits note naming the reviewed commit, any files or scope you did not review, and any validation you could not run (CI evidence unavailable, no local build). A worked example is in reference.md; evaluation fixtures are in evals.md. Only on request, and only after the user approves the wording, produce a draft request-changes comment. Never post it yourself. When the assessment is APPROVED and the PR is not the user's own, also produce the attestation block (see "Review attestation"). If the user is reviewing their own PR, give the review but no block, and say that the skill does not attest to a person's own PRs. Drafting the approval comment itself is on request, like the request-changes comment above; when you draft it, include the block as its trailer, otherwise hand the block to the user directly. Briefly explain it; if the user already approved without it, give them the one-line paste form. Never post either yourself.
Action 3 — Pre-merge gate
This is genuinely different from review: a PR can be approved and green and still be the wrong thing to merge at this moment. Run against an already-approved PR, immediately before merge. This is a final red/green sanity check the dev (or a team's merge group) can lean on — not a merge queue, and it does not force a CI rerun by default.
Criteria:
- Timing / risky moment. Discourage merging large or default-path changes when nobody is
around to babysit fallout — end of week, right before a holiday or freeze. This is timezone/region-aware: use the owning team's region (overlays configure it, e.g. a Calgary-based team) to decide "going into the weekend / end of day." Optionally, when calendar/Teams availability is reachable, check that a minimal set of people are online with enough hours left in the day. Advisory-with-teeth: a configurable "are you sure?", except where a freeze is in effect. Small/low-risk/revert PRs can be exempted.
- CI currency. An approved green can be hours or days old. Report when this PR's CI last
completed against a freshness policy (default SHOULD: flag beyond ~3 days). Whether a rebase + re-run is required vs recommended is a component SHOULD (overlays set it); the base does not force a rerun. Also confirm the green is real, not just a passing rollup summary (see "Evidence-based review" under Action 2): every required lane actually ran and passed, with no skipped/cancelled required check hiding under the green.
- CI not bypassed since review. Run
skills/pr-ci-labels/tools/ci_labels.py --pr <url>. A PR
whose every changed path CI skips on its own needs no tested run. Otherwise the report finds the last run that passed and actually built or tested (a ci:skip run also concludes success), and lists the commits and label changes since. Later commits that touch only paths CI skips on its own are fine: a docs-only commit plus ci:skip after a good run is a go. A later code change needs its own passing, tested run; without one it is a caution, or a hold if a narrowing label was added. See "CI labels (quality policy)" in reference.md.
- Adjacent-file / stale-base check on develop. Compare the PR's changed files against the
files the base branch changed since the PR diverged. No overlap → do not tax velocity, merge is fine. Overlap on high-coupling files (shared generators, register/lifetime code, shared components — overlays name them) → strong-recommend rebase + re-run. This catches the "both PRs individually green, the bug only exists combined" class that nothing compiled until after merge.
- Impacted open PRs (advisory). Optionally identify other open PRs that touch the same
high-coupling files and would be affected by this merge. You may draft a courtesy "consider rebasing" comment for those PRs — but never post it without explicit human approval.
- Validation floor met. For a Level 4–5 PR (or one whose discovered
TESTING.mdnames an
equivalent gate), confirm the sign-off it requires — named SME approval, or SME and QA/release sign-off — actually happened, not just that CI is green. See "Required validation floor by risk level" in reference.md.
Output: a go / caution / hold summary with the specific reason and the recommended action (e.g. "overlap on a high-coupling file — rebase + re-run before merge"). The decision stays with the human.
Action 4 — Check attestation
Read-only. Answers "has this PR been reviewed by the skill?" by looking for a review attestation (see "Review attestation") in the PR's conversation comments and review bodies. It never posts anything. Run it before relying on a claimed skill review, or from the pre-merge gate (Action 3) as one more input.
Run tools/pr_quality_check.py --pr <number|url> --check-attestation (add --json for machine-readable output). The exit status is the answer: 0 verified, 4 no attestation found, 5 an attestation is present but invalid. A block is valid when it records an APPROVED result and its digest matches this PR's own digest (see reference.md). A block copied from another PR, a template with a placeholder digest, or a non-approval block is reported as invalid, with the reason.
Report it plainly: the status, who posted the block (author and their association with the repo), when, and the reviewed commit with how many commits were pushed since. Later commits are allowed and are not a failure; mention them so a human can judge how much changed after the review. Flag a block that was posted by the PR's own author: the skill does not attest to a person's own PRs, so treat it as unreliable and say so. State the limit when it matters: the digest is a checksum, not a secret, so it shows the block was generated for this PR, not who ran the skill or that a review really happened. A verified attestation does not replace a human approval.
Operational notes
- Use
ghfor PR data, diffs, files, and CI status. Use the Jira/GitHub MCPs to look up and
validate tickets, issues, and related PRs.
- Save large diffs to a temp file; read focused sections rather than pasting everything.
- The optional shared checker
tools/pr_quality_check.pyperforms the deterministic subset of
the MUST checks (description sections, work-tracking presence, resolution of bare #refs only (full URLs are reported as unchecked), test-file-touched heuristic, CI currency, adjacent-file overlap). Pass --profile for an overlay's settings (therock, hipblaslt); the default base profile has no high-coupling file list. It is advisory; semantic judgments (test substance, M3) stay with the agent and the human. It also generates and verifies the review attestation digest (--check-attestation, Action 4).
- CI-label work goes through the
pr-ci-labelsskill and itstools/ci_labels.pyreport (label
timeline, whether passing runs built or tested, and commits since the last tested pass).