| description |
|---|
AI code review using specialized subagents (/review) |
Perform comprehensive code review using specialized AI agents working in parallel
IMPORTANT: Never modify files - only output review files
You must verify the following conditions before proceeding:
- Pull Request exists for the current branch (draft or opened)
- Template file exists at
~/obsidian/templates/review.md
If any condition is not met:
- Stop the process immediately
- Notify the user which condition failed
- Do not proceed with implementation
The review system employs 8 domain-specific agents:
- Product Manager: Requirements alignment, acceptance criteria
- Backend Developer: Server-side architecture, APIs
- Frontend Developer: UI components, state management, performance, cache strategies
- UI Engineer: Web standards consistency for UI
- Infrastructure Engineer: AWS, Terraform
- Database Engineer: MySQL, PostgreSQL, ORMs
- Quality Engineer: Testing, reliability, maintainability
- Refactoring Expert: Code quality, naming conventions, design principles
When all conditions are met, execute these phases in order:
# Get current branch (already checked out to Pull Request branch)
current_branch=$(git branch --show-current)
# Check if Pull Request exists for current branch
pr_number=$(gh pr list --head "$current_branch" --state all --json number --jq '.[0].number')
# Verify Pull Request exists
if [ "$pr_number" = "null" ] || [ -z "$pr_number" ]; then
exit 1
fi
# Get base branch from Pull Request information
base_branch=$(gh pr view "$pr_number" --json baseRefName --jq '.baseRefName')# Get changed files and diff
changed_files=$(git diff --name-only ${base_branch}...HEAD)
git_diff=$(git diff ${base_branch}...HEAD)Analyze the context and changes to determine which specialized subagents to invoke:
-
Analyze Changed Files and Directories
- Examine file extensions, paths, and directory structure
- Review git diff content to understand the nature of changes
-
Determine Required Agents
Based on the analysis, select relevant subagents:
- Always invoke: pm-reviewer, qa-reviewer, refactoring-reviewer
- Conditionally invoke based on changes:
- backend-reviewer: When changes in any backend files
- frontend-reviewer: When changes any in frontend files
- ui-reviewer: When changes in any frontend files
- infrastructure-reviewer: When changes in any infrastructure files
- Launch selected subagents in parallel
Let subagents review for domain-specific areas.
- Check execution
Verify that all the selected subagents are running. If there is any subagent not running, be sure to execute them.
-
Collect Agent Outputs
- Wait for all the selected subagents to complete
- Gather findings from each output file (e.g.
./tmp/pm-review.mdor./backend-review.md)
-
Categorize Findings
Group all findings by severity:
- ❌ Critical Issues: Must-fix problems
⚠️ Minor Issues: Non-critical improvements- ℹ️ Info & Questions: Clarifications needed
-
Maintain Attribution
- Preserve which agent provided each finding
- Format:
[Agent Name] Finding description (file:line)
Create comprehensive review report in ./tmp/review.md.
Structure your findings in the following format: ~/obsidian/templates/review.md.
Provide summary to user:
- Critical issues to do the next
- Output files