write-review-comment
Skill0 starsChanged 16 days agoMITView on GitHub
Post the result of a code review on a pull request as one comment in a fixed format. Use when a review of a PR is finished and its findings need to go on the PR, when re-checking fixes for earlier findings, or when asked to comment review findings on a PR.
In this repository2 other files it gives its agents.
- lead-agent-workflowSkill
- write-prSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 16
Write the comment in English, unless the repo's own rules name another language.
- Distinctive: line 20
Finish the review first: Write from the complete list of findings.
- Distinctive: line 21
Carry the findings over unchanged: Do not add, drop, merge or soften findings while formatting.
- Distinctive: line 30
Keep the ID across replacement reviewers.
- Distinctive: line 95
State facts about the code: No praise, no summary of the diff, no remarks about the author, no closing line.
- Very specific: line 97
Leave out an empty findings section: Always keep "Not covered".
- Distinctive: line 103
Never quote a secret: When the finding is an exposed credential or personal data, give the location and describe it.
- Very specific: line 150
Verify the head before posting: Read headRefOid again and compare it with the full reviewed SHA.
- Very specific: line 154
One comment per review ID, round and reviewed SHA: write the comment to a file and post it once with gh pr comment <number> --body-file …
- Very specific: line 156
Retry of that exact review ID, round and SHA: update only its recorded comment URL after checking the marker.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Writing a review comment
One review round produces one comment on the PR, and every finding of that round is in it. Never post one comment per finding, and never split a round across comments. This skill covers how the comment is written and posted, not how the review is done.
The comment has two readers: a person deciding whether to merge, and an agent that will fix the findings and may never open the browser. So the verdict comes first, every finding stands on its own, and nothing depends on GitHub rendering.
Write the comment in English, unless the repo's own rules name another language.
Before writing
- Finish the review first. Write from the complete list of findings.
- Carry the findings over unchanged. Do not add, drop, merge or soften findings while formatting. A finding that lacks a line of code or a failing scenario is not ready: get the evidence, or move it to "Not covered" as something you suspected and could not confirm.
- Use the commit actually reviewed. Capture the PR number, base and full head SHA before
reviewing (
gh pr view <number> --json headRefOid,baseRefName), and read that commit's diff and source. Get the repo withgh repo view --json nameWithOwner. A formatting-only handoff must supply the reviewed SHA; querying the current head cannot establish what was reviewed. - Look for earlier review comments on the PR (see "Posting"). Reuse the review ID for its follow-up rounds; assign a new unique ID to an independent review, even at the same head. Keep the ID across replacement reviewers. Read existing finding IDs before allocating new ones; parallel reviewers must coordinate allocation with the lead to avoid collisions.
First review
<!-- review-comment review=<review-id> round=1 head=<full reviewed SHA> -->
## Review: <Changes needed | No blocking findings> · <n> blocking, <m> not blocking
Reviewed `<base>...<head SHA, 7 chars>` · round 1 · <reviewer: model or agent name>
### Blocking
**F1** · [`<file>:<line>`](<permalink>) · <the defect in one line>
> `<the line of code it is about>`
Fails when: <the input or state, and the wrong result that follows>.
Fix: <what to change>.
### Not blocking
**F2** · [`<file>:<line>`](<permalink>) · <the defect in one line>
> `<the line of code it is about>`
Fails when: <scenario>.
Fix: <what to change>.
### Not covered
- <an area you did not read or could not verify, and why>A filled-in finding:
**F1** · [`src/billing/invoice.ts:88`](https://github.com/acme/shop/blob/4f2a9c1e7b3d5a6c8e0f1a2b3c4d5e6f7a8b9c0d/src/billing/invoice.ts#L88) · Discount is applied twice on retry
> `total = total - discount`
Fails when: the payment call times out and `charge()` retries; the second pass subtracts the
discount again, so a 100 order with a 10 discount is charged 80.
Fix: compute `total` from the order lines inside `charge()` instead of mutating it.Rules
- The first visible line is the verdict. "Changes needed" when at least one finding is blocking, otherwise "No blocking findings". The counts match the sections below.
- Blocking means a defect this change introduces that must be fixed before merge. Judge impact, likelihood and the source requirements together: a rare data-loss, money or security failure can still block. Existing unrelated defects, accepted small costs and suggestions are not blocking. Do not invent further severity levels or change the reviewer's classification merely to fit this format.
- Ids are
F1,F2, … in one sequence across both sections, blocking first, most severe first within a section. An id never changes and is never reused on the same PR. - Each finding has all four parts: location, quoted line, "Fails when", "Fix".
- Location: the path from the repo root and the line at the reviewed head, linked to a
permalink:
https://github.com/<owner>/<repo>/blob/<full head SHA>/<path>#L<line>, or#L<start>-L<end>for a range. Use the full SHA, never a branch name: a branch link points at different code after the next push. - Quoted line: the one line the finding is about, copied exactly. For a finding about missing code, quote the line where it belongs.
- Fails when: one concrete scenario with its wrong result. "May cause issues" is not a scenario.
- Fix: the change you suggest, in a sentence. Add a
diffblock only when the sentence would be ambiguous. Do not usesuggestionblocks; they render only in inline review comments.
- Location: the path from the repo root and the line at the reviewed head, linked to a
permalink:
- State facts about the code. No praise, no summary of the diff, no remarks about the author, no closing line. The PR description already says what the change does.
- Leave out an empty findings section. Always keep "Not covered"; write
- Nothingwhen the whole diff was read, so the reader knows the section was not forgotten. - Zero findings is a valid review. Post the comment anyway: marker, verdict line, reviewed range, "Not covered".
- Fold a long tail. With more than five not-blocking findings, wrap that section's findings in
<details><summary>Not blocking (<m>)</summary> … </details>. Never fold blocking findings. - Never quote a secret. When the finding is an exposed credential or personal data, give the location and describe it; leave the quoted line out.
Re-check after fixes
A re-check is a new comment, so the PR timeline shows which commits each round looked at. Reuse the ids of the earlier rounds and the same review ID; increment the round for a new re-check.
<!-- review-comment review=<review-id> round=<n> head=<full reviewed SHA> -->
## Re-check: <Changes needed | No blocking findings> · <n> open
Reviewed `<previous head SHA>..<new head SHA>` · round <n> · <reviewer>
- **F1** ADDRESSED
- **F2** NOT ADDRESSED: <what still fails, in one line>
- **F3** NOT ADDRESSED (not blocking)
### New findings from the fix
**F4** · [`<file>:<line>`](<permalink>) · <the defect in one line>
> `<the line of code it is about>`
Fails when: <scenario>.
Fix: <what to change>.
### Not covered
- <as in the first review>- List every finding that was still open after the previous round, one line each.
- New findings continue the numbering and cover the fix and affected execution paths, including
unchanged callers. Show how the fix causes the failure; unrelated pre-existing defects do not
expand the re-check. Say whether each is blocking by adding
(not blocking)after its title; without it, it is blocking. Leave the section out when there are none. - "Open" in the verdict line counts blocking findings that are not addressed, old and new.
Posting
Find the review comments already on the PR:
gh pr view <number> --json comments \
--jq '.comments[] | select(.body | startswith("<!-- review-comment")) | {url, marker: (.body | split("\n")[0])}'- Verify the head before posting. Read
headRefOidagain and compare it with the full reviewed SHA. If it changed, keep the original SHA and review the additional changes before publishing a current-head verdict. Never relabel an old review with the new SHA. A later push makes the comment historical; merge gates must compare its marker with the current head. - One comment per review ID, round and reviewed SHA: write the comment to a file and post it
once with
gh pr comment <number> --body-file <file>when that exact marker does not exist. - Retry of that exact review ID, round and SHA: update only its recorded comment URL after
checking the marker. Take the numeric id from the end of its URL and run
gh api -X PATCH repos/<owner>/<repo>/issues/comments/<id> -F body=@<file>. A matching head alone never permits overwriting another review. Older markers without a review ID remain history; update one only when the caller explicitly identifies that comment as the retry target. A new re-check round gets a new comment even if its head is unchanged. - Post a plain comment, not a review.
gh pr review --request-changesfails when the reviewer uses the same account as the PR author, which is the usual case for agents. - Fall back to REST when GraphQL is rate-limited:
gh api repos/<owner>/<repo>/issues/<number>/comments -F body=@<file>. - Check that it posted, then return the comment URL together with the findings to whoever asked for the review.
Credits
The blocking / not-blocking split follows Conventional Comments. "Not covered" is modelled on the "Declined to judge" section of the code-reviewer prompt in obra/superpowers.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

