ワンクリックで
code-review
Interactive code review with GitHub comment submission using gh CLI
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Interactive code review with GitHub comment submission using gh CLI
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | code-review |
| description | Interactive code review with GitHub comment submission using gh CLI |
Interactively review code changes and submit approved comments to GitHub using gh CLI.
First, check for custom review guidelines at ~/.config/reviewer/review_guide.md. If the file exists:
If no custom guidelines exist, use these defaults:
IMPORTANT: You are already in a git worktree with the PR branch checked out. The code is local - use git directly, NOT gh commands to fetch diffs.
Get the PR base commit and diff:
# Query base SHA directly with a literal PR number
# Avoid shell wrappers like: PR_NUMBER=123; gh pr view $PR_NUMBER ...
gh pr view <pr-number-from-initial-prompt> --json baseRefOid --jq '.baseRefOid'
# Diff from that base SHA to HEAD (the PR's changes only)
git diff -U10 <base-sha-from-command>...HEAD
If gh pr view fails, fall back to merge-base with origin/main:
MERGE_BASE=$(git merge-base origin/main HEAD)
git diff -U10 $MERGE_BASE HEAD
Get PR metadata (for comment submission):
# Get repo info
gh repo view --json nameWithOwner --jq '.nameWithOwner'
# The PR number is provided in the initial prompt
Read surrounding code using local files for additional context when needed.
Analyze the diff and categorize issues:
Keep track of:
+)Show ALL issues in a summary table first:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# │ Severity │ Location │ Issue Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1 │ CRITICAL │ auth.rs:45 │ Token expiration not checked
2 │ SUGGEST │ auth.rs:23 │ Use constant-time comparison
3 │ SUGGEST │ middleware.rs:67 │ Error message reveals user existence
4 │ NITPICK │ auth.rs:12 │ Unused import
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Then show FULL details of each issue below the table:
──────────────────────────────────────────────────────
[1] CRITICAL - auth.rs:45
──────────────────────────────────────────────────────
Token expiration is not being checked. An expired token will still be
accepted, allowing unauthorized access.
Context:
43│ let token = extract_token(&headers)?;
44│ let claims = decode_token(&token)?;
> 45│ Ok(claims.user_id) // Missing: check claims.exp
46│ }
──────────────────────────────────────────────────────
[2] SUGGEST - auth.rs:23
...
After showing all issues, prompt for batch action:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Which comments to submit?
a = all Submit all comments
c = critical Submit only CRITICAL issues
n = none Skip all, proceed to summary
1,2,4 or 1-3 Select specific numbers
q = quit Cancel review
Your choice:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Parse user input:
a or all: Submit every commentc or critical: Submit only CRITICAL severityn or none: Don't submit any, proceed to summary1,2,4 or 1-3,5: Submit selected issuesq or quit: Cancel the entire reviewFor each selected comment, submit using gh CLI:
# For line-specific comments, use a review with comments array
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews \
-X POST \
-f event="COMMENT" \
-f body="" \
--raw-field comments='[{"path":"[file path]","line":[line number],"body":"[Comment text]"}]'
Or for a single inline comment without creating a full review:
# Use the correct parameters for single-line comments
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments \
-X POST \
-f body="[Comment text]" \
-f commit_id="$(git rev-parse HEAD)" \
-f path="[file path]" \
-F line=[line number] \
-f side="RIGHT"
Important API notes:
-F line=123 (not -f) so the number is sent as integer, not stringsubject_type must be "line" for single-line commentsside should be "RIGHT" for new code (lines with +)commit_id must be the HEAD commit of the PR branchIf line-level comment fails, fall back to a general PR comment:
gh pr comment {pr_number} --body "**[file:line]** [Comment text]"
Show progress as comments are submitted:
Submitting comments...
[1] auth.rs:45 ✓
[2] auth.rs:23 ✓
[3] middleware.rs:67 ✗ (failed - added as general comment)
Done. 3 comments submitted.
Show final summary:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Review Complete
Comments submitted: X
Comments skipped: Y
Critical issues: Z
[If critical issues > 0]
⚠️ Critical issues were found. PR should not be approved until addressed.
[If critical issues == 0]
✓ No critical issues found.
Would you like to approve this PR? (y)es / (n)o
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
If user chooses to approve:
# Approve WITHOUT --body to avoid duplicate comments
gh pr review {pr_number} --approve
DO NOT use --body with approve - comments are submitted separately in Phase 5. Adding --body creates a duplicate.
After the review ends (approved or not), if any comments were skipped, offer to update the user's review guidelines to avoid similar suggestions in future reviews.
Identify skipped comments: Track which issues the user chose NOT to submit.
Extract categories: For each skipped comment, determine its abstract category. Don't use the specific code or text - extract the general pattern.
Examples of category extraction:
os" → Category: "unused imports"const instead of let" → Category: "const vs let preferences"Present categories to user:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Learn from skipped comments?
You skipped these types of feedback:
1. unused imports
2. missing documentation comments
Add to your review guidelines to skip in future? (y)es / (n)o
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Update guidelines file: If user confirms, append to ~/.config/reviewer/review_guide.md:
# Create file if it doesn't exist
mkdir -p ~/.config/reviewer
# Append skip rules
cat >> ~/.config/reviewer/review_guide.md << 'EOF'
## Skip These
- unused imports
- missing documentation comments
EOF
If the file already has a "## Skip These" section, append only the new categories under it (avoid duplicates).
Confirm update:
✓ Updated ~/.config/reviewer/review_guide.md
Added 2 categories to skip list.
Important:
--body on approve - comments are submitted separately in Phase 5gh auth status to verify authentication if commands fail~/.config/reviewer/review_guide.md - check "Skip These" section before flagging issues