Code review a pull request
Performs comprehensive multi-agent code review with validation checks and issue triage
/plugin marketplace add cahaseler/cc-track/plugin install cc-track@cc-track-marketplaceRun validation checks and multi-agent code review without requiring a spec folder. Use this for general code review outside the cc-track workflow.
git branch --show-currentgit diff --statRun the code-review script:
bun "${CLAUDE_PLUGIN_ROOT}/skills/cc-track-tools/scripts/code-review.ts"
The script will:
The script returns JSON output. Parse and present the results:
If validation failed:
data.validationbunx biome check --write or fix manually/cc-track:code-review againIf validation passed:
Launch the multi-agent code review using the Task tool.
Gather Context for Agents:
Before launching agents, gather the following:
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main" to detect default branchgit diff {default_branch} --name-only to get list of changed filesContext to Pass to All Agents:
Every agent prompt MUST include:
Launch All 5 Review Agents in Parallel:
Use the Task tool to launch these agents simultaneously. Include the context above in each prompt.
bug-scanner (sonnet)
guidelines-reviewer (haiku)
comment-compliance-reviewer (haiku)
duplication-detector (haiku)
dead-code-detector (haiku)
IMPORTANT: Launch all 5 agents in a single message with multiple Task tool calls for parallel execution.
Execution mode: Use foreground parallel (do NOT use run_in_background: true):
run_in_background parameterAfter all agents complete:
Issue N:
- Reviewers: [list of agents that found this]
- Description: [what the issue is]
- Location: [file:line]
- Observation: [evidence from reviewer]
If no issues found by any reviewer: Skip to Step 7 with "No issues found - clean review!"
For each unique issue, launch a parallel issue-scorer agent (Haiku) to validate it.
IMPORTANT: Launch ALL scoring agents in a single message for parallel execution.
For each issue, prompt the scorer with:
This is a standalone code review (no spec folder).
Issue: {description}
Location: {file:line}
Reported by: {reviewer(s)}
Observation: {what the reviewer observed}
After all scorers complete:
# Code Review Results
## Validated Issues
| # | Score | Reviewer(s) | Issue | Location |
|---|-------|-------------|-------|----------|
| 1 | 100 | bug-scanner | SQL injection vulnerability | api/users.ts:42 |
| 2 | 75 | guidelines | Naming convention violation | lib/auth.ts:156 |
| 3 | 50 | comments | Outdated comment | utils/helper.ts:23 |
## Issue Details
### Issue 1: SQL injection vulnerability (Score: 100)
- **Location:** api/users.ts:42
- **Reported by:** bug-scanner
- **Observation:** User input concatenated directly into query
- **Scorer justification:** Confirmed - query uses string interpolation with unsanitized input
### Issue 2: Naming convention violation (Score: 75)
- **Location:** lib/auth.ts:156
- **Reported by:** guidelines
- **Observation:** Function name doesn't follow camelCase convention
- **Scorer justification:** Verified - function uses snake_case instead of camelCase
[Continue for all issues >= 50]
## Filtered Out (Score < 50)
- [N] issues were filtered as unverified or false positives
After filtering and scoring, route based on how many validated issues were found:
✅ Clean review! No issues found with score >= 50.
Code review complete. No issues to address.
Present the single issue inline:
📋 Found 1 validated issue:
### {Issue Title} (Score: {score})
- **Location:** {file:line}
- **Reported by:** {reviewer(s)}
- **Observation:** {evidence}
- **Scorer justification:** {justification}
Would you like me to fix this issue, or skip it?
Wait for user direction before proceeding. If they want it fixed, implement the fix and remind them to re-run /cc-track:code-review to verify.
📋 Found {N} validated issues. Starting structured triage...
Proceed to Step 8 for inline fix-issues flow.
For >1 validated issues, handle triage directly (don't call /cc-track:fix-issues which requires a spec folder).
Ensure .cc-track/reviews/ directory exists:
mkdir -p .cc-track/reviews
Create a date-stamped review file:
YYYY-MM-DD.mdYYYY-MM-DD-HH-MM.mdInitialize with this structure:
# Code Review: {date} {time}
**Branch:** {current_branch}
**Generated:** {timestamp}
**Status:** in_progress
## Summary
| # | Score | Status | Location | Decision | Action |
|---|-------|--------|----------|----------|--------|
## Issues
Add each issue to the file with Status = "pending"
Read existing files to filter issues that were already triaged:
Check previous review files (in .cc-track/reviews/):
Check backlog.md (at .cc-track/backlog.md):
Filter the issue list:
Before presenting issues to the user, scan for trivial fixes that don't need human decision-making.
Criteria for "Just Fix It":
Examples:
Process:
For each remaining issue (sorted by score, highest first):
Present the Issue:
## Issue {N} of {Total}: {Title}
**Score:** {score}/100
**Location:** {file:line}
**Reported by:** {reviewer(s)}
**Description:** {what's wrong}
**Observation:** {evidence from reviewer}
**Scorer justification:** {why this score}
Ask for Decision using AskUserQuestion:
Always include a recommendation as the first option based on your analysis:
question: "How would you like to handle this issue?"
header: "Decision"
options:
- label: "{Recommended option} (Recommended)"
description: "{Standard description} - {Brief reason for recommendation}"
- label: "Fix"
description: "Add to fix list - will be implemented after triage"
- label: "Defer"
description: "Add to backlog for future work - not blocking"
- label: "Dismiss"
description: "False positive or acceptable as-is - no action needed"
- label: "Discuss"
description: "Investigate further before deciding"
multiSelect: false
Handle Response:
.cc-track/backlog.md:
- [{timestamp}] {issue title} - {location} (Deferred from code review)
After all issues are triaged:
## Triage Complete
**Issues to Fix ({N}):**
1. {Issue title} - {location}
2. {Issue title} - {location}
...
**Deferred to Backlog ({N}):**
- {Issue title} - {rationale}
...
**Dismissed ({N}):**
- {Issue title} - {rationale}
...
Update review file Status to "triaged".
If no fixes needed:
No fixes to execute. Code review complete.
If fixes exist:
For each fix:
After all fixes:
All {N} fixes implemented. Review file updated.
Please re-run /cc-track:code-review to verify all fixes are correct and no new issues were introduced.
.cc-track/reviews/ with date stamps