Skip to content

Improve: review-pr skill — mechanism brief, traceability, multi-source goal#973

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
hw-native-sys-bot:improve/review-pr-skill
Jun 3, 2026
Merged

Improve: review-pr skill — mechanism brief, traceability, multi-source goal#973
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
hw-native-sys-bot:improve/review-pr-skill

Conversation

@hw-native-sys-bot
Copy link
Copy Markdown
Collaborator

Summary

Hardens .claude/skills/review-pr/SKILL.md so a review on a large
design-heavy PR cannot get away with bug-spotting alone.

Three structural additions, three sharpened existing steps:

  • Step 4 — multi-source stated goal. The stated goal can come from
    (1) the user's natural-language description in the /review-pr
    invocation, (2) a linked GitHub issue / design doc, (3) PR body, or
    (4) commit messages. User description outranks PR body so the common
    failure mode — author silently narrowing the goal in their own
    description — gets surfaced as a finding instead of silently
    inherited.
  • Step 5.5 Mechanism Brief. Required for PRs over ~500 lines.
    Forces the reviewer to lay out data structures, lifetime, concurrency
    model, and cross-boundary contracts before judging. Skipping it on a
    large PR makes the rest of the review unreliable.
  • Step 5.7 Goal-Method Traceability. A table mapping every stated
    goal to a specific design choice and code location, marked Solid /
    Underspecified / Weak / Missing / Implicit. ❌ Missing and ➕ Implicit
    rows are must-discuss before approval. Catches "the PR talks about X
    but never builds X" and "the PR builds Y that nobody asked for".
  • Step 6 Feature checklist 4 → 8. Adds stable-boundary discipline
    (version fields, reserved-field validation, deprecation path), error
    propagation across boundaries (string-matching error translations are
    bug magnets), concurrency model with contention testing, and
    alternatives considered.
  • Step 7 Verification before surfacing. Concrete git commands to
    catch the most common external-reviewer hallucination — citing code
    outside the PR diff as a PR finding. Also requires recording dropped
    findings in Step 8's output for audit.
  • Step 8 output structure updated to require Mechanism Brief and
    Traceability sections, plus the dropped-finding audit trail.
  • Common Pitfall Migrate AICore kernel compilation from C++ to Python and simplify DeviceRunner API #5 sharpened: never silently accept the PR body's
    framing when other goal sources are broader.

The skill grew from ~14.9 KB to ~22.0 KB (+242 / -21 lines).

Test plan

  • markdownlint-cli2 passes (already verified locally via
    pre-commit).
  • Skill executes cleanly via /review-pr <PR> all on a large PR —
    confirmed against PR Add: L3/L2 host-device mapped region design #861 across three iterations during
    development; each successive skill revision caught a class of
    finding the prior revision missed.

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d3a10ffb-b00e-450b-8961-800267ac3455

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR updates the review-pr skill workflow to establish user-stated goals from /review-pr invocations as the highest-priority goal source, refactors multi-source goal extraction with explicit discrepancy recording, adds goal-method traceability and mechanism brief artifacts, strengthens feature validation checks, filters external findings with verification requirements, and refines output structure with audit trail requirements.

Changes

review-pr Skill Workflow Enhancement

Layer / File(s) Summary
User-stated goal prioritization
.claude/skills/review-pr/SKILL.md
Introduces optional "User-stated expected goal" section explaining that /review-pr natural-language input ranks as the top-priority stated-goal source above PR body, with an example showing user invocation overriding lower-priority PR framing.
Multi-source goal extraction and stated vs. real derivation
.claude/skills/review-pr/SKILL.md
Refactors Step 4 to extract stated goals from prioritized sources (user invocation, linked issues/docs, PR title/body, commit messages) with linked-reference reading emphasis; introduces "Producing the Stated Goal" procedure to formally choose the most ambitious coherent source and record narrower sources as discrepancies; updates Step 5 to independently derive real goal from diff and compare against stated goal without silent reconciliation.
Goal-method traceability and mechanism brief artifacts
.claude/skills/review-pr/SKILL.md
Adds Step 5.5 Mechanism Brief requirements (for large PRs) and mandates Step 5.7 Goal-Method Traceability table that maps each stated goal to specific design choices and code locations, with explicit ✅/⚠️/❌/➕ row semantics (completion, concerns, gaps, additions) handled as must-discuss, should-fix/consider, or documented completion before approval.
Strengthened feature validation checklist
.claude/skills/review-pr/SKILL.md
Expands Step 6 Feature checklist with additional required validation: stable-boundary discipline (versioning/reserved field/deprecation story), error propagation path tracing (including translation rules), concurrency model enumeration (invariants and contention testing expectations), and alternatives-considered rationale.
External finding verification before surfacing
.claude/skills/review-pr/SKILL.md
Adds detailed "Verification before surfacing" filter for external reviewer (codex/gemini) findings, requiring verification that claimed code exists in the PR diff and concrete evidence for missing-test, race/thread-safety, and memory-leak claims before inclusion in findings.
Output structure, Issues Found categorization, and audit trail
.claude/skills/review-pr/SKILL.md
Updates Step 8 guidance to specify how to present stated vs. real goals, when to include mechanism brief, and how to present goal-method traceability table (verbatim, with folding rules); refines Issues Found severity descriptions (must/should/consider) to include traceability-row types; mandates Independent Reviewer Notes include both verified findings and dropped findings with one-line reasons as audit trail.
Goal framing guardrails and pitfall prevention
.claude/skills/review-pr/SKILL.md
Strengthens Common Pitfalls guidance to explicitly forbid silently adopting PR body's narrower goal framing when other sources indicate broader/different scope, requiring reviewers to ask whether stated goals X vs Y align with intended scope before proceeding.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A PR workflow refined with care,
Where user goals claim the highest chair,
Stated versus real now plainly traced,
With traceability tables neatly placed,
And guards against the narrowing snare!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately summarizes the three main structural additions to the review-pr skill: mechanism brief, traceability table, and multi-source goal handling.
Description check ✅ Passed The description is highly relevant, providing a detailed summary of changes with structured explanations of each modification, test plan, and context about why the changes strengthen the skill.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the PR review skill instructions (SKILL.md) to refine the review process. Key additions include prioritizing user-stated goals over the PR body, introducing a "Mechanism Brief" and a "Goal-Method Traceability" table, adding detailed analysis criteria (such as stable-boundary discipline and error propagation), and establishing a verification step to filter out hallucinated external reviewer findings. The review comments suggest improvements to the Markdown formatting of a table and replacing shell-unsafe placeholders (like <N> and <path>) with safer variable or path placeholders to prevent literal execution errors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread .claude/skills/review-pr/SKILL.md Outdated
Comment thread .claude/skills/review-pr/SKILL.md
Comment thread .claude/skills/review-pr/SKILL.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.claude/skills/review-pr/SKILL.md (1)

148-157: ⚡ Quick win

Prefer “most authoritative intended goal” over “most ambitious” wording.

The “most ambitious / most authoritative” phrase can push reviewers toward scope inflation. Rephrase to prioritize intended/approved scope from authoritative sources, then treat broader claims as discrepancies.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/review-pr/SKILL.md around lines 148 - 157, Update the
guidance in the "Stated Goal" section by replacing the phrase "most ambitious /
most authoritative" with "most authoritative intended goal" and adjust the
following sentence to instruct authors to prioritize the intended/approved scope
from authoritative sources, while explicitly recording broader claims as
discrepancies; specifically edit the text that currently reads 'Write your
Stated Goal section using **the most ambitious / most authoritative** source...'
and ensure the notes about tracking narrower sources (the bullet points
referencing user/PR/issue scope differences) remain but frame broader or
inflated claims as discrepancies to track.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/review-pr/SKILL.md:
- Around line 116-127: Update the "Sources, in priority order" section so linked
issue/design doc text is higher precedence than the `/review-pr` invocation:
reorder the list so "Linked GitHub issue or design doc" appears above "User's
natural-language description in the `/review-pr` invocation" while keeping the
PR body and user input still present (user input should remain above PR body but
below the linked issue/design doc); modify the numbered items under the "###
Sources, in priority order" heading to reflect this new precedence and adjust
any accompanying wording that refers to the current order.

---

Nitpick comments:
In @.claude/skills/review-pr/SKILL.md:
- Around line 148-157: Update the guidance in the "Stated Goal" section by
replacing the phrase "most ambitious / most authoritative" with "most
authoritative intended goal" and adjust the following sentence to instruct
authors to prioritize the intended/approved scope from authoritative sources,
while explicitly recording broader claims as discrepancies; specifically edit
the text that currently reads 'Write your Stated Goal section using **the most
ambitious / most authoritative** source...' and ensure the notes about tracking
narrower sources (the bullet points referencing user/PR/issue scope differences)
remain but frame broader or inflated claims as discrepancies to track.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e49b55e-7bca-436e-9506-fff480679432

📥 Commits

Reviewing files that changed from the base of the PR and between d61dee4 and f19c3d1.

📒 Files selected for processing (1)
  • .claude/skills/review-pr/SKILL.md

Comment thread .claude/skills/review-pr/SKILL.md
…e goal

Adds three steps that the bug-hunting checklist alone could not produce:

- Step 4 reworked to accept stated goals from multiple sources, ranking
  user-provided description (in the /review-pr invocation) above the PR
  body. Catches the failure mode where authors silently narrow the goal
  in their own description.
- Step 5.5 Mechanism Brief — required on PRs over ~500 lines. Forces the
  reviewer to demonstrate they understood the design (data structures,
  lifetime, concurrency, cross-boundary contracts) before judging it.
- Step 5.7 Goal-Method Traceability table — every stated goal maps to a
  specific design choice and code location, marked Solid / Underspecified
  / Weak / Missing / Implicit. ❌ Missing and ➕ Implicit rows become
  Must-fix findings.
- Feature checklist extended from 4 to 8 questions (stable-boundary
  discipline, error propagation paths, concurrency model with
  contention testing, alternatives considered).
- Step 7 adds a "Verification before surfacing" subsection with concrete
  git commands to catch the most common external-reviewer hallucination
  (citing code outside the PR diff as a PR finding).
- Step 8 output structure updated to require Mechanism Brief and
  Traceability sections, plus a dropped-finding audit trail for external
  reviewers.
- Common Pitfall hw-native-sys#5 updated: never silently accept the PR body's framing
  when other goal sources are broader.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ChaoWao ChaoWao force-pushed the improve/review-pr-skill branch from f19c3d1 to e54a499 Compare June 3, 2026 00:52
@ChaoWao ChaoWao merged commit 4898057 into hw-native-sys:main Jun 3, 2026
14 checks passed
@ChaoWao ChaoWao deleted the improve/review-pr-skill branch June 3, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants