From workflow-cc-om
PR review using pr-review-toolkit specialized agents, senior verification, interactive triage, and GitHub inline comments
npx claudepluginhub ai-builder-team/ai-builder-plugin-marketplace --plugin workflow-cc-omThis skill is limited to using the following tools:
You are running an interactive PR review workflow for PR **#$ARGUMENTS**.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
You are running an interactive PR review workflow for PR #$ARGUMENTS.
ultrathink
gh repo view --json nameWithOwner --jq .nameWithOwner 2>/dev/null || echo "UNKNOWN_REPO"gh pr view $0 --json title --jq .title 2>/dev/null || echo "UNKNOWN_TITLE"gh pr view $0 --json author --jq .author.login 2>/dev/null || echo "UNKNOWN_AUTHOR"gh pr view $0 --json headRefOid --jq .headRefOid 2>/dev/null || echo "UNKNOWN_SHA"gh pr view $0 --json baseRefName --jq .baseRefName 2>/dev/null || echo "UNKNOWN_BASE"gh pr view $0 --json files --jq '.files.[].path' 2>/dev/null || echo "UNKNOWN_FILES"Before starting, verify:
--repo.Store the HEAD SHA and repo info — you will need them for the final API call.
Launch ALL pr-review-toolkit agents in parallel using the Task tool with run_in_background: true.
Agents to launch:
| Agent | subagent_type | model | Focus |
|---|---|---|---|
| Code Quality | pr-review-toolkit:code-reviewer | haiku | Bugs, security vulnerabilities, logic errors, API misuse, style guide compliance |
| Silent Failures | pr-review-toolkit:silent-failure-hunter | haiku | Swallowed exceptions, empty catch blocks, silent error suppression, inadequate fallbacks |
| Test Coverage | pr-review-toolkit:pr-test-analyzer | haiku | Test coverage gaps, test quality, missing edge case tests |
| Comments | pr-review-toolkit:comment-analyzer | haiku | Comment accuracy, stale/misleading docs, comment rot |
| Type Design | pr-review-toolkit:type-design-analyzer | haiku | Type invariants, schema design, encapsulation quality |
| Code Simplification | pr-review-toolkit:code-simplifier | haiku | Unnecessary complexity, readability improvements, over-engineering |
Skip pr-review-toolkit:type-design-analyzer if no new types or interfaces are introduced in the PR.
Prompt template for each agent:
Review PR #$ARGUMENTS in {REPO}.
PR description: {PR_BODY — fetch via
gh pr view $ARGUMENTS --json body --jq .body}Changed files: {CHANGED_FILES_LIST from PR Context above}
Get the full diff with
gh pr diff $ARGUMENTSand read the source files using the Read tool to understand surrounding context. Do not review the diff in isolation.Output format: For EACH issue found, output:
### F{N}: {one-line title} - **File:** {exact file path} - **Line:** {line number in the NEW version of the file} - **Severity:** critical | warning | nit - **Category:** {your specialty area} - **Description:** {detailed explanation — what's wrong, why it matters, what could go wrong} - **Suggested comment:** {the exact text to post as a GitHub inline comment — concise, constructive, specific}Do NOT flag:
- Style preferences (formatting, bracket placement) unless they cause confusion
- Missing documentation unless it's a public API
- "Nit" issues that don't affect correctness or readability
- Things that are clearly intentional and well-reasoned
If you find NO issues, say "NO_ISSUES_FOUND" — but you MUST justify this by listing the specific areas you examined and why each is clean. Do not just say "looks good". Example: "Checked error handling in X — all paths return or throw. Checked boundary conditions in Y — input is validated at line Z."
After all agents complete — consolidate findings:
Spawn a general-purpose subagent with model: "sonnet".
Prompt for Senior Reviewer:
You are a senior staff engineer performing the final verification pass on a PR review. Your job is to verify each finding against the actual code, calibrate severity, catch what the specialists missed, and produce the final review.
Your default stance is inclusion — a finding survives unless you can prove it's wrong. You are not here to argue the author's perspective or play devil's advocate. You are here to ensure the review is accurate and complete.
The PR: #$ARGUMENTS
Step 1: Run
gh pr diff $ARGUMENTSand read the relevant source files to independently understand the code. Also read the PR description withgh pr view $ARGUMENTS --json body --jq .body.Step 2: For EACH finding below, read the flagged code in its surrounding context and assign a verdict:
{INSERT CONSOLIDATED FINDINGS FROM PHASE 1 HERE}
Verdicts:
- confirmed — the finding is accurate as stated. Keep severity and comment as-is.
- escalated — the finding is real but the specialists understated the severity. Explain what they missed and upgrade the severity.
- downgraded — the finding is real but overstated. Adjust the severity downward and explain why.
- refined — the finding is directionally correct but the description or comment needs improvement. Provide an improved comment.
- dismissed — the finding is a false positive. You MUST cite the specific line(s) of code, type constraint, or framework guarantee that proves this is safe. Vague reasoning like "this is theoretical", "unlikely in practice", or "the author probably intended this" is NOT sufficient for dismissal.
For each finding, also consider:
- Does the surrounding code (callers, error boundaries, type system) make this safe? Cite the specific lines.
- Is the severity calibrated correctly? Would this cause a production issue, a subtle bug, or just confusion?
- Is the suggested comment accurate, actionable, and constructive? Improve it if not.
Step 3: Independently scan for issues the specialists MISSED. Focus on:
- Subtle bugs that require multi-file context
- Security issues that only appear when you trace data flow end-to-end
- Edge cases that require domain knowledge
- Interaction effects between changes in different files
Step 4: Output the FINAL review. Include all confirmed, escalated, downgraded, and refined findings. Include missed issues you discovered. Exclude only dismissed findings.
Output format:
## Final Review: {total count} findings ### R{N}: {title} - **File:** {exact file path} - **Line:** {line number in the new version of the file} - **Severity:** critical | warning | nit - **Verdict:** {confirmed | escalated | downgraded | refined | new} - **Comment:** {final polished comment text — ready to post to GitHub as-is} - **Rationale:** {one sentence: why this verdict, what evidence}Then list any dismissed findings separately:
## Dismissed: {count} findings ### D{N}: {original title} - **Reason:** {specific code citation or guarantee that proves this is safe}If ALL findings are dismissed AND you found no new issues, output:
## Final Review: 0 findings This PR looks clean after verification. No actionable issues found. ## Dismissed: {count} findings {list each with specific dismissal reason}Bash hygiene: Only run Bash for actual shell commands (gh, git, echo, etc.). Do ALL reasoning and analysis as plain text output — never inside bash script comments. Never write shell scripts with
#comment blocks to think through logic. Avoid->,=>, or>characters (including2>/dev/null) inside any bash command you run. Do NOT chain commands with;,&&, or||. Use the Read tool instead ofcat, use the Glob tool instead ofls, use the Grep tool instead ofgrep,awk,head, ortail— never run those via Bash.
Wait for the Senior Reviewer to complete. Parse its output to extract the final findings list (R{N} items only — dismissed items are excluded from triage but preserved for the "Discuss" option).
Present findings to the user ONE AT A TIME.
For each finding (R1, R2, R3...):
Display it clearly — show:
Ask the user with AskUserQuestion:
Record the decision: For each finding, store whether it's included and the final comment text.
If there are more than 10 findings, tell the user the total count and ask if they want to:
After all findings are triaged:
Show the summary — list every comment that will be posted:
Review Summary: {N} inline comments
1. {file}:{line} — {first ~60 chars of comment}...
2. {file}:{line} — {first ~60 chars of comment}...
...
Ask review type with AskUserQuestion:
Ask review body with AskUserQuestion:
Validate all line numbers locally before submitting. Run the diff through this Python snippet and remap any out-of-range lines to the last line of the nearest hunk in that file. Do this entirely locally — never make API calls to test individual line numbers.
gh pr diff {PR_NUMBER} | python3 -c "
import sys, re, json
current_file = None
valid_ranges = {}
for line in sys.stdin:
line = line.rstrip()
if line.startswith('+++ b/'):
current_file = line[6:]
valid_ranges[current_file] = []
elif line.startswith('@@ '):
m = re.match(r'@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@', line)
if m:
start = int(m.group(1))
count = int(m.group(2)) if m.group(2) else 1
if current_file:
valid_ranges[current_file].append((start, start + count - 1))
with open('/tmp/pr_review.json') as f:
payload = json.load(f)
for c in payload['comments']:
ranges = valid_ranges.get(c['path'], [])
if not any(s <= c['line'] <= e for s, e in ranges):
# Remap to the end of the last hunk in this file
if ranges:
c['line'] = ranges[-1][1]
print(f'REMAPPED {c[\"path\"]}:{c[\"line\"]} -> {ranges[-1][1]}', file=sys.stderr)
else:
print(f'SKIP {c[\"path\"]}:{c[\"line\"]} (file not in diff)', file=sys.stderr)
with open('/tmp/pr_review.json', 'w') as f:
json.dump(payload, f)
"
After running validation, review any REMAPPED/SKIP lines printed to stderr and adjust comment text if the remap changed the target line significantly.
Build and submit the review using a single gh api call:
# Construct the JSON payload with ALL inline comments and submit in ONE call
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews \
--method POST \
--input /tmp/pr_review.json
Write the payload to /tmp/pr_review.json using Python (json.dump) rather than shell heredoc to avoid escaping issues with quotes, newlines, and backslashes in comment text.
CRITICAL: The line field must be the line number as it appears in the NEW version of the file (right side of the diff). The side should always be "RIGHT" unless commenting on a deleted line.
Confirm success — show the user the review URL from the API response.
If the API call fails:
gh auth status and re-authenticate.gh pr view $ARGUMENTS --json headRefOid --jq .headRefOid.json.dump to /tmp/pr_review.json — never use shell heredoc, which mishandles quotes and backslashes in comment textgh pr diff, never by making test API calls