Skip to content

Commit a44a47d

Browse files
authored
chore: improvement to PR review skill (#15040)
* chore: improvement to PR review skill * fix help wanted * skip for no changes
1 parent 3314111 commit a44a47d

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

.claude/skills/reviewing-prs/SKILL.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Reviews GitHub pull requests for Medusa. Checks template compliance, contributio
1616

1717
- **Checking contribution guidelines?** → MUST load `reference/contribution-types.md` first
1818
- **Verifying code conventions?** → MUST load `reference/conventions.md` first
19-
- **Writing a review comment?** → MUST load `reference/comment-guidelines.md` first
19+
- **Writing a review comment?** → MUST load `reference/comment-guidelines.md` first (includes bug reporting format)
2020

2121
**Minimum requirement:** Load at least the relevant reference file(s) before completing the review.
2222

@@ -72,6 +72,7 @@ For each previously raised issue or remark, determine whether it has been addres
7272
- If **all prior issues are resolved** — acknowledge the progress in the new review comment and focus only on any remaining or new issues.
7373
- If **some prior issues remain unresolved** — carry them forward into the new review. Do not re-explain them in detail; reference them briefly (e.g., *"The changeset message format is still incorrect"*).
7474
- If **this is the first review** (no prior bot comments) — skip this step.
75+
- If **there is a prior review and nothing has changed** — no new issues, no resolved issues, no new concerns — **do not post a new comment**. Stop here.
7576

7677
> **CRITICAL:** Do not repeat the full explanation for issues already raised in a previous comment. Keep follow-up reviews concise — assume the contributor has read the prior feedback.
7778
@@ -109,7 +110,7 @@ If the PR has more than 500 changed lines (additions + deletions) **or** more th
109110
```bash
110111
bash scripts/get_linked_issues.sh <pr_number>
111112
```
112-
Check whether any linked issue carries a `help wanted` label. If not, apply `requires-more` and comment explaining that large contributions should be scoped and pre-approved via an issue first (reference `CONTRIBUTING.md`).
113+
Check whether any linked issue carries a `help-wanted` label. If not, apply `requires-more` and comment explaining that large contributions should be scoped and pre-approved via an issue first (reference `CONTRIBUTING.md`).
113114

114115
**4b. Security scan:**
115116

@@ -150,7 +151,27 @@ For mixed PRs, apply all relevant types.
150151

151152
Load `reference/conventions.md` and verify the changed files follow Medusa's conventions. Focus on the areas most relevant to the contribution type (e.g., API conventions for code changes, MDX structure for docs changes).
152153

153-
### Step 8 — Contextual Assessment
154+
### Step 8 — Bug Detection
155+
156+
Read the actual code diff carefully and look for potential bugs. Focus on:
157+
158+
- **Logic errors** — off-by-one, wrong conditionals, inverted boolean checks
159+
- **Null / undefined access** — accessing properties on values that may be null/undefined without guards
160+
- **Async issues** — missing `await`, unhandled promise rejections, race conditions
161+
- **Type mismatches** — passing wrong types, unsafe casts, implicit coercions
162+
- **Resource leaks** — unclosed DB connections, missing transaction rollbacks, unhandled errors in cleanup paths
163+
- **Edge cases not handled** — empty arrays, zero values, missing input validation
164+
- **Mutation side-effects** — mutating shared state or function arguments unexpectedly
165+
- **Incorrect error handling** — swallowed errors, rethrowing without context, wrong error types
166+
167+
For each potential bug found:
168+
- Note the **file and approximate location**
169+
- Briefly explain **why it's a bug or risk**
170+
- Suggest a **concrete fix** if one is obvious
171+
172+
> **CRITICAL:** Distinguish between confirmed bugs (clear logic/runtime errors) and code smell / style issues. Only flag something as a bug if it would plausibly cause incorrect behaviour at runtime.
173+
174+
### Step 9 — Contextual Assessment
154175

155176
Before writing the review, assess whether the changes make sense in the broader context of the PR. Load `reference/comment-guidelines.md` (Contextual Assessment section) for the full checklist. Key questions:
156177

@@ -162,7 +183,7 @@ Before writing the review, assess whether the changes make sense in the broader
162183

163184
Note any concerns to include in the review comment.
164185

165-
### Step 9 — Compose and Post Review
186+
### Step 10 — Compose and Post Review
166187

167188
Load `reference/comment-guidelines.md` for comment templates and tone guidance.
168189

.claude/skills/reviewing-prs/reference/comment-guidelines.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,34 @@ If concerns are found, include them in the review comment under a **"Concerns"**
7373

7474
Keep concerns concise and factual — describe the problem, not a lecture. If unsure whether something is actually a bug, phrase it as a question: *"Should `X` also handle the case where `Y` is null?"*
7575

76+
## Potential Bugs Section
77+
78+
When bugs are found in Step 8, include a **"Potential Bugs"** section in the review comment. This section is **always required** when bugs are found — for both `initial-approval` and `requires-more`.
79+
80+
- Confirmed bugs (will cause incorrect runtime behaviour) → add to **Required changes** and apply `requires-more`
81+
- Uncertain / possible bugs → include under **"Potential Bugs"** as a flagged concern, even on `initial-approval`
82+
83+
**Format:**
84+
85+
```
86+
**Potential Bugs:**
87+
88+
⚠️ **`path/to/file.ts`** — <one-line description of the bug>
89+
```typescript
90+
// the problematic snippet
91+
```
92+
<Explanation of why this is a problem and what could go wrong. If a fix is obvious, suggest it.>
93+
94+
⚠️ **`path/to/other-file.ts`** — <another bug>
95+
...
96+
```
97+
98+
**Rules:**
99+
- Always quote the relevant code snippet in a fenced code block so the author knows exactly what line is flagged
100+
- Be specific about the failure scenario — *"this will throw if `items` is empty"* not *"this looks wrong"*
101+
- If unsure, phrase as a question: *"Should this also handle the case where X is undefined?"*
102+
- Do not flag style issues or code smell here — only actual correctness/runtime concerns
103+
76104
## Security Risk Comment Template
77105
78106
Use when a potential (non-malicious) security risk is found. Include it as part of the review, not as a standalone comment.

0 commit comments

Comments
 (0)