review-pr
Review PR
Deep code review using 6-7 parallel specialized agents.
Quick Start
/ork:review-pr 123
/ork:review-pr feature-branch
Opus 4.6: Parallel agents use native adaptive thinking for deeper analysis. Complexity-aware routing matches agent model to review difficulty.
Argument Resolution
The PR number or branch is passed as the skill argument. Resolve it immediately:
PR_NUMBER = "$ARGUMENTS" # e.g., "123" or "feature-branch"
# If no argument provided, check environment
if not PR_NUMBER:
PR_NUMBER = os.environ.get("ORCHESTKIT_PR_URL", "").split("/")[-1]
# If still empty, detect from current branch
if not PR_NUMBER:
PR_NUMBER = "$(gh pr view --json number -q .number 2>/dev/null)"
Use PR_NUMBER consistently in all subsequent commands and agent prompts.
STEP 0: Verify User Intent with AskUserQuestion
BEFORE creating tasks, clarify review focus:
AskUserQuestion(
questions=[{
"question": "What type of review do you need?",
"header": "Focus",
"options": [
{"label": "Full review (Recommended)", "description": "Security + code quality + tests + architecture"},
{"label": "Security focus", "description": "Prioritize security vulnerabilities"},
{"label": "Performance focus", "description": "Focus on performance implications"},
{"label": "Quick review", "description": "High-level review, skip deep analysis"}
],
"multiSelect": false
}]
)
Based on answer, adjust workflow:
- Full review: All 6-7 parallel agents
- Security focus: Prioritize security-auditor, reduce other agents
- Performance focus: Add frontend-performance-engineer agent
- Quick review: Single code-quality-reviewer agent only
STEP 0b: Select Orchestration Mode
See Orchestration Mode Selection
CRITICAL: Task Management is MANDATORY (CC 2.1.16)
BEFORE doing ANYTHING else, create tasks to track progress:
# 1. Create main review task IMMEDIATELY
TaskCreate(
subject="Review PR #{number}",
description="Comprehensive code review with parallel agents",
activeForm="Reviewing PR #{number}"
)
# 2. Create subtasks for each phase
TaskCreate(subject="Gather PR information", activeForm="Gathering PR information")
TaskCreate(subject="Launch review agents", activeForm="Dispatching review agents")
TaskCreate(subject="Run validation checks", activeForm="Running validation checks")
TaskCreate(subject="Synthesize review", activeForm="Synthesizing review")
TaskCreate(subject="Submit review", activeForm="Submitting review")
# 3. Update status as you progress
TaskUpdate(taskId="2", status="in_progress") # When starting
TaskUpdate(taskId="2", status="completed") # When done
Phase 1: Gather PR Information
# Get PR details
gh pr view $PR_NUMBER --json title,body,files,additions,deletions,commits,author
# View the diff
gh pr diff $PR_NUMBER
# Check CI status
gh pr checks $PR_NUMBER
Capture Scope for Agents
# Capture changed files for agent scope injection
CHANGED_FILES=$(gh pr diff $PR_NUMBER --name-only)
# Detect affected domains
HAS_FRONTEND=$(echo "$CHANGED_FILES" | grep -qE '\.(tsx?|jsx?|css|scss)$' && echo true || echo false)
HAS_BACKEND=$(echo "$CHANGED_FILES" | grep -qE '\.(py|go|rs|java)$' && echo true || echo false)
HAS_AI=$(echo "$CHANGED_FILES" | grep -qE '(llm|ai|agent|prompt|embedding)' && echo true || echo false)
Pass CHANGED_FILES to every agent prompt in Phase 3. Pass domain flags to select which agents to spawn.
Identify: total files changed, lines added/removed, affected domains (frontend, backend, AI).
Tool Guidance
| Task | Use | Avoid |
|---|---|---|
| Fetch PR diff | Bash: gh pr diff |
Reading all changed files individually |
| List changed files | Bash: gh pr diff --name-only |
bash find |
| Search for patterns | Grep(pattern="...", path="src/") |
bash grep |
| Read file content | Read(file_path="...") |
bash cat |
| Check CI status | Bash: gh pr checks |
Polling APIs |
<use_parallel_tool_calls> When gathering PR context, run independent operations in parallel:
gh pr view(PR metadata),gh pr diff(changed files),gh pr checks(CI status)
Spawn all three in ONE message. This cuts context-gathering time by 60%. For agent-based review (Phase 3), all 6 agents are independent -- launch them together. </use_parallel_tool_calls>
Phase 2: Skills Auto-Loading (CC 2.1.6)
CC 2.1.6 auto-discovers skills -- no manual loading needed!
Relevant skills activated automatically:
code-review-playbook-- Review patterns, conventional commentssecurity-scanning-- OWASP, secrets, dependenciestype-safety-validation-- Zod, TypeScript stricttesting-patterns-- Test adequacy, coverage gaps, rule matching
Phase 3: Parallel Code Review (6 Agents)
Domain-Aware Agent Selection
Only spawn agents relevant to the PR's changed domains:
| Domain Detected | Agents to Spawn |
|---|---|
| Backend only | code-quality (x2), security-auditor, test-generator, backend-system-architect |
| Frontend only | code-quality (x2), security-auditor, test-generator, frontend-ui-developer |
| Full-stack | All 6 agents |
| AI/LLM code | All 6 + optional llm-integrator (7th) |
Skip agents for domains not present in the diff. This saves ~33% tokens on domain-specific PRs.
See Agent Prompts -- Task Tool Mode for the 6 parallel agent prompts.
See Agent Prompts -- Agent Teams Mode for the mesh alternative.
See AI Code Review Agent for the optional 7th LLM agent.
Phase 4: Run Validation
Phase 5: Synthesize Review
Combine all agent feedback into a structured report. See Review Report Template
Phase 6: Submit Review
# Approve
gh pr review $PR_NUMBER --approve -b "Review message"
# Request changes
gh pr review $PR_NUMBER --request-changes -b "Review message"
CC 2.1.20 Enhancements
PR Status Enrichment
The pr-status-enricher hook automatically detects open PRs at session start and sets:
ORCHESTKIT_PR_URL-- PR URL for quick referenceORCHESTKIT_PR_STATE-- PR state (OPEN, MERGED, CLOSED)
Session Resume with PR Context (CC 2.1.27+)
Sessions are automatically linked when reviewing PRs. Resume later with full context:
claude --from-pr 123
claude --from-pr https://github.com/org/repo/pull/123
Task Metrics (CC 2.1.30)
Conventional Comments
Use these prefixes for comments:
praise:-- Positive feedbacknitpick:-- Minor suggestionsuggestion:-- Improvement ideaissue:-- Must fixquestion:-- Needs clarification
Related Skills
ork:commit: Create commits after reviework:create-pr: Create PRs for reviewslack-integration: Team notifications for review events