
review-post
by richardgill
SKILL.md
name: review-post description: Post code review comments to GitHub PR
Post prepared review comments as a pending (draft) GitHub review. Do NOT submit/approve - leave as pending for user to finalize.
Todo List
- Find PR for current branch:
gh pr list --head <current_branch> --json number,headRefOid - If no PR, stop and tell user
- Get PR diff:
gh api repos/{owner}/{repo}/pulls/{pr} -H "Accept: application/vnd.github.v3.diff" - For each issue, calculate its position in the diff (see Position Calculation below)
- Categorize each issue into one of three types:
- a) Not in diff → add to review
bodywith GitHub link (see Generating File Links below) - b) In diff + isolated one-line change → use suggestion block (see Suggestion Syntax below)
- c) In diff + multi-line/contextual → normal line comment
- a) Not in diff → add to review
- For In diff + isolated one-line change suggestion blocks:
- The line is a single added/modified line (starts with
+) - The suggestion contains the exact replacement code for that line
- Make the changes to the code locally here
- Run pnpm run local-ci to check everything is ok, if this fails, make it a In diff 5 c.
- The line is a single added/modified line (starts with
- Write JSON to
scratch/review-<pr>-<current_branch>.json - Post review:
gh api repos/{owner}/{repo}/pulls/{pr}/reviews --input scratch/review-<pr>-<current_branch>.json - Verify comments attached:
gh api repos/{owner}/{repo}/pulls/{pr}/reviews/{id}/comments- checkpositionfield is populated - Show PR link to user
Position Calculation
Use position, NOT line - the line parameter doesn't work reliably.
Position = number of lines from first @@ header in that file's diff:
- The
@@header itself is NOT counted - Position 1 = first line after
@@ - Continue counting through ALL lines including subsequent
@@headers
Example: @@ -1,5 +1,5 @@ <- not counted +import { Button } <- position 1 import Link <- position 2 -import { Old } <- position 3 @@ -93,7 +93,7 @@ <- position 4 (headers count after first!) asChild <- position 5
- variant="old" <- position 6
- variant="new" <- position 7 <-- comment here = position 7
Post review JSON
{
"commit_id": "abc123...",
"body": "Claude Code Generated:\n\n3 issues found.\n\n**Not in diff:**\n- `utils/format.ts:42` - unused import",
"comments": [
{
"path": "src/components/button.tsx",
"position": 7,
"body": "Missing null check:\n\n```suggestion\n if (!value) return null;\n```"
},
{
"path": "src/api/client.ts",
"position": 15,
"body": "Consider using `const` here since this is never reassigned."
}
]
}
- Body format:
Claude Code Generated:→{count} issues found.→**Not in diff:**with file:line refs
Suggestion Syntax
GitHub "suggested changes" let reviewees apply fixes with one click. Include a fenced code block with suggestion as the language:
Consider using `const`:
```suggestion
const value = true;
```
- Only works on single
+lines in the diff - The suggestion replaces the entire line - include correct indentation
- GitHub renders an "Apply suggestion" button for the PR author
Generating File Links
Use gh browse with -n and --commit to generate GitHub URLs pinned to the PR's commit:
gh browse path/to/file.ts:42 -n --commit=$COMMIT_SHA
# outputs: https://github.com/owner/repo/blob/<sha>/path/to/file.ts#L42
Use the headRefOid from step 1 as $COMMIT_SHA.
Notes
- CRITICAL: Omit
eventfield entirely to create pending (draft) review - Use
position, notlinefor reliable line attachment - Position must point to a line that exists in the diff
- Suggestion blocks only work on single
+lines in the diff
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon