|
| 1 | +--- |
| 2 | +name: inline-pr-comments |
| 3 | +description: Post inline PR review comments on specific lines. Use this skill to deliver code review feedback as inline comments rather than a single summary. |
| 4 | +--- |
| 5 | + |
| 6 | +# Inline PR Comments Skill |
| 7 | + |
| 8 | +Use this skill to post code review feedback as inline comments on specific lines in a PR. |
| 9 | + |
| 10 | +## When to Use |
| 11 | + |
| 12 | +- After completing a code review (use with /claude-review, /claude-security-review) |
| 13 | +- When you have specific line-by-line feedback to deliver |
| 14 | +- To make review feedback more actionable |
| 15 | + |
| 16 | +## Instructions |
| 17 | + |
| 18 | +Post a review with inline comments using `gh api`: |
| 19 | + |
| 20 | +```bash |
| 21 | +gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews --input - << 'EOF' |
| 22 | +{ |
| 23 | + "event": "COMMENT", |
| 24 | + "body": "Optional summary of overall findings", |
| 25 | + "comments": [ |
| 26 | + { |
| 27 | + "path": "path/to/file.ts", |
| 28 | + "line": 42, |
| 29 | + "body": "Issue description and suggested fix" |
| 30 | + }, |
| 31 | + { |
| 32 | + "path": "another/file.ts", |
| 33 | + "start_line": 10, |
| 34 | + "line": 15, |
| 35 | + "body": "Multi-line comment spanning lines 10-15" |
| 36 | + } |
| 37 | + ] |
| 38 | +} |
| 39 | +EOF |
| 40 | +``` |
| 41 | + |
| 42 | +### Comment Fields |
| 43 | + |
| 44 | +- `path` - File path relative to repo root |
| 45 | +- `line` - Line number in the NEW version of the file (right side of diff) |
| 46 | +- `start_line` + `line` - For comments spanning multiple lines |
| 47 | +- `body` - Markdown-formatted feedback |
| 48 | + |
| 49 | +### Limitations |
| 50 | + |
| 51 | +- Can only comment on lines that appear in the diff (changed/added lines) |
| 52 | +- Comments on unchanged lines will fail with "Line could not be resolved" |
| 53 | + |
| 54 | +### Handling Non-Diff Findings |
| 55 | + |
| 56 | +When you discover issues in code NOT changed by the PR: |
| 57 | + |
| 58 | +1. **Include in summary body** - Always report in the `"body"` field |
| 59 | +2. **Format clearly** - Use a dedicated section "## Observations Outside This PR" |
| 60 | +3. **Be actionable** - Include file:line references so author can follow up |
| 61 | +4. **Don't block** - These are informational; don't use `REQUEST_CHANGES` for non-diff issues |
| 62 | + |
| 63 | +Example structure: |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "event": "COMMENT", |
| 68 | + "body": "## Review Summary\n[inline feedback summary]\n\n## Observations Outside This PR\nWhile reviewing, I noticed:\n- `src/utils/foo.ts:142`: Pre-existing null check missing\n- `src/core/bar.ts:78-82`: Similar pattern to line 45 issue - consider deduping", |
| 69 | + "comments": [ |
| 70 | + // Only lines IN the diff |
| 71 | + ] |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +### Feedback Guidelines |
| 76 | + |
| 77 | +| Feedback Type | In Diff? | Where to Put It | |
| 78 | +| ----------------------------- | -------- | --------------------------------------------------------- | |
| 79 | +| Specific code issue | Yes | Inline comment on that line | |
| 80 | +| Pattern repeated across files | Yes | Inline on first occurrence + note "same issue in X, Y, Z" | |
| 81 | +| Related issue found | No | Summary body under "Observations Outside This PR" | |
| 82 | +| Pre-existing bug discovered | No | Summary body (consider separate issue if critical) | |
| 83 | +| Overall architecture concern | N/A | Summary body | |
| 84 | +| Approval/changes requested | N/A | Use `event: "APPROVE"` or `event: "REQUEST_CHANGES"` | |
| 85 | + |
| 86 | +Be concise. Group minor style issues together. |
0 commit comments