|
| 1 | +# Address Review Prompt |
| 2 | + |
| 3 | +Use this prompt in Codex CLI, ChatGPT, or another coding assistant when you want the equivalent of Claude Code's `/address-review` workflow. |
| 4 | + |
| 5 | +## How to Use |
| 6 | + |
| 7 | +Paste the prompt below into your coding assistant and replace `{{PR_REFERENCE}}` with one of: |
| 8 | + |
| 9 | +- A PR number, such as `12345` |
| 10 | +- A PR URL, such as `https://github.com/org/repo/pull/12345` |
| 11 | +- A specific review URL, such as `https://github.com/org/repo/pull/12345#pullrequestreview-123456789` |
| 12 | +- A specific issue comment URL, such as `https://github.com/org/repo/pull/12345#issuecomment-123456789` |
| 13 | + |
| 14 | +If the assistant has terminal access with `gh`, it should execute the workflow directly. If it does not, it should stop and ask for the missing GitHub data instead of pretending it fetched comments. |
| 15 | + |
| 16 | +## Prompt |
| 17 | + |
| 18 | +```text |
| 19 | +Act as a pull request review triage assistant. |
| 20 | +
|
| 21 | +I want the equivalent of Claude Code's `/address-review` command for this input: `{{PR_REFERENCE}}`. |
| 22 | +
|
| 23 | +Your job is to fetch GitHub PR review comments, triage them, and wait for my instruction before making code changes. |
| 24 | +
|
| 25 | +Behavior rules: |
| 26 | +- Do not claim you fetched comments unless you actually have terminal or API access and used it. |
| 27 | +- If you do not have shell access with `gh`, say so immediately and ask me to provide either: |
| 28 | + - the PR URL plus exported comment data, or |
| 29 | + - the output of the required `gh api` commands. |
| 30 | +- Do not auto-fix everything. Stop after triage and wait for my selection. |
| 31 | +- Default to real issues only, not optional polish. |
| 32 | +- After selected items are addressed, reply to the original GitHub comments and resolve threads when appropriate. |
| 33 | +
|
| 34 | +Execution flow when terminal access is available: |
| 35 | +
|
| 36 | +1. Determine repository: |
| 37 | + - Run: `REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)` |
| 38 | + - If the input is a full GitHub URL, use the URL's `org/repo`. |
| 39 | + - If `gh` is unavailable or unauthenticated, stop and tell me to fix that first. |
| 40 | +
|
| 41 | +2. Parse the input: |
| 42 | + - Support: |
| 43 | + - PR number only |
| 44 | + - PR URL |
| 45 | + - Specific review URL with `#pullrequestreview-...` |
| 46 | + - Specific issue comment URL with `#issuecomment-...` |
| 47 | + - Extract the PR number and optional review/comment ID. |
| 48 | +
|
| 49 | +3. Fetch review data: |
| 50 | + - Specific issue comment: |
| 51 | + `gh api repos/${REPO}/issues/comments/{COMMENT_ID} | jq '{body: .body, user: .user.login, html_url: .html_url}'` |
| 52 | + - Specific review: |
| 53 | + `gh api repos/${REPO}/pulls/{PR_NUMBER}/reviews/{REVIEW_ID} | jq '{id: .id, body: .body, state: .state, user: .user.login, html_url: .html_url}'` |
| 54 | + `gh api --paginate repos/${REPO}/pulls/{PR_NUMBER}/reviews/{REVIEW_ID}/comments | jq -s '[.[].[] | {id: .id, node_id: .node_id, path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'` |
| 55 | + - Full PR: |
| 56 | + `gh api --paginate repos/${REPO}/pulls/{PR_NUMBER}/comments | jq -s '[.[].[] | {id: .id, node_id: .node_id, type: "review", path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'` |
| 57 | + `gh api --paginate repos/${REPO}/issues/{PR_NUMBER}/comments | jq -s '[.[].[] | {id: .id, node_id: .node_id, type: "issue", body: .body, user: .user.login, html_url: .html_url}]'` |
| 58 | + - For all review-comment paths, fetch thread metadata and match `thread_id` by `node_id`: |
| 59 | + `OWNER=${REPO%/*}` |
| 60 | + `NAME=${REPO#*/}` |
| 61 | + `gh api graphql --paginate -f owner="${OWNER}" -f name="${NAME}" -F pr={PR_NUMBER} -f query='query($owner:String!, $name:String!, $pr:Int!, $endCursor:String) { repository(owner:$owner, name:$name) { pullRequest(number:$pr) { reviewThreads(first:100, after:$endCursor) { nodes { id isResolved comments(first:100) { nodes { id databaseId } } } pageInfo { hasNextPage endCursor } } } } }' | jq -s '[.[].data.repository.pullRequest.reviewThreads.nodes[] | {thread_id: .id, is_resolved: .isResolved, comments: [.comments.nodes[] | {node_id: .id, id: .databaseId}]}]'` |
| 62 | +
|
| 63 | +4. Filter comments: |
| 64 | + - Skip resolved threads. |
| 65 | + - Skip replies where `in_reply_to_id` is set. |
| 66 | + - Keep bot comments by default, but deduplicate duplicates and skip status-only bot posts. |
| 67 | + - Focus on correctness bugs, regressions, security issues, missing tests that hide bugs, and clear adjacent-code inconsistencies. |
| 68 | + - Skip style nits, speculative suggestions, documentation nits, changelog wording, duplicate comments, and "could consider" feedback unless I ask for polish work. |
| 69 | + - If the API returns 404, tell me the PR or comment does not exist. |
| 70 | + - If the API returns 403, tell me to check `gh auth status`. |
| 71 | + - If nothing is returned, tell me no review comments were found. |
| 72 | +
|
| 73 | +5. Triage every remaining comment: |
| 74 | + - `MUST-FIX`: correctness bugs, regressions, security issues, missing tests that could hide a bug, and clear inconsistencies with adjacent code that would likely block merge. |
| 75 | + - `DISCUSS`: reasonable scope-expanding suggestions, architectural opinions, and comments that need a decision. |
| 76 | + - `SKIPPED`: style preferences, documentation nits, comment requests, test-shape preferences, speculative suggestions, changelog wording, duplicate comments, status posts, summaries, and factually incorrect suggestions. |
| 77 | + - Deduplicate overlapping comments before classifying them. |
| 78 | + - Verify reviewer claims locally before calling something `MUST-FIX`. |
| 79 | + - If a claim is wrong, classify it as `SKIPPED` and say why. |
| 80 | + - Preserve comment IDs and thread IDs for later replies and thread resolution. |
| 81 | + - Track only `MUST-FIX` items as your working checklist. |
| 82 | + - Use one checklist entry per must-fix item or deduplicated issue. |
| 83 | + - Use the subject format: `"{file}:{line} - {comment_summary} (@{username})"`. |
| 84 | + - For general comments, extract the must-fix action from the body. |
| 85 | +
|
| 86 | +6. Present triage and wait: |
| 87 | + - Use a single numbering sequence across all categories. |
| 88 | + - Show counts for `MUST-FIX`, `DISCUSS`, and `SKIPPED`. |
| 89 | + - Ask which items I want addressed. |
| 90 | + - If there are skipped or declined discuss items, also ask which ones should receive rationale replies. |
| 91 | + - Do not edit code yet. |
| 92 | +
|
| 93 | +7. After I choose items: |
| 94 | + - Address the selected items in code, tests, or docs. |
| 95 | + - Run relevant checks when possible. |
| 96 | + - Reply to each addressed review comment: |
| 97 | + - Issue comments: `gh api repos/${REPO}/issues/{PR_NUMBER}/comments -X POST -f body="<response>"` |
| 98 | + - Review comment replies: `gh api repos/${REPO}/pulls/{PR_NUMBER}/comments/{COMMENT_ID}/replies -X POST -f body="<response>"` |
| 99 | + - Review summary body replies: `gh api repos/${REPO}/issues/{PR_NUMBER}/comments -X POST -f body="<response>"` |
| 100 | + - Resolve threads only when the issue is actually handled or explicitly declined with my approval: |
| 101 | + `gh api graphql -f query='mutation($threadId:ID!) { resolveReviewThread(input:{threadId:$threadId}) { thread { id isResolved } } }' -f threadId="<THREAD_ID>"` |
| 102 | + - Do not resolve anything still in progress or uncertain. |
| 103 | +
|
| 104 | +Output format for the triage: |
| 105 | +
|
| 106 | +MUST-FIX (count): |
| 107 | +1. item |
| 108 | +
|
| 109 | +DISCUSS (count): |
| 110 | +2. item |
| 111 | + Reason: short explanation |
| 112 | +
|
| 113 | +SKIPPED (count): |
| 114 | +3. item - short reason |
| 115 | +
|
| 116 | +Then ask: |
| 117 | +- Which items should I address? |
| 118 | +- Optional: which skipped or declined items should get rationale replies? |
| 119 | +``` |
0 commit comments