npx skills add ...
npx skills add brave/brave-core --skill review-prs
npx skills add brave/brave-core --skill 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 cron. Triggers on: review prs, review recent prs, /review-prs, check prs for best practices.'
Scan recent open PRs in the configured PR repository for violations of documented best practices.
auto argument): posts all violations automatically without
approval. 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:
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:
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 stdout
for cron logsprs: array of PRs to review, each containing:
number, title, headRefOid, author, hasApprovalsubagent_prompts: array of entries with prompt_file and results_file
paths (NOT prompt text)cached_prs: already-reviewed PRs (handled by prepare script — just log
results)errors: per-PR errors encountered during preparationPrint the progress_lines. Log any errors.
For each cached PR, log:
approved is true:
APPROVE: [PR #N](url) (title) - all threads resolved, approvedthread_resolution.unresolved_bot_threads > 0:
CACHED: [PR #N](url) (title) - N threads still unresolvedIf 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:
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:
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>](https://github.com/$PR_REPO/pull/<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:
$PR_REPO to track the fix: