brave/review-prs
'Review PRs in the configured PR repository for best practices violations. Supports single PR (#12345), state filter (open/closed/all), and auto mode for best practices.'
npx skills add https://github.com/brave/brave-core --skill review-prs
Scan recent open PRs in the configured PR repository for violations of
documented best practices.
before posting.
auto argument): posts all violations automatically withoutapproval. Designed for cron/headless use.
IMPORTANT: This skill only reviews PRs against existing best practices. It
must NEVER create, modify, or add new best practice rules or documentation
during a review run.
The review pipeline minimizes LLM token usage by pushing all heavy data through
files, not context:
writes subagent prompt files to a temp work directory; outputs a tiny JSON
pointer to the work dir
reviews the diff, validates violations by reading source code, writes results
to a JSON file
post-review.py which handles prioritization, dedup, posting, approval, and
notifications
The main LLM session only orchestrates: run scripts, read a small manifest,
launch subagents with tiny prompts, run the collector. It never sees diffs, rule
text, or violation details.
When invoked with
/review-prs [days|page<N>|#<PR>] [open|closed|all] [auto] [reviewer-priority]:
Run the prepare script with all arguments:
SKILL_DIR="<absolute path to .claude/skills/review-prs>"
python3 $SKILL_DIR/prepare-review.py [days|page<N>|#<PR>] [open|closed|all] [--auto] [--reviewer-priority]
The script's stdout is a tiny JSON with work_dir and manifest paths.
Progress and cost summary go to stderr.
Parse the stdout JSON to get work_dir.
Read the manifest file at {work_dir}/manifest.json. It contains:
auto_mode: whether to post without approvalbot_username: the bot's GitHub usernamepr_repo: the target PR repositoryfetch_summary: stats on how many PRs were fetched/filtered/skippedprogress_lines: pre-formatted progress messages — print these to stdoutfor cron logs
prs: array of PRs to review, each containing:number, title, headRefOid, author, hasApprovalsubagent_prompts: array of entries with prompt_file and results_filepaths (NOT prompt text)
cached_prs: already-reviewed PRs (handled by prepare script — just logresults)
errors: per-PR errors encountered during preparationPrint the progress_lines. Log any errors.
For each cached PR, log:
approved is true:APPROVE: PR #N (title) - all threads resolved, approved
thread_resolution.unresolved_bot_threads > 0:CACHED: PR #N (title) - N threads still unresolved
If no PRs to review (empty prs array), skip to Step 4.
For every PR in prs, for every entry in that PR's subagent_prompts, launch a
Task subagent (subagent_type: "general-purpose") with this prompt:
Read your full review instructions from: {prompt_file}
Execute them completely. The instructions contain the PR diff, best practice rules, review rules, and validation requirements.
After reviewing and validating, write your results JSON to the file path specified in the instructions.
Launch ALL subagents across ALL PRs in a single message so they run
concurrently.
CRITICAL: Launch ALL subagents — no exceptions. The prepare script already
filtered documents by file type. Every entry in subagent_prompts MUST get a
subagent. Do NOT skip any.
Wait for all subagents to return.
CRITICAL: NEVER post reviews, comments, or approvals to GitHub yourself. Do
NOT use gh api, gh pr review, gh pr comment, or any GitHub API calls to
post anything on any PR. All posting is handled exclusively by
collect-results.py → post-review.py in Step 4. If you post reviews directly,
it creates duplicates.
Run the collector script — it reads all subagent result files and runs
post-review.py:
python3 $SKILL_DIR/collect-results.py --work-dir "$WORK_DIR" [--auto]
Pass --auto if auto_mode is true.
The script handles everything: collecting violations from result files,
prioritization/capping (5 per PR), rule link validation, deduplication, posting
inline reviews, approval for clean PRs, cache updates, and the final summary
block.
For interactive mode (no --auto): instead of running collect-results.py
directly, read the result files yourself from
{work_dir}/pr_{number}/{chunk_id}_results.json, present each violation to the
user for approval, then write only approved violations back and run
collect-results.py.
Read the script's stderr — it contains the summary. Print it for cron logs.
| Phase | Token cost | Who does it |
| ------------------------------- | --------------------------- | --------------------------------------- |
| Fetch PRs, diffs, comments | Zero | prepare-review.py |
| Build subagent prompts (files) | Zero | prepare-review.py |
| Resolve threads, check approval | Zero | prepare-review.py |
| Read manifest, launch subagents | ~50 tokens per subagent | Main LLM session |
| Rule-checking + validation | Subagent tokens | Subagents (read prompt from file) |
| Collect results, post, approve | Zero | collect-results.py + post-review.py |
When displaying PR numbers, ALWAYS use a full markdown link:
PR #<number>. NEVER use bare
#<number> — the TUI auto-links them against the wrong repository.
When reviewing closed or merged PRs and a violation is found:
back to:
gh pr comment --repo $PR_REPO {number} --body "[file:line] comment text"
$PR_REPO to track the fix: gh issue create --repo $PR_REPO --title "Fix: <brief description>" --body "Found during post-merge review of PR #<NUMBER>. <description>"
Take brave/review-prs from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.