/review-pr - PR Code Review
Analyzes code from a Bitbucket PR URL and automatically posts structured review comments to the PR. Auto-detects the code domain (backend, frontend, PLC) from file extensions in the diff.
Options
| Option | Description |
|---|---|
| (none) | Review + post PR comment + save local MD |
--no-post |
Skip posting PR comment (analysis only) |
--no-save |
Skip saving local MD file |
Required Execution Workflow
Follow the steps below in order. Do not skip any step.
Step 1: Parse Arguments
Parse the PR URL and options from user input.
Input: <pr_url> [--no-post] [--no-save]
Step 2: Fetch PR Data
python3 scripts/review_pr.py fetch <pr_url>
Analyze the JSON output. If a diff_file key exists, the diff was saved to a separate file — read it using the Read tool.
Step 3: Auto-Detect Domain & Analyze Code
- Read the entire diff and detect the primary domain from file extensions:
- Backend:
.py,.go,.java,.cs,.rb,.rs,.sql,.env,Dockerfile - Frontend:
.tsx,.jsx,.ts(insrc/components/),.css,.scss,.vue,.svelte - PLC:
.ST,.st,.xml(PLCOpen format) - Mixed/General: Falls back to the generic review rubric
- Backend:
- Load the appropriate domain reference file:
- Backend → ../review-backend/reference.md
- Frontend → ../review-frontend/reference.md
- PLC → ../review-plc/reference.md + ../review-plc/plc-architecture-guide.md
- Mixed/General → reference.md
- Analyze the diff using the domain-specific review perspectives.
- Review the target branch history for related commits to understand root cause.
- Write a structured review following the domain reference's output format.
- Save to
/tmp/review_pr_{id}.mdas a temp file.
Review language: Write the review in Korean.
Step 4: Post Comment to PR
Execute only if --no-post option is NOT present.
python3 scripts/review_pr.py comment <pr_url> < /tmp/review_pr_{id}.md
Step 5: Save Local MD
Execute only if --no-save option is NOT present.
- Get filename info:
python3 scripts/review_pr.py save <pr_url>
- Save the
/tmp/review_pr_{id}.mdcontent toreviews/{filename}. Create thereviews/directory if it doesn't exist.
Step 6: Summary
Show the user a summary of results:
- PR info reviewed (title, branch, author)
- Number of issues found (must-fix before merge / suggested improvements)
- Final verdict (APPROVED / APPROVED with suggestions / CHANGES REQUESTED)
- Comment posting status and URL
- MD save path
Resources
- General review rubric & output format: reference.md
- Backend-specific review rubric: ../review-backend/reference.md
- Frontend-specific review rubric: ../review-frontend/reference.md
- PLC-specific review rubric: ../review-plc/reference.md
- PLC architecture guide: ../review-plc/plc-architecture-guide.md
- Usage examples: examples.md
- API helper script: scripts/review_pr.py