Skip to content

Commit 72c9476

Browse files
committed
Change review-code skill to be openclaw friendly
1. Use gh instead of github mcp 2. Allow for non-interactive review 3. Remove reference to cursor workspaces
1 parent 0e65f88 commit 72c9476

File tree

1 file changed

+66
-87
lines changed

1 file changed

+66
-87
lines changed

.cursor/skills/review-code/SKILL.md

Lines changed: 66 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,45 @@ If a PR URL or number is provided:
3131

3232
If a branch name is provided (not a PR):
3333

34-
1. Identify the repository from the current working directory or the user's prompt
35-
2. Change to that repository directory
36-
3. Verify the branch exists and check it out:
34+
1. Identify the repository from the current working directory or the user's prompt. If a repo name is given, locate it as a peer directory of `edge-conventions` (see **Repository Synchronization** for details).
35+
2. Read the target repository's `AGENTS.md` and any `.cursor/rules/` files for repo-specific conventions.
36+
3. Change to that repository directory
37+
4. Verify the branch exists and check it out:
3738
```bash
3839
git fetch origin
3940
git checkout <branch-name>
4041
# Or if branch doesn't exist locally:
4142
git checkout -b <branch-name> origin/<branch-name>
4243
```
43-
4. Determine the base branch for comparison (typically `master` or `main`):
44+
5. Determine the base branch for comparison (typically `master` or `main`):
4445
```bash
4546
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
4647
```
47-
5. If the branch has uncommitted or unstaged changes (no commits beyond the base), use `git diff` for unstaged changes and `git diff --cached` for staged changes instead of `git diff <base>...HEAD`. No git checkout operations are needed in this case.
48-
6. Skip the GitHub MCP sections and proceed directly to **Review Process**
48+
6. If the branch has uncommitted or unstaged changes (no commits beyond the base), use `git diff` for unstaged changes and `git diff --cached` for staged changes instead of `git diff <base>...HEAD`. No git checkout operations are needed in this case.
49+
7. Skip the GitHub PR sections and proceed directly to **Review Process**
4950

5051
## Repository Synchronization (GitHub PRs)
5152

52-
1. Find the matching repository directory in the workspace by name (do NOT use absolute paths - search the workspace for a directory matching the repository name)
53-
2. Change to that repository directory
53+
1. Locate the target repository as a peer directory of `edge-conventions`. Determine the parent directory containing `edge-conventions` (e.g., if this skill is at `git/edge-conventions/.cursor/skills/review-code/SKILL.md`, the parent is `git/`). The target repo will be a sibling directory under that parent (e.g., `git/edge-react-gui` for the `edge-react-gui` repository).
54+
2. Read the target repository's `AGENTS.md` and any `.cursor/rules/` files to understand repo-specific conventions. Pass these as context to the review subagents.
55+
3. Change to that repository directory
5456

5557
### Detecting Fork vs Internal Branch
5658

57-
Use the GitHub MCP server to get PR metadata including the head repository owner:
59+
Get PR metadata including the head repository owner:
5860

