Reviews a pull request for idiomatic Rust, project conventions, and code quality. Use when asked to review a PR or when running as an automated PR reviewer.
95
95%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
Review a pull request to worktrunk, a Rust CLI tool for managing git worktrees.
PR to review: $ARGUMENTS
Load these skills first:
/reviewing-code — systematic review checklist (design review, universal
principles, completeness)/developing-rust — Rust idioms and patternsFollow these steps in order.
Before reading the diff, run cheap checks to avoid redundant work. Shell state
doesn't persist between tool calls — re-derive REPO in each bash invocation or
combine commands.
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
BOT_LOGIN=$(gh api user --jq '.login')
# Check if bot already approved this exact revision
APPROVED_SHA=$(gh pr view <number> --json reviews \
--jq "[.reviews[] | select(.state == \"APPROVED\" and .author.login == \"$BOT_LOGIN\") | .commit.oid] | last")
HEAD_SHA=$(gh pr view <number> --json commits --jq '.commits[-1].oid')If APPROVED_SHA == HEAD_SHA, exit silently — this revision is already approved.
If the bot approved a previous revision (APPROVED_SHA exists but differs from
HEAD_SHA), check the incremental changes since the last approval:
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
gh api "repos/$REPO/compare/$APPROVED_SHA...$HEAD_SHA" \
--jq '{total: ([.files[] | .additions + .deletions] | add), files: [.files[] | "\(.filename)\t+\(.additions)/-\(.deletions)"]}'If the new changes are trivial, skip the full review (steps 2-3) and do not re-approve — the existing approval stands. Still proceed to step 4 to resolve any bot threads that the trivial changes addressed, then exit. Rough heuristic: changes under ~20 added+deleted lines that don't introduce new functions, types, or control flow are typically trivial (review feedback addressed, CI/formatting fixes, small corrections). Only proceed with a full review and potential re-approval for non-trivial changes (new logic, architectural changes, significant additions).
Then check existing review comments to avoid repeating prior feedback:
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
gh api "repos/$REPO/pulls/<number>/comments" --paginate --jq '.[].body'
gh api "repos/$REPO/pulls/<number>/reviews" --jq '.[] | select(.body != "") | .body'gh pr diff <number>.Follow the reviewing-code skill's structure: design review first, then
tactical checklist.
Idiomatic Rust and project conventions:
? over
match-on-error, proper use of Option/Result, etc.)Code quality:
Correctness:
Testing:
After reviewing the code, check if any unresolved review threads from the bot have been addressed. For each unresolved bot thread, you've already read the file during review — if the suggestion was applied or the issue was otherwise fixed, resolve the thread:
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
BOT_LOGIN=$(gh api user --jq '.login')
OWNER=$(echo "$REPO" | cut -d/ -f1)
NAME=$(echo "$REPO" | cut -d/ -f2)
# Get unresolved bot review threads
gh api graphql -f query='
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes {
id
isResolved
comments(first: 1) {
nodes {
author { login }
path
line
body
}
}
}
}
}
}
}
' -f owner="$OWNER" -f repo="$NAME" -F number=<number> \
--jq '.data.repository.pullRequest.reviewThreads.nodes[]
| select(.isResolved == false)
| select(.comments.nodes[0].author.login == "'"$BOT_LOGIN"'")
| {id, path: .comments.nodes[0].path, line: .comments.nodes[0].line, body: .comments.nodes[0].body}'
# Resolve a thread that has been addressed
gh api graphql -f query='
mutation($threadId: ID!) {
resolveReviewThread(input: {threadId: $threadId}) {
thread { id }
}
}
' -f threadId="THREAD_ID"Outdated comments (null line) are best-effort — skip if the original context can't be located.
Submit one formal review per run via gh pr review. Never call it multiple
times.
gh pr comment — use review comments (gh pr review or
gh api for inline suggestions) so feedback is threaded with the review.When the PR has no issues worth raising:
gh pr review <number> --approve -b ""gh api "repos/$REPO/issues/<number>/reactions" -f content="+1"Code suggestions are the default format for specific fixes. Whenever you have a concrete fix (typos, doc updates, naming, missing imports, minor refactors, any change you can express as replacement lines), use GitHub's suggestion format so the author can apply it with one click:
gh api "repos/$REPO/pulls/<number>/reviews" \
--method POST \
-f event=COMMENT \
-f body="Summary of suggestions" \
-f 'comments[0][path]=src/foo.rs' \
-f 'comments[0][line]=42' \
-f 'comments[0][body]=```suggestion
fixed line content here
```'Rules:
start_line and line to define the range.a45fa7f
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.