spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

Merge pull request #14527 from anthropics/fvolcic/code-review-updatesBrowse files
Improve code review inline comments
Franklin Volcic authored on Dec 18, 2025 · GitHub committed on Dec 18, 2025 parents b31e2fd + b8a2ffb · commit 5d2df70860a4
1 changed file+11 -36compared with b31e2fd
Mplugins/code-review/commands/code-review.md
@@ -52,25 +52,22 @@
5252
5353 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.
5454
55-7. Post summary comment FIRST using `gh pr comment` (if `--comment` argument is provided):
56- - Total number of issues found
57- - Brief one-line summary of each issue (no "Bug:" prefix)
58- - Or if no issues: "No issues found. Checked for bugs and CLAUDE.md compliance."
55+7. If issues were found, skip to step 8 to post inline comments directly.
5956
60- When writing your comment, follow these guidelines:
61- a. Keep your output brief
62- b. Avoid emojis
63- c. Link and cite relevant code, files, and URLs for each issue
64- 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")
57+ If NO issues were found, post a summary comment using `gh pr comment` (if `--comment` argument is provided):
58+ "No issues found. Checked for bugs and CLAUDE.md compliance."
6559
66-8. THEN post inline comments for each issue using `mcp__github_inline_comment__create_inline_comment`:
60+8. Post inline comments for each issue using `mcp__github_inline_comment__create_inline_comment`:
6761 - `path`: the file path
6862 - `line` (and `startLine` for ranges): select the buggy lines so the user sees them
6963 - `body`: Brief description of the issue (no "Bug:" prefix). For small fixes (up to 5 lines changed), include a committable suggestion:
7064 ```suggestion
7165 corrected code here
7266 ```
73- For larger fixes (6+ lines or structural changes), do NOT use suggestion blocks. Instead:
67+
68+ **Suggestions must be COMPLETE.** If a fix requires additional changes elsewhere (e.g., renaming a variable requires updating all usages), do NOT use a suggestion block. The author should be able to click "Commit suggestion" and have a working fix - no followup work required.
69+
70+ For larger fixes (6+ lines, structural changes, or changes spanning multiple locations), do NOT use suggestion blocks. Instead:
7471 1. Describe what the issue is
7572 2. Explain the suggested fix at a high level
7673 3. Include a copyable prompt for Claude Code that the user can use to fix the issue, formatted as:
@@ -93,40 +90,18 @@
9390
9491 - Use gh CLI to interact with GitHub (e.g., fetch pull requests, create comments). Do not use web fetch.
9592 - Create a todo list before starting.
96-- You must cite and link each issue (e.g., if referring to a CLAUDE.md, include a link to it).
97-- For your final comment, follow the following format precisely (assuming for this example that you found 3 issues):
93+- You must cite and link each issue in inline comments (e.g., if referring to a CLAUDE.md, include a link to it).
94+- If no issues are found, post a comment with the following format:
9895
9996 ---
10097
10198 ## Code review
10299
103-Found 3 issues:
104-
105-1. <brief description of bug> (CLAUDE.md says: "<exact quote from CLAUDE.md>")
106-
107-<link to file and line with full sha1 + line range for context, eg. https://github.com/anthropics/claude-code/blob/1d54823877c4de72b2316a64032a54afc404e619/README.md#L13-L17>
108-
109-2. <brief description of bug> (some/other/CLAUDE.md says: "<exact quote from CLAUDE.md>")
110-
111-<link to file and line with full sha1 + line range for context>
112-
113-3. <brief description of bug> (bug due to <file and code snippet>)
114-
115-<link to file and line with full sha1 + line range for context>
116-
117----
118-
119-- Or, if you found no issues:
120-
121----
122-
123-## Auto code review
124-
125100 No issues found. Checked for bugs and CLAUDE.md compliance.
126101
127102 ---
128103
129-- When linking to code, follow the following format precisely, otherwise the Markdown preview won't render correctly: https://github.com/anthropics/claude-code/blob/c21d3c10bc8e898b7ac1a2d745bdc9bc4e423afe/package.json#L10-L15
104+- When linking to code in inline comments, follow the following format precisely, otherwise the Markdown preview won't render correctly: https://github.com/anthropics/claude-code/blob/c21d3c10bc8e898b7ac1a2d745bdc9bc4e423afe/package.json#L10-L15
130105 - Requires full git sha
131106 - You must provide the full sha. Commands like `https://github.com/owner/repo/blob/$(git rev-parse HEAD)/foo/bar` will not work, since your comment will be directly rendered in Markdown.
132107 - Repo name must match the repo you're code reviewing