59-
```
60-
CallMcpTool: user-github / pull_request_read
61-
Arguments: {
62-
"method": "get",
63-
"owner": "<base-repo-owner>",
64-
"repo": "<repo-name>",
65-
"pullNumber": <pr-number>
66-
}
61+
```bash
62+
gh pr view <pr-number> --repo <owner>/<repo> \
63+
--json headRefName,headRepositoryOwner,baseRefName,headRepository
6764
```
6865

69-
The response includes:
70-
- `head.repo.owner.login`: The owner of the source repository (fork owner or same org)
71-
- `head.ref`: The branch name in the source repo
72-
- `base.ref`: The target branch (usually "master" or "main")
73-
- `base.repo.owner.login`: The owner of the target repository
66+
The JSON response includes:
67+
- `headRepositoryOwner.login`: The owner of the source repository (fork owner or same org)
68+
- `headRefName`: The branch name in the source repo
69+
- `baseRefName`: The target branch (usually "master" or "main")
7470

7571
**Fork Detection Logic:**
76-
- If `head.repo.owner.login` equals `base.repo.owner.login`, it's an **internal branch**
72+
- If `headRepositoryOwner.login` matches the base repo owner, it's an **internal branch**
7773
- If they differ, it's a **fork** from an external user/organization
7874

7975
### GitHub PR Checkout
@@ -169,95 +165,78 @@ Provide a structured review with:
169165
- **Suggestions**: Consider for improvement
170166
- **Conventions Checklist**: Which conventions were checked and passed/failed
171167

172-
Save the review to a markdown document in the system temp directory (`/tmp` on macOS/Linux), then open it in the current Cursor workspace for the user to review:
173-
174-
```bash
175-
cursor --reuse-window <review-document-path>
176-
```
168+
Save the review to a markdown document in the system temp directory (`/tmp` on macOS/Linux).
177169

178170
Name the document:
179171
- **For PRs**: `MMDDhhmm_[repository-name]_[branch-name]_pr-[pr-number].md`
180172
- **For local branches**: `MMDDhhmm_[repository-name]_[branch-name]_review.md`
181173

182-
Pause for the user to review.
174+
**If running in the Cursor IDE GUI** (detected by the `CURSOR_TRACE_ID` environment variable being set), open the document in Cursor and pause for the user to review:
183175

184-
**For GitHub PRs only:** Once the user has iterated and agreed on the changes, submit the review to GitHub using the process below.
176+
```bash
177+
cursor --reuse-window <review-document-path>
178+
```
179+
180+
**If running from a terminal-based agent** (Cursor CLI, opencode, crush, or similar), print the full path to the saved document.
181+
182+
**For GitHub PRs only:** Submit the review to GitHub using the process below.
185183

186184
**For local branches:** After the user reviews, offer to help fix any issues found or create a PR if desired.
187185

188186
## Submitting PR Review with Inline Comments (GitHub PRs Only)
189187

190-
Use the GitHub MCP server to add comments inline to specific lines of code rather than one large summary comment. **Skip this section for local branch reviews.**
191-
192-
### Step 1: Create a Pending Review
188+
Use the `gh` CLI to add comments inline to specific lines of code rather than one large summary comment. **Skip this section for local branch reviews.**
193189

194-
```
195-
CallMcpTool: user-github / pull_request_review_write
196-
Arguments: {
197-
"method": "create",
198-
"owner": "<repo-owner>",
199-
"repo": "<repo-name>",
200-
"pullNumber": <pr-number>,
201-
"commitID": "<head-commit-sha>"
202-
}
203-
```
190+
### Step 1: Build and Submit the Review
204191

205-
**Note:** Do NOT include the `event` parameter yet - this creates a pending review that allows adding inline comments.
192+
Get the head commit SHA:
206193

207-
### Step 2: Add Inline Comments
194+
```bash
195+
gh pr view <pr-number> --repo <owner>/<repo> --json headRefOid --jq .headRefOid
196+
```
208197

209-
For each issue that references a specific file and line, add an inline comment:
198+
Create a JSON file with the review body, event, and all inline comments, then submit it in a single API call:
210199

211-
```
212-
CallMcpTool: user-github / add_comment_to_pending_review
213-
Arguments: {
214-
"owner": "<repo-owner>",
215-
"repo": "<repo-name>",
216-
"pullNumber": <pr-number>,
217-
"path": "src/path/to/file.ts",
218-
"line": <line-number>,
219-
"side": "RIGHT",
220-
"subjectType": "LINE",
221-
"body": "**Issue:** Description of the problem\n\n**Recommendation:**\n```typescript\n// suggested fix\n```"
200+
```bash
201+
cat > /tmp/review-payload.json << 'REVIEW_EOF'
202+
{
203+
"commit_id": "<head-commit-sha>",
204+
"event": "REQUEST_CHANGES",
205+
"body": "## Review Summary\n\n[Brief summary of critical issues and positive observations]\n\nSee inline comments for specific issues.",
206+
"comments": [
207+
{
208+
"path": "src/path/to/file.ts",
209+
"line": 42,
210+
"side": "RIGHT",
211+
"body": "**Issue:** Description of the problem\n\n**Recommendation:**\n```typescript\n// suggested fix\n```"
212+
},
213+
{
214+
"path": "src/path/to/other.ts",
215+
"start_line": 10,
216+
"line": 15,
217+
"start_side": "RIGHT",
218+
"side": "RIGHT",
219+
"body": "**Warning:** Multi-line comment spanning a range"
220+
}
221+
]
222222
}
223-
```
223+
REVIEW_EOF
224224

225-
For multi-line comments spanning a range:
226-
```
227-
Arguments: {
228-
...
229-
"startLine": <first-line>,
230-
"line": <last-line>,
231-
"startSide": "RIGHT",
232-
"side": "RIGHT",
233-
"subjectType": "LINE"
234-
}
225+
gh api repos/<owner>/<repo>/pulls/<pr-number>/reviews \
226+
--method POST \
227+
--input /tmp/review-payload.json
235228
```
236229

230+
Use `"event": "REQUEST_CHANGES"` for critical issues, `"event": "COMMENT"` for suggestions only, or `"event": "APPROVE"` if no issues found.
231+
232+
### Comment Guidelines
233+
237234
**Add inline comments for:**
238235
- Critical issues (with specific line references)
239236
- Warnings (with specific line references)
240237
- Suggestions that reference specific code locations
241238

242-
**Keep as summary only:**
239+
**Keep as summary body only:**
243240
- General observations without specific line references
244241
- Positive feedback
245242
- Commit message issues
246-
247-
### Step 3: Submit the Review
248-
249-
After adding all inline comments, submit the pending review:
250-
251-
```
252-
CallMcpTool: user-github / pull_request_review_write
253-
Arguments: {
254-
"method": "submit_pending",
255-
"owner": "<repo-owner>",
256-
"repo": "<repo-name>",
257-
"pullNumber": <pr-number>,
258-
"event": "REQUEST_CHANGES",
259-
"body": "## Review Summary\n\n[Brief summary of critical issues and positive observations]\n\nSee inline comments for specific issues."
260-
}
261-
```
262-
263-
Use `event: "REQUEST_CHANGES"` for critical issues, `event: "COMMENT"` for suggestions only, or `event: "APPROVE"` if no issues found.

0 commit comments

Comments
 (0)