Code Review
When to Use This Skill
- User asks for a code review of recent changes.
- User wants feedback on code quality, correctness, or style.
- User is preparing a PR and wants a pre-review check.
Goal
Review code changes with a focus on:
- Correctness: Does the code do what it's supposed to?
- Edge cases: Are error conditions handled?
- Style: Does it follow project conventions?
- Performance: Are there obvious inefficiencies?
Workflow (Agent Instructions)
Prefer reviewing the actual diff (what changed) rather than only reading current file contents.
1 Determine review scope
- Identify what you are reviewing:
- Local working tree changes, or
- A branch/PR compared to a base branch.
- For local changes, start with:
- For branch/PR-style review, pick a base branch (try
main then master) and use:
git diff <base>...HEAD --stat
git diff <base>...HEAD
2 Summarize what changed
- Run:
git diff --stat
git diff --cached --stat
- Provide a 3–6 bullet summary of the intent of the changes.
3 Review checklist (apply to the diff)
Correctness
- Look for logic errors, incorrect assumptions, and mismatched units/types.
- Validate function contracts: inputs/outputs, return types, side effects.
- Check that refactors preserve behavior (renames, moved code, split functions).
Edge cases
- Null/empty input handling.
- File/path handling (prefer
pathlib in this repo).
- Time-series/data issues: missing timestamps, empty DataFrames, NaNs.
- Defensive behavior: informative errors, safe fallbacks.
Style / Conventions
- PEP 8 formatting and readable naming.
- Prefer small, composable functions.
- Type hints when practical.
- Keep analysis logic aligned with existing conventions (7-day/30-day, 3-day comparisons).
- For CLI output, prefer existing
rich patterns.
Performance
- Identify obvious pandas anti-patterns (row-wise
.apply when vectorization works, repeated groupby/merge in loops).
- Avoid repeated file reads; prefer loading once and passing DataFrames through.
- Watch for N^2 operations on large datasets.
4 Scan for common foot-guns
Use diff + grep/search tools available in your shell/editor to flag:
breakpoint(, pdb, print( (unless clearly intentional)
TODO / FIXME
- commented-out blocks added
Examples (PowerShell):
git diff | Select-String -Pattern "breakpoint\(|print\(|TODO|FIXME"
git diff --cached | Select-String -Pattern "breakpoint\(|print\(|TODO|FIXME"
5 Basic validation
- Run unit tests:
- If tests fail, report the failing tests and key traceback lines.
How to Provide Feedback
- Be specific about what needs to change.
- Explain why, not just what.
- Suggest alternatives when possible.
- Distinguish blocking issues (bugs, crashes, wrong results) from non-blocking improvements (style, minor refactors).
Output Template
CODE REVIEW
Summary:
- ...
Blocking Issues:
- ...
Non-blocking Suggestions:
- ...
Risk / Notes:
- ...
Validation:
- Diff reviewed: (staged/unstaged or <base>...HEAD)
- Tests: PASS/FAIL (details)
Recommendation: APPROVE / REQUEST CHANGES
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: code-review-1723description: Reviews code changes for bugs, style issues, and best practices. Use when reviewing PRs or checking code quality. Use when this capability is needed.4---56# Code Review78## When to Use This Skill910- User asks for a code review of recent changes.11- User wants feedback on code quality, correctness, or style.12- User is preparing a PR and wants a pre-review check.1314## Goal1516Review code changes with a focus on:17181. **Correctness**: Does the code do what it's supposed to?192. **Edge cases**: Are error conditions handled?203. **Style**: Does it follow project conventions?214. **Performance**: Are there obvious inefficiencies?2223## Workflow (Agent Instructions)2425Prefer reviewing the actual diff (what changed) rather than only reading current file contents.2627### 1 Determine review scope28291. Identify what you are reviewing:30 - Local working tree changes, or31 - A branch/PR compared to a base branch.322. For local changes, start with:33 - `git status --porcelain`343. For branch/PR-style review, pick a base branch (try `main` then `master`) and use:35 - `git diff <base>...HEAD --stat`36 - `git diff <base>...HEAD`3738### 2 Summarize what changed39401. Run:4142 - `git diff --stat`43 - `git diff --cached --stat`442. Provide a 3–6 bullet summary of the intent of the changes.4546### 3 Review checklist (apply to the diff)4748#### Correctness4950- Look for logic errors, incorrect assumptions, and mismatched units/types.51- Validate function contracts: inputs/outputs, return types, side effects.52- Check that refactors preserve behavior (renames, moved code, split functions).5354#### Edge cases5556- Null/empty input handling.57- File/path handling (prefer `pathlib` in this repo).58- Time-series/data issues: missing timestamps, empty DataFrames, NaNs.59- Defensive behavior: informative errors, safe fallbacks.6061#### Style / Conventions6263- PEP 8 formatting and readable naming.64- Prefer small, composable functions.65- Type hints when practical.66- Keep analysis logic aligned with existing conventions (7-day/30-day, 3-day comparisons).67- For CLI output, prefer existing `rich` patterns.6869#### Performance7071- Identify obvious pandas anti-patterns (row-wise `.apply` when vectorization works, repeated groupby/merge in loops).72- Avoid repeated file reads; prefer loading once and passing DataFrames through.73- Watch for N^2 operations on large datasets.7475### 4 Scan for common foot-guns7677Use diff + grep/search tools available in your shell/editor to flag:7879- `breakpoint(`, `pdb`, `print(` (unless clearly intentional)80- `TODO` / `FIXME`81- commented-out blocks added8283Examples (PowerShell):8485- `git diff | Select-String -Pattern "breakpoint\(|print\(|TODO|FIXME"`86- `git diff --cached | Select-String -Pattern "breakpoint\(|print\(|TODO|FIXME"`8788### 5 Basic validation89901. Run unit tests:91 - `uv run pytest`923. If tests fail, report the failing tests and key traceback lines.9394## How to Provide Feedback9596- Be specific about what needs to change.97- Explain **why**, not just **what**.98- Suggest alternatives when possible.99- Distinguish **blocking** issues (bugs, crashes, wrong results) from **non-blocking** improvements (style, minor refactors).100101## Output Template102103```104CODE REVIEW105106Summary:107- ...108109Blocking Issues:110- ...111112Non-blocking Suggestions:113- ...114115Risk / Notes:116- ...117118Validation:119- Diff reviewed: (staged/unstaged or <base>...HEAD)120- Tests: PASS/FAIL (details)121122Recommendation: APPROVE / REQUEST CHANGES123```124125---126> Converted and distributed by [TomeVault](https://tomevault.io/claim/vierimaa) — claim your Tome and manage your conversions.127<!-- tomevault:4.0:skill_md:2026-04-14 -->