.agents/skills/code-review/SKILL.md
You are a senior engineer conducting a thorough code review. Review only the lines that changed in this branch (via git diff main...HEAD) and provide actionable feedback on code quality. Do not flag issues in unchanged code.
Before starting the review, identify which files to review by checking:
Run git commands to check both:
git diff --name-only main...HEADgit status --shortAsk the user which set to review if both exist:
Proceed automatically if only one set exists:
Get the file list based on the user's choice:
git diff --name-only main...HEADgit diff --name-only and git diff --cached --name-onlyOnly proceed with the review once you have the specific list of files to review.
useState and useEffect used properly? Any unnecessary re-renders?const used by default? Is let only used when reassignment is needed? Is var avoided entirely?any? Are proper interfaces/types defined?as) used sparingly and only when necessary?!) avoided? They bypass TypeScript's null safety and hide bugs. Use proper null checks or optional chaining instead.useRef<T>(null) with RefObject<T | null>)? Refs are null on first render and during unmount.?.) used appropriately for potentially undefined values?<Button> not <button>, <Input> not <input>)?`max-w-[${variable}]`) break JIT compilation. Use static strings or conditional logic instead (e.g., condition ? 'max-w-[100px]' : 'max-w-[200px]').text-foreground, bg-card, text-muted-foreground) instead of hardcoded colors (e.g., text-black, bg-white)?en), are all other supported locales updated too? i18next falls back gracefully, but incomplete locales should be flagged.t() calls instead of hardcoded in JSX? Non-translatable symbols (icons, punctuation, HTML entities) are acceptable with an i18n-check-ignore annotation.console.log statements? (Remove them)useReducedMotion() respected for accessibility?modelId, modelName, defaults, or cached labels cleared or recomputed so stale state does not linger?Before reading any code, run the project's CI gate to establish a baseline. Use check-only commands so the baseline never mutates the working tree — otherwise auto-formatters can introduce unstaged diffs and you'll end up reviewing formatter output instead of the author's actual changes.
Avoid just check-everything as the baseline in this repo: that recipe runs cargo fmt --all in write mode and will modify the working tree. Run the non-mutating equivalents instead:
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
(cd ui/desktop && pnpm run lint:check)
./scripts/check-openapi-schema.sh
If the project has a stronger pre-push or CI gate than this helper set, run that fuller gate when the review is meant to be PR-ready, but only after confirming it is also non-mutating (or run it from a clean stash). In this repo, targeted tests for the changed area plus the pre-push checks are often the practical follow-up.
Report the results as pass/fail. Any failures are automatically P0 issues and should appear at the top of the findings list. Do not skip this step even if the user only wants a quick review.
For each file in the list:
git diff main...HEAD -- <file> to get the exact lines that changedAssign each issue a priority level:
If many high-severity issues exist in a file, assess whether a full refactor would be simpler than individual fixes.
After reviewing all files, provide:
Summary: Total files reviewed, overall quality rating (1-5 stars)
Issues: A single numbered list ordered by priority (P0 first, P4 last). Each issue must follow this exact format:
1. Short Issue Title (P0) [Must Fix]
- Description of the issue and why it matters
- Recommended fix
2. Short Issue Title (P3) [Your Call]
- Description of the issue and why it may or may not need addressing
- Recommended fix if the user chooses to act on it
Use a short, descriptive title (3–6 words max) so issues can be referenced by number (e.g. "fix issue 3").
Before presenting findings to the user, silently review the issue list three times:
After these passes, tag each surviving issue as one of:
Only present issues that survived these passes.
Before fixing, ask: "Would you like me to fix these issues in order? Or do you have questions about any of them first? I will fix each issue one by one and ask for approval before moving to the next one."
When approved, work through issues one at a time in numbered order (P0 → P4). After each fix:
Important: When adding documentation comments:
Explain each change as you make it. If an issue is too subjective or minor, skip it and note why.
Remember: Cleanup tasks like removing comments should always be done LAST, because earlier fixes might introduce new comments that also need removal.
Once all issues are fixed, display:
✅ Code review complete! All issues have been addressed.
Your code is ready to commit and push. Lefthook and CI will run the repo's configured gates when you push.
Next steps: generate a PR summary that explains the intent of this change, what files were modified and why, and how to verify the changes work.