You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Code review a pull request, posting inline comments on the relevant lines
4
4
---
5
5
@@ -13,19 +13,22 @@ To do this, follow these steps precisely:
13
13
- The pull request is closed
14
14
- The pull request is a draft
15
15
- The pull request does not need code review (e.g. automated PR, trivial change that is obviously correct)
16
-
- You have already submitted a code review on this pull request
17
16
18
17
If any condition is true, stop and do not proceed.
19
18
19
+
A review submitted on an earlier run does NOT stop the process: every push re-triggers this command and the new head must be reviewed again. Step 2 collects the earlier findings so they are not posted twice.
20
+
20
21
Note: Still review Claude generated PR's.
21
22
22
-
2. Launch a haiku agent to return a list of file paths (not their contents) for all relevant CLAUDE.md files including:
23
+
2. Launch a haiku agent to list the inline review comments already posted on this pull request by claude[bot]. It must use exactly this command (only this URL form is permitted, with no leading slash): `gh api repos/gf712/python-cpp/pulls/{number}/comments`. For each comment, return the file path, line, and a one-sentence summary of the issue. Return an empty list if there are none. This list is used in step 7 to filter out findings that were already reported by a previous run.
24
+
25
+
3. Launch a haiku agent to return a list of file paths (not their contents) for all relevant CLAUDE.md files including:
23
26
- The root CLAUDE.md file, if it exists
24
27
- Any CLAUDE.md files in directories containing files modified by the pull request
25
28
26
-
3. Launch a sonnet agent to view the pull request and return a summary of the changes
29
+
4. Launch a sonnet agent to view the pull request and return a summary of the changes
27
30
28
-
4. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged (e.g. "CLAUDE.md adherence", "bug"). The agents should do the following:
31
+
5. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged (e.g. "CLAUDE.md adherence", "bug"). The agents should do the following:
29
32
30
33
Agents 1 + 2: CLAUDE.md compliance sonnet agents
31
34
Audit changes for CLAUDE.md compliance in parallel. Note: When evaluating CLAUDE.md compliance for a file, you should only consider CLAUDE.md files that share a file path with the file or parents.
@@ -50,11 +53,11 @@ Note: Still review Claude generated PR's.
50
53
51
54
In addition to the above, each subagent should be told the PR title and description. This will help provide context regarding the author's intent.
52
55
53
-
5. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. These subagents should get the PR title and description along with a description of the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. For example, if an issue such as "variable is not defined" was flagged, the subagent's job would be to validate that is actually true in the code. Another example would be CLAUDE.md issues. The agent should validate that the CLAUDE.md rule that was violated is scoped for this file and is actually violated. Use Opus subagents for bugs and logic issues, and sonnet agents for CLAUDE.md violations.
56
+
6. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. These subagents should get the PR title and description along with a description of the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. For example, if an issue such as "variable is not defined" was flagged, the subagent's job would be to validate that is actually true in the code. Another example would be CLAUDE.md issues. The agent should validate that the CLAUDE.md rule that was violated is scoped for this file and is actually violated. Use Opus subagents for bugs and logic issues, and sonnet agents for CLAUDE.md violations.
54
57
55
-
6. Filter out any issues that were not validated in step 5. This step will give us our list of high signal issues for our review.
58
+
7. Filter out any issues that were not validated in step 6. Then drop every issue that is already covered by an earlier claude[bot] comment from step 2 — the same underlying defect counts as covered even if the line numbers have shifted since the comment was posted. What remains is the list of new high signal issues for this run.
56
59
57
-
7. Finally, post the review on the pull request as inline comments, one per validated issue.
60
+
8. Finally, post the review on the pull request as inline comments, one per new issue from step 7.
58
61
For each issue, use the `mcp__github_inline_comment__create_inline_comment` tool to attach a comment to the exact file and line(s) where the issue occurs. Pass `confirmed: true`.
59
62
When writing each inline comment, follow these guidelines:
60
63
a. Keep your output brief
@@ -63,7 +66,7 @@ Note: Still review Claude generated PR's.
63
66
d. When citing CLAUDE.md violations, you MUST quote the exact text from CLAUDE.md that is being violated (e.g., CLAUDE.md says: "Use snake_case for variable names")
64
67
e. Only post GitHub comments — do not submit the review text as a chat/message response
65
68
66
-
Use this list when evaluating issues in Steps 4 and 5 (these are false positives, do NOT flag):
69
+
Use this list when evaluating issues in Steps 5 and 6 (these are false positives, do NOT flag):
67
70
68
71
- Pre-existing issues
69
72
- Something that appears to be a bug but is actually correct
@@ -89,22 +92,22 @@ Notes:
89
92
90
93
---
91
94
92
-
- After posting the inline comments, post one brief summary comment via `gh pr comment` using the following format precisely (assuming for this example that you found 3 issues):
95
+
- After posting the inline comments, post one brief summary comment via `gh pr comment` using the following format precisely (assuming for this example that this run found 3 new issues; count only the comments posted in this run):
93
96
94
97
---
95
98
96
99
## Code review
97
100
98
-
Found 3 issues — see the inline comments.
101
+
Found 3 new issues — see the inline comments.
99
102
100
103
---
101
104
102
-
- Or, if you found no issues, post a single summary comment via `gh pr comment` and do not post any inline comments:
105
+
- Or, if this run posted no inline comments, post a single summary comment via `gh pr comment` and do not post any inline comments:
103
106
104
107
---
105
108
106
109
## Auto code review
107
110
108
-
No issues found. Checked for bugs and CLAUDE.md compliance.
111
+
No new issues found. Checked for bugs and CLAUDE.md compliance.
0 commit comments