Review Fix — Fetch Comments, Plan, Review, Implement, Ship
Fetches unresolved review comments from a GitHub PR or GitLab MR, builds a fix plan, sends it through Codex review, presents it to the user for approval, implements the fixes, verifies everything passes, and commits+pushes.
Arguments
- Optional first argument: PR/MR number (e.g.,
/review-fix 144)
- If omitted, auto-detect from the current branch
Stage 0: Detect Platform
Determine whether this is a GitHub or GitLab repo by inspecting the remote URL:
git remote get-url origin
- If the URL contains
github.com → GitHub mode (use gh CLI)
- If the URL contains
gitlab → GitLab mode (use glab CLI)
- If unclear, check for
.gitlab-ci.yml (GitLab) or .github/ directory (GitHub)
Set PLATFORM=github or PLATFORM=gitlab for the rest of the skill.
Stage 1: Fetch Review Comments
GitHub Mode
Detect the PR. If no number given:
gh pr view --json number -q '.number'
Fetch review comments:
gh api "repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews"
gh api "repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments"
Filter to human reviewer comments only:
- Exclude bot authors (usernames containing
bot, [bot], github-actions)
- Focus on unresolved review threads
- Extract: author, body, file path + line number (if inline), review state
GitLab Mode
Detect the MR. If no number given:
glab mr view --json iid -q 2>/dev/null | python3 -c "import json,sys; print(json.load(sys.stdin)['iid'])"
Fallback: glab mr list --source-branch=$(git branch --show-current)
Detect the project path from the remote URL. URL-encode it (replace / with %2F).
Fetch all notes and discussions:
glab api "projects/<encoded-path>/merge_requests/<MR_ID>/notes?per_page=100&sort=asc"
glab api "projects/<encoded-path>/merge_requests/<MR_ID>/discussions?per_page=100"
Filter to human reviewer comments only:
- Exclude
system: true notes
- Exclude bot authors (usernames containing
bot, gsa_, ci-)
- Focus on unresolved discussions where
resolved: false or standalone notes
- Extract: author, body, file path + line number (if inline), resolved status
Present Summary (both platforms)
## <PR #N | MR !N> — Review Comments
Found <N> reviewer comments (<M> unresolved):
### From @<reviewer1>
1. [file:line] <summary of comment>
2. [general] <summary of comment>
### From @<reviewer2>
...
If there are no unresolved comments, inform the user and stop.
Stage 2: Plan Fixes
Read the relevant source files mentioned in the comments. Also read surrounding context to understand the codebase patterns.
Create a fix plan addressing each reviewer comment. For each comment:
- State the comment summary
- Describe the proposed fix
- Note the file(s) to change
Present the plan:
## Fix Plan
### 1. <Comment summary> (@reviewer)
**Fix:** <what you'll do>
**Files:** <file paths>
### 2. ...
Stage 3: Codex Review
- Invoke the
/codex-review skill to send the fix plan through OpenCode/Codex for review.
- Revise the plan based on Codex feedback (the codex-review skill handles the iteration loop).
- Once Codex approves, proceed to Stage 4.
Stage 4: User Approval
- Present the final reviewed plan to the user with all revisions incorporated.
- Ask for explicit approval before implementing:
The plan has been reviewed by Codex and is ready for implementation.
Shall I proceed with these changes?
- Do NOT proceed without user approval. If the user wants changes, revise the plan and optionally re-run Codex review.
Stage 5: Implement
- Make the changes according to the approved plan.
- Work through each fix systematically, one comment at a time.
- After all changes are made, briefly summarize what was done.
Stage 6: Verify
Run all verification scripts. Check package.json for available scripts and run whichever of these exist:
# Run each that exists in package.json scripts
npm run check 2>&1
npm run lint 2>&1
npm run format 2>&1
npm run build 2>&1
npm run test 2>&1
- If any script fails, fix the issue and re-run.
- Iterate until all checks pass.
- If a check doesn't exist in package.json, skip it silently.
Stage 7: Commit & Push
Stage all changed files (only files you modified, not unrelated changes):
git add <specific files>
Create a single commit with a message referencing the PR/MR:
- GitHub:
fix: address PR #<number> review feedback
- GitLab:
fix: address MR !<number> review feedback
Body:
- <brief summary of fix 1>
- <brief summary of fix 2>
- ...
Push to the remote branch:
git push origin HEAD
Confirm by showing the push result and a link to the PR/MR.
Rules
- Always filter out bot comments — only address human reviewer feedback
- Never skip Stage 4 — user must approve before implementation
- One commit — all fixes go in a single commit, not one per comment
- Don't over-fix — only address what reviewers asked for, don't refactor surrounding code
- If Codex review is unavailable (opencode not installed), skip Stage 3 and go straight to user approval with a note that Codex review was skipped
- Respect the existing codebase patterns — match the style, conventions, and patterns already in use
- If a reviewer comment is ambiguous, note the ambiguity in the plan and ask the user for clarification before implementing
1---2name: review-fix3description: Fetch PR/MR review comments (GitHub or GitLab), plan fixes, get Codex review, then implement, verify, commit and push.4---56# Review Fix — Fetch Comments, Plan, Review, Implement, Ship78Fetches unresolved review comments from a GitHub PR or GitLab MR, builds a fix plan, sends it through Codex review, presents it to the user for approval, implements the fixes, verifies everything passes, and commits+pushes.910## Arguments1112- Optional first argument: PR/MR number (e.g., `/review-fix 144`)13- If omitted, auto-detect from the current branch1415## Stage 0: Detect Platform1617Determine whether this is a GitHub or GitLab repo by inspecting the remote URL:1819```bash20git remote get-url origin21```2223- If the URL contains `github.com` → **GitHub mode** (use `gh` CLI)24- If the URL contains `gitlab` → **GitLab mode** (use `glab` CLI)25- If unclear, check for `.gitlab-ci.yml` (GitLab) or `.github/` directory (GitHub)2627Set `PLATFORM=github` or `PLATFORM=gitlab` for the rest of the skill.2829## Stage 1: Fetch Review Comments3031### GitHub Mode32331. **Detect the PR.** If no number given:34 ```bash35 gh pr view --json number -q '.number'36 ```37382. **Fetch review comments:**39 ```bash40 gh api "repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews"41 gh api "repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments"42 ```43443. **Filter to human reviewer comments only:**45 - Exclude bot authors (usernames containing `bot`, `[bot]`, `github-actions`)46 - Focus on unresolved review threads47 - Extract: author, body, file path + line number (if inline), review state4849### GitLab Mode50511. **Detect the MR.** If no number given:52 ```bash53 glab mr view --json iid -q 2>/dev/null | python3 -c "import json,sys; print(json.load(sys.stdin)['iid'])"54 ```55 Fallback: `glab mr list --source-branch=$(git branch --show-current)`56572. **Detect the project path** from the remote URL. URL-encode it (replace `/` with `%2F`).58593. **Fetch all notes and discussions:**60 ```bash61 glab api "projects/<encoded-path>/merge_requests/<MR_ID>/notes?per_page=100&sort=asc"62 glab api "projects/<encoded-path>/merge_requests/<MR_ID>/discussions?per_page=100"63 ```64654. **Filter to human reviewer comments only:**66 - Exclude `system: true` notes67 - Exclude bot authors (usernames containing `bot`, `gsa_`, `ci-`)68 - Focus on unresolved discussions where `resolved: false` or standalone notes69 - Extract: author, body, file path + line number (if inline), resolved status7071### Present Summary (both platforms)7273```74## <PR #N | MR !N> — Review Comments7576Found <N> reviewer comments (<M> unresolved):7778### From @<reviewer1>791. [file:line] <summary of comment>802. [general] <summary of comment>8182### From @<reviewer2>83...84```8586If there are no unresolved comments, inform the user and stop.8788## Stage 2: Plan Fixes89901. **Read the relevant source files** mentioned in the comments. Also read surrounding context to understand the codebase patterns.91922. **Create a fix plan** addressing each reviewer comment. For each comment:93 - State the comment summary94 - Describe the proposed fix95 - Note the file(s) to change96973. **Present the plan:**98 ```99 ## Fix Plan100101 ### 1. <Comment summary> (@reviewer)102 **Fix:** <what you'll do>103 **Files:** <file paths>104105 ### 2. ...106 ```107108## Stage 3: Codex Review1091101. **Invoke the `/codex-review` skill** to send the fix plan through OpenCode/Codex for review.1112. Revise the plan based on Codex feedback (the codex-review skill handles the iteration loop).1123. Once Codex approves, proceed to Stage 4.113114## Stage 4: User Approval1151161. **Present the final reviewed plan** to the user with all revisions incorporated.1172. **Ask for explicit approval** before implementing:118 ```119 The plan has been reviewed by Codex and is ready for implementation.120 Shall I proceed with these changes?121 ```1223. **Do NOT proceed** without user approval. If the user wants changes, revise the plan and optionally re-run Codex review.123124## Stage 5: Implement1251261. **Make the changes** according to the approved plan.1272. Work through each fix systematically, one comment at a time.1283. After all changes are made, briefly summarize what was done.129130## Stage 6: Verify131132Run all verification scripts. Check `package.json` for available scripts and run whichever of these exist:133134```bash135# Run each that exists in package.json scripts136npm run check 2>&1137npm run lint 2>&1138npm run format 2>&1139npm run build 2>&1140npm run test 2>&1141```142143- If any script fails, fix the issue and re-run.144- Iterate until all checks pass.145- If a check doesn't exist in package.json, skip it silently.146147## Stage 7: Commit & Push1481491. **Stage all changed files** (only files you modified, not unrelated changes):150 ```bash151 git add <specific files>152 ```1531542. **Create a single commit** with a message referencing the PR/MR:155 - GitHub: `fix: address PR #<number> review feedback`156 - GitLab: `fix: address MR !<number> review feedback`157158 Body:159 ```160 - <brief summary of fix 1>161 - <brief summary of fix 2>162 - ...163 ```1641653. **Push to the remote branch:**166 ```bash167 git push origin HEAD168 ```1691704. **Confirm** by showing the push result and a link to the PR/MR.171172## Rules173174- **Always filter out bot comments** — only address human reviewer feedback175- **Never skip Stage 4** — user must approve before implementation176- **One commit** — all fixes go in a single commit, not one per comment177- **Don't over-fix** — only address what reviewers asked for, don't refactor surrounding code178- **If Codex review is unavailable** (opencode not installed), skip Stage 3 and go straight to user approval with a note that Codex review was skipped179- **Respect the existing codebase patterns** — match the style, conventions, and patterns already in use180- **If a reviewer comment is ambiguous**, note the ambiguity in the plan and ask the user for clarification before implementing