Review, commit, create PR, then auto-address review comments in a loop.
Review code, create PR, then automatically address review comments.
Parse $ARGUMENTS for options:
--wait N → seconds between checks (default: 300)--max N → max review-loop iterations (default: 5)Important: All gh CLI commands require required_permissions: ['all'] due to TLS certificate issues in sandboxed mode.
NEVER include PII in commits, PR titles/descriptions, branch names, or code comments. PII includes: names, email addresses, phone numbers, addresses, usernames, account IDs, API keys, tokens, passwords, or any sensitive personal data. Commit messages describe the type of change, not specific data. Use generic terms like "user", "email", "record".
──────────
Append these to the existing task list (do NOT replace tasks already there from earlier work):
──────────
Use the Task tool to spin up a review subagent:
Task tool call:
subagent_type: "general-purpose"
description: "Review code changes"
prompt: <see below>
Subagent prompt must include:
git diff HEAD (or git diff --cached if there are staged changes).claude/skills/review/SKILL.md (categories, severity guide, project-specific checks)──────────
Read the subagent's output. For each finding:
If the subagent already auto-fixed [AUTO] items, verify they were applied.
──────────
Follow the .claude/skills/create-pr/SKILL.md workflow:
Check state:
git branch --show-current && git status -s && git diff HEAD --stat
Create branch if on main:
git checkout -b feat/<description> # or fix/ or chore/
Stage specific files (NOT git add .), commit, push:
git add <file1> <file2> ... && git commit -m "<generic message>" && git push -u origin <branch>
Create PR:
gh pr create --title "<feature_area>: <Title>" --body "<TLDR + bullets>"
Display the PR URL as [PR #<number>](<url>) and the branch name.
──────────
Repeat up to --max iterations (default 5):
sleep <wait-seconds>
Default: 300 seconds (5 minutes).
Fetch all comments and check reviewer status:
PR_NUM=$(gh pr view --json number --jq .number)
REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
# Fetch code review comments
gh api "repos/$REPO/pulls/$PR_NUM/comments" --jq '.[] | {id, body: .body[0:200], author: .user.login, created_at}'
# Fetch conversation comments
gh pr view --json comments --jq '.comments[] | {id, body, author: .author.login}'
# Check if reviewer checks are still running
gh pr checks $PR_NUM
Exit conditions — only exit if ALL are true:
gh pr checks and verify no reviewer checks (e.g. "Baz Reviewer", "cubic · AI code reviewer") are pending or in_progress. If any reviewer check is still running, they haven't finished posting comments yet — wait for the next iteration.If any condition is false, continue the loop.
Fetch code review comments:
.claude/skills/scripts/get-pr-review-comments.sh
Fetch conversation comments:
gh pr view --json comments --jq '.comments[] | {id, body, author: .author.login}'
For each comment:
# Reply to code review comment
gh api repos/$REPO/pulls/$PR_NUM/comments/$COMMENT_ID/replies -f body="<reply>"
# Reply to conversation comment
gh pr comment $PR_NUM --body "<reply>" --reply-to $COMMENT_ID
Critical rules:
After addressing all comments in this iteration:
git add <changed-files> && git commit -m "<generic message about addressing review feedback>" && git push
Go back to step 5a. Exit when: