When preparing to send a Pull Request for review, invoke separate, concurrent sub-agents (invoke_subagent), where each sub-agent focuses exclusively on its assigned checklist category.
CRITICAL: Do NOT use a single sub-agent to validate multiple or all dimensions at once. Each sub-agent must be launched with its own distinct prompt file from .agents/skills/review-code/:
Starlark / Bazel Sub-Agent (Role: "Starlark Code Auditor"):
.agents/skills/review-code/review-starlark-prompt.md*.bzl, BUILD, *.bazel files) in git diff against .agents/rules/bzl.md and Starlark rules in AGENTS.md.Python Code Sub-Agent (Role: "Python Code Auditor"):
.agents/skills/review-code/review-python-prompt.mdgit diff against .agents/rules/python.md and Python and pytest conventions in AGENTS.md.Documentation Sub-Agent (Role: "Documentation Auditor"):
.agents/skills/review-code/review-docs-prompt.md.md) changes and docs build targets against .agents/rules/docs.md and AGENTS.md.Contribution Guidelines Sub-Agent (Role: "Contributing Auditor"):
.agents/skills/review-code/review-contributing-prompt.mdCONTRIBUTING.md.Project Conventions Sub-Agent (Role: "Project Conventions Auditor"):
.agents/skills/review-code/review-agents-prompt.mdAGENTS.md.Pull Request Standards Sub-Agent (Role: "PR Standards Auditor"):
.agents/skills/review-code/review-pr-standards-prompt.mdCONTRIBUTING.md, and open questions or “TODO / Things we could do” items in the PR description (ensuring the "do not merge" label is applied when open questions exist).GitHub Workflows Sub-Agent (Role: "GitHub Workflows Auditor"):
.agents/skills/review-code/review-workflows-prompt.md.github/**) and workflow tests against .agents/rules/github_actions_workflows.md (e.g. chmod +x executable permissions, shebangs, action and tool versions, ./.github/actions/setup-bazel wrapper usage, fallback jobs, and shell, script, CLI flag, $GITHUB_OUTPUT, or workflow-command injection vulnerabilities).rules_python Usage Sub-Agent (Role: "rules_python Usage Auditor"):
.agents/skills/review-code/review-rules-python-prompt.md.agents/rules/rules_python.md (e.g., pip.dep() declarations in MODULE.bazel and MINIMUM_BAZEL_VERSION bounds).News Entry Sub-Agent (Role: "News Entry Auditor"):
.agents/skills/review-code/review-news-prompt.mdnews/<id>.<category>.md files for presence, naming (no generic 0000 placeholders), brevity and skimmability, and formatting against .agents/rules/news.md and .agents/skills/create-news/SKILL.md.Code Style & Architecture Sub-Agent (Role: "Code Style & Architecture Auditor"):
.agents/skills/review-code/review-code-style-prompt.md*.py, *.rs, *.sh, *.cc, *.h, *.go, *.bzl, *.bazel): file definition order, guard clauses, fail-closed else, single input form, no unrequested knobs/aliases, no speculative validation or defensive None checks, no nested comprehensions, naming precision, simplification, keep-sorted markers, and CLI safety annotations.Shell Script Sub-Agent (Role: "Shell Script Auditor"):
.agents/skills/review-code/review-shell-prompt.md*.sh, git hooks, and inline shell scripts against .agents/rules/shell.md and .agents/rules/code-style.md (long flags and commented short flags, direct shebang invocation, GNU getopt --name, (set -x; ...), Modifies: doc sections, no blind || true, and no $? checks under set -e).Justification & Exception Sub-Agent (Role: "Justification & Exception Auditor"):
.agents/skills/review-code/review-justification-auditor-prompt.mdsys.path/ImportError probing, lint/type/buildifier suppressions, custom timeouts/retries, or review replies claiming a rule does not apply), rejecting missing, circular, or inaccurate excuses as SHOULD-FIX and flagging plausible technical constraints as HUMAN-SIGN-OFF.Rust Sub-Agent (Role: "Rust Code Auditor"):
.agents/skills/review-code/review-rust-prompt.md*.rs, crates/**) and crate dependencies in MODULE.bazel / Cargo.* against .agents/rules/rust.md (standard ecosystem crates over custom subsystems such as regex or ZIP handling, crate legitimacy and latest crates.io versions, feature pruning for cross-compilation, library crate structure, and rustfmt).Immediately create a user-facing review artifact named code-review-results.md in the conversation artifact directory so progress is visible right away.
Have sub-agents run git diff $(git merge-base HEAD upstream/main) to audit committed and uncommitted branch changes without newer upstream/main commits.
Launch all sub-agents concurrently using invoke_subagent.
Update code-review-results.md as sub-agent responses come in, applying the Synthesis & Anti-Noise Gate (below) and omitting all passing-check prose. Do not use bold for the introduction or lead-in of a bulleted list or bullet item; use bold for any questions the user needs to answer. Structure code-review-results.md as follows:
# Code Review: <Target / PR> Verdict: `<PASS | NEEDS_FIXES | NEEDS_HUMAN_SIGN_OFF>` (<N> open, <H> needing human sign-off, <M> resolved) ## Open Issues ### <ID>. [<SEVERITY>] <Short title> — [<file>:<line>](file:///...) * Problem: <1-2 sentences stating what is wrong and why.> * Proposed Fix: ```<lang> <replacement snippet or diff> ``` * Draft Comment: `<comment text in user's voice>` * Author Response: <If the author replied to this comment thread, quote or summarize their response here, bolding any question to answer.> * Draft Reply: `<proposed reply in user's voice, if applicable>` ## Resolved Issues * ~~<ID>. [<SEVERITY>] <Short title> ([<file>:<line>](file:///...))~~ — Resolved: <How it was fixed or resolved (e.g., fixed in commit N, updated in working copy, or dismissed per reviewer).> ## Passing Domains <Comma-separated list of audited domains with 0 issues>
Whenever an open issue in code-review-results.md is resolved (via local edit, a new commit, or reviewer decision), move it from ## Open Issues to ## Resolved Issues (never delete it) and record how it was resolved.
If the PR author posts a question or reply requiring reviewer input on a comment thread, record their response (* Author Response: ...) and a proposed * Draft Reply under the corresponding issue in code-review-results.md, then prompt the user via ask_question (including a clickable [code-review-results.md](file:///...#L<start>-L<end>) link in the question prompt text).
Never auto-resolve a rule exception solely because the author added a justification comment or reply. Whenever a justification is present or added, use the Justification & Exception Auditor to evaluate it, rejecting weak or inaccurate justifications as SHOULD-FIX and keeping plausible justifications open as [HUMAN-SIGN-OFF] until the user explicitly signs off.
Once all sub-agents finish, finalize code-review-results.md and provide a concise summary with the overall verdict and a clickable markdown link to code-review-results.md in the response.
If reviewing a PR belonging to another user and at least one net-new candidate comment remains after the Anti-Noise Gate, prompt the user via ask_question (including a clickable [code-review-results.md](file:///...) link in the question prompt text) to choose whether to:
If reviewing or re-reviewing a PR belonging to another user and the verdict is PASS (0 open issues and 0 net-new candidate comments) while the PR is not yet approved by the user, prompt the user via ask_question (including a clickable [code-review-results.md](file:///...) link in the question prompt text) to choose whether to:
Immediately before posting comments (after ask_question returns), re-fetch the latest PR description, commits, and review comments (gh pr view), move any issues addressed in the interim to ## Resolved Issues in code-review-results.md, and drop their candidate comments.
When posting comments or replies to a PR, append an italicized disclosure line at the end of each comment: *This is an agent-generated comment reviewed and approved by the user.* if the user reviewed and approved posting the comment, or *This is an automatically generated agent comment.* if posted without user review.
When aggregating sub-agent findings into code-review-results.md and before posting comments, filter out noise:
.bzl, BUILD, *.bazel). Starlark has no is operator (== None is correct), freezes default arguments (mutable defaults are safe), accepts # @unused or # buildifier: disable=... suppressions, and prefers explicit len() checks. Do not suggest Python stdlib functions.*requirements*.txt, gazelle_python_manifest.yaml, or patches). Only flag build breakages or license issues.buildifier, ruff, or rustfmt quote/comma/order changes, trailing newlines, or markdown hard-break backslashes).TODO Syntax: Do not complain about TODO(...) formatting or demand a username or issue number. Drop TODO syntax nits entirely.**kwargs, or enforce explicit types when duck-typing is the established pattern.QUESTION (“Does X do Y here?”) rather than a factual assertion.