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 #14385 from anthropics/fvolcic/inline-commentsBrowse files
Add inline comments with suggestions to code-review plugin
Franklin Volcic authored on Dec 17, 2025 · GitHub committed on Dec 17, 2025 parents 6880bcb + d2cb503 · commit b31e2fd1822f
1 changed file+24 -5compared with 6880bcb
Mplugins/code-review/commands/code-review.md
@@ -1,5 +1,5 @@
11 ---
2-allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*), Bash(gh pr list:*)
2+allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*), Bash(gh pr list:*), mcp__github_inline_comment__create_inline_comment
33 description: Code review a pull request
44 ---
55
@@ -11,7 +11,7 @@
1111 - The pull request is closed
1212 - The pull request is a draft
1313 - The pull request does not need code review (e.g. automated PR, trivial change that is obviously correct)
14- - You have already submitted a code review on this pull request
14+ - Claude has already commented on this PR (check `gh pr view <PR> --comments` for comments left by claude)
1515
1616 If any condition is true, stop and do not proceed.
1717
@@ -52,15 +52,34 @@
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. Finally, output the review.
56- - If the `--comment` argument is provided, post the review as a comment on the pull request using `gh pr comment`
57- - Otherwise (default), output the review directly to the terminal for local viewing
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."
59+
5860 When writing your comment, follow these guidelines:
5961 a. Keep your output brief
6062 b. Avoid emojis
6163 c. Link and cite relevant code, files, and URLs for each issue
6264 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")
6365
66+8. THEN post inline comments for each issue using `mcp__github_inline_comment__create_inline_comment`:
67+ - `path`: the file path
68+ - `line` (and `startLine` for ranges): select the buggy lines so the user sees them
69+ - `body`: Brief description of the issue (no "Bug:" prefix). For small fixes (up to 5 lines changed), include a committable suggestion:
70+ ```suggestion
71+ corrected code here
72+ ```
73+ For larger fixes (6+ lines or structural changes), do NOT use suggestion blocks. Instead:
74+ 1. Describe what the issue is
75+ 2. Explain the suggested fix at a high level
76+ 3. Include a copyable prompt for Claude Code that the user can use to fix the issue, formatted as:
77+ ```
78+ Fix [file:line]: [brief description of issue and suggested fix]
79+ ```
80+
81+ **IMPORTANT: Only post ONE comment per unique issue. Do not post duplicate comments.**
82+
6483 Use this list when evaluating issues in Steps 4 and 5 (these are false positives, do NOT flag):
6584
6685 - Pre-existing issues