Skip to content

Commit 9ba7c9b

Browse files
authored
feat(ci): use skills for claude review workflows (#1384)
1 parent 2e10890 commit 9ba7c9b

File tree

5 files changed

+139
-10
lines changed

5 files changed

+139
-10
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperlane-xyz/registry': patch
3+
---
4+
5+
Added inline PR comments skill and simplified Claude review workflows to use skills directly.

.claude/skills/claude-review/SKILL.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,25 @@ Use this skill to review code changes against Hyperlane Registry standards.
1616
## Instructions
1717

1818
Read and apply the guidelines from `.github/prompts/code-review.md` to review the code changes.
19+
20+
### For PR Reviews
21+
22+
When reviewing a PR, deliver feedback using `/inline-pr-comments` to post inline comments on specific lines.
23+
24+
**Delivery format:**
25+
26+
1. **Inline comments** - For all issues on lines IN the diff
27+
2. **Summary body** - For:
28+
- Overall assessment
29+
- Architecture concerns
30+
- Issues found OUTSIDE the diff (use "## Observations Outside This PR" section)
31+
32+
GitHub API limitation: Can only post inline comments on changed lines. Issues in unchanged code go in the summary body.
33+
34+
### For Self-Review
35+
36+
When reviewing your own changes before committing:
37+
38+
1. Run `git diff` to see changes
39+
2. Apply the code review guidelines
40+
3. Fix issues directly rather than commenting
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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.

.github/workflows/claude-code-review.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,11 @@ jobs:
6464
ref: ${{ steps.pr-sha.outputs.head_sha }}
6565
fetch-depth: 0
6666

67-
- name: Read code review prompt
68-
id: prompt
69-
run: |
70-
{
71-
echo 'content<<EOF'
72-
cat .github/prompts/code-review.md
73-
echo 'EOF'
74-
} >> $GITHUB_OUTPUT
75-
7667
- name: Run Claude Code Review
7768
uses: anthropics/claude-code-action@v1
7869
with:
7970
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
80-
prompt: ${{ steps.prompt.outputs.content }}
71+
prompt: Run /claude-review
8172
track_progress: true
8273
use_sticky_comment: true
8374
claude_args: |

AGENTS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,31 @@ We handle ONLY the most important cases. Don't add functionality unless it's sma
119119

120120
For code review guidelines, see `.github/prompts/code-review.md`.
121121

122+
### PR Review Comment Format
123+
124+
**Use inline comments** for specific feedback on code changes. Use the GitHub API to post reviews:
125+
126+
```bash
127+
gh api repos/{owner}/{repo}/pulls/{pr}/reviews --input - << 'EOF'
128+
{
129+
"event": "COMMENT",
130+
"body": "Overall summary (optional)",
131+
"comments": [
132+
{"path": "file.ts", "line": 42, "body": "Specific issue here"},
133+
{"path": "file.ts", "start_line": 10, "line": 15, "body": "Multi-line comment"}
134+
]
135+
}
136+
EOF
137+
```
138+
139+
| Feedback Type | Where |
140+
| -------------------- | --------------------------------------- |
141+
| Specific code issue | Inline comment on that line |
142+
| Repeated pattern | Inline on first, mention others in body |
143+
| Architecture concern | Summary body |
144+
145+
**Limitation**: Can only comment on lines in the diff (changed lines). Comments on unchanged code fail.
146+
122147
## Tips for AI Coding Sessions
123148

124149
1. **Run tests incrementally** - `pnpm run build && mocha` for specific test files

0 commit comments

Comments
 (0)