Code Review Skill
Reviews diffs and PRs the way a senior engineer would: intent first, structure second, line-by-line third. Produces feedback grouped by severity (🔴 must / 🟡 should / 🟢 nit) with concrete suggestions. Does NOT rewrite the author's code — it directs, it does not replace.
When to Use
- Reviewing a pull request, branch diff, or staged changes.
- Auditing changes before merge.
- Self-reviewing the agent's own output before presenting it.
- Hunting for security, correctness, or performance regressions.
- The user asks "does this look right?" about a code change.
Prerequisites
- The
view, grep, and glob Copilot tools to read code.
git available so diffs can be inspected (git diff main, git log).
- Read access to the repository being reviewed.
- For PR-scoped review:
gh CLI authenticated to fetch PR metadata.
How to Run
1. Read the PR title, description, and linked issue.
2. List changed files (`git diff main --stat`) and assess scope.
3. Walk the diff with the `view` tool, file by file.
4. Apply the severity rubric below.
5. Emit a structured review block with concrete fixes.
Quick Reference
| Phase |
Tool |
What to check |
| Intent |
PR description, linked issue |
Why does this change exist? |
| Scope |
git diff main --stat |
Files changed match stated intent |
| Correctness |
view on hot paths |
Logic, null/edge handling, off-by-one |
| Security |
grep for secrets, raw SQL, eval |
Injection, auth bypass, leaked secrets |
| Performance |
view on loops, queries |
N+1, unbounded allocations, missing indexes |
| Tests |
view on test files |
New paths actually covered |
Procedure
Step 1: Understand Intent
Read the PR description, commit messages, and any linked issue. If intent is unclear, stop and ask the author — reviewing code whose purpose you don't understand wastes everyone's time.
Step 2: Structural Pass
Use git diff main --stat to size the change. Check:
- Does the file list match the stated scope?
- Are new dependencies justified?
- Does the change fit existing patterns in the repo?
- Is the deletion ratio healthy? (Good PRs often delete as much as they add.)
Step 3: Line-by-Line Pass
Walk each changed file with view. Apply the rubric:
| Category |
Look for |
| Correctness |
Logic errors, off-by-one, null handling, missing edge cases |
| Security |
Injection, auth bypass, secrets in code, weak input validation |
| Performance |
N+1 queries, unbounded allocations, missing indexes |
| Readability |
Naming, complexity, comments (too few or too many) |
| Testing |
New paths actually covered, tests meaningful (not assert-true) |
| Error handling |
Errors handled or silently swallowed |
Step 4: Emit Structured Feedback
## Review Summary
### 🔴 Must Fix (Blocking)
- `path/to/file.ts:42` — <issue> + **Suggestion:** <concrete fix>
### 🟡 Should Fix (Non-Blocking)
- `path/to/file.ts:88` — <issue> + **Suggestion:** <better approach>
### 🟢 Nit (Optional)
- `path/to/file.ts:120` — <style or preference point>
### ✅ What's Good
- <Highlight something done well — positive reinforcement matters.>
Pitfalls
- DO NOT rubber-stamp ("LGTM 👍") without reading the diff — worse than no review.
- DO NOT block a PR over formatting if a linter exists — that is the linter's job.
- DO NOT rewrite the author's code in the review thread. Suggest direction; do not freelance.
- DO NOT miss the forest for the trees. Catching a typo while missing a SQL injection is a bad trade.
- DO NOT review code you do not understand. Read the surrounding code first.
Verification
1---2name: code-review3description: Reviews diffs by severity to produce actionable feedback.4tier: practical5category: workflow6created_by: human7platforms: [windows, macos, linux]8tags: [review, quality, pr]9author: Andreas Wasita (@andreaswasita)10metadata:11 source: https://skillmd.com/skills/andreaswasita/code-review12---1314# Code Review Skill1516Reviews diffs and PRs the way a senior engineer would: intent first, structure second, line-by-line third. Produces feedback grouped by severity (🔴 must / 🟡 should / 🟢 nit) with concrete suggestions. Does NOT rewrite the author's code — it directs, it does not replace.1718## When to Use1920- Reviewing a pull request, branch diff, or staged changes.21- Auditing changes before merge.22- Self-reviewing the agent's own output before presenting it.23- Hunting for security, correctness, or performance regressions.24- The user asks "does this look right?" about a code change.2526## Prerequisites2728- The `view`, `grep`, and `glob` Copilot tools to read code.29- `git` available so diffs can be inspected (`git diff main`, `git log`).30- Read access to the repository being reviewed.31- For PR-scoped review: `gh` CLI authenticated to fetch PR metadata.3233## How to Run3435```text361. Read the PR title, description, and linked issue.372. List changed files (`git diff main --stat`) and assess scope.383. Walk the diff with the `view` tool, file by file.394. Apply the severity rubric below.405. Emit a structured review block with concrete fixes.41```4243## Quick Reference4445| Phase | Tool | What to check |46|---|---|---|47| Intent | PR description, linked issue | Why does this change exist? |48| Scope | `git diff main --stat` | Files changed match stated intent |49| Correctness | `view` on hot paths | Logic, null/edge handling, off-by-one |50| Security | `grep` for secrets, raw SQL, eval | Injection, auth bypass, leaked secrets |51| Performance | `view` on loops, queries | N+1, unbounded allocations, missing indexes |52| Tests | `view` on test files | New paths actually covered |5354## Procedure5556### Step 1: Understand Intent5758Read the PR description, commit messages, and any linked issue. If intent is unclear, stop and ask the author — reviewing code whose purpose you don't understand wastes everyone's time.5960### Step 2: Structural Pass6162Use `git diff main --stat` to size the change. Check:6364- Does the file list match the stated scope?65- Are new dependencies justified?66- Does the change fit existing patterns in the repo?67- Is the deletion ratio healthy? (Good PRs often delete as much as they add.)6869### Step 3: Line-by-Line Pass7071Walk each changed file with `view`. Apply the rubric:7273| Category | Look for |74|---|---|75| Correctness | Logic errors, off-by-one, null handling, missing edge cases |76| Security | Injection, auth bypass, secrets in code, weak input validation |77| Performance | N+1 queries, unbounded allocations, missing indexes |78| Readability | Naming, complexity, comments (too few or too many) |79| Testing | New paths actually covered, tests meaningful (not assert-true) |80| Error handling | Errors handled or silently swallowed |8182### Step 4: Emit Structured Feedback8384```markdown85## Review Summary8687### 🔴 Must Fix (Blocking)88- `path/to/file.ts:42` — <issue> + **Suggestion:** <concrete fix>8990### 🟡 Should Fix (Non-Blocking)91- `path/to/file.ts:88` — <issue> + **Suggestion:** <better approach>9293### 🟢 Nit (Optional)94- `path/to/file.ts:120` — <style or preference point>9596### ✅ What's Good97- <Highlight something done well — positive reinforcement matters.>98```99100## Pitfalls101102- **DO NOT** rubber-stamp ("LGTM 👍") without reading the diff — worse than no review.103- **DO NOT** block a PR over formatting if a linter exists — that is the linter's job.104- **DO NOT** rewrite the author's code in the review thread. Suggest direction; do not freelance.105- **DO NOT** miss the forest for the trees. Catching a typo while missing a SQL injection is a bad trade.106- **DO NOT** review code you do not understand. Read the surrounding code first.107108## Verification109110- [ ] Every changed file was opened with `view` at least once.111- [ ] Each issue cites a file and line number.112- [ ] Severity buckets used (🔴 / 🟡 / 🟢 / ✅).113- [ ] At least one positive observation included.114- [ ] If 🔴 issues exist, the PR is explicitly marked NOT ready to merge.