.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.
Run these as passes, then consolidate findings before presenting them. A finding should appear once, even if multiple sections support it.
ui/goose2 maintainability, use UI Refactor Quality as the authoritative pass for decomposition, layering, hooks vs helpers, type hygiene, duplication, naming, module boundaries, and refactor structure.UI Refactor Quality pass. Prefer the UI Refactor Quality framing for ui/goose2 maintainability issues.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.catch blocks?console.log statements? (Remove them)useReducedMotion() respected for accessibility?modelId, modelName, defaults, or cached labels cleared or recomputed so stale state does not linger?Use this focused pass for ui/goose2 changes, especially when the user asks about cleanup, maintainability, decomposition, layering, type hygiene, duplication, dead code, readability, or extensibility.
Keep the focus on behavior-preserving frontend improvement. Favor the repo's existing architecture and patterns over generic frontend advice.
ui/goose2 boundaries: ui/, hooks/, api/, lib/, stores/, and shared/.Issue.Before finalizing the review, explicitly ask:
lib/?lib/ helpers with direct tests.Issue just because the PR already extracted some responsibilities.Issue.data, value, or handler.ui/: rendering and light view logic only.hooks/: glue between React state/effects and lower layers.api/: backend transport wrappers and DTO adaptation only.lib/: pure functions and domain helpers only.stores/: shared feature state only.api/ free of UI imports, path logic, and unrelated domain policy.lib/ free of React, DOM, window, and I/O.lib/ when the same normalization, formatting, or parsing logic appears in multiple modules.Issue even if the PR reduced the amount of misplaced logic.lib/.hooks/.Issue.Issue.src/shared/types/.Pick, Omit, and Partial over restating shapes by hand.any, unchecked as, non-null assertions, and string-encoded pseudo-unions when a discriminated union would be clearer.Issue.<main>, <nav>, <header>, and <aside>.<button> elements.<button> usage as a refactor smell unless there is a specific semantic or integration reason.<button> is genuinely necessary, it must use type="button" in goose2.cn() from @/shared/lib/cn for Tailwind class merging.react-i18next in already-migrated surfaces.catch blocks.SDK -> ACP -> goose.fetch() calls for goose core behavior.invoke() calls as proxies to goose core behavior; reserve them for desktop-shell concerns.shared/api/ or features/*/api/.Issue.Issues.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 changedui/goose2 refactors, run the UI Refactor Quality pass before finalizing findingsAssign 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
- User effect if this ships
- Recommended fix
2. Short Issue Title (P3) [Your Call]
- Description of the issue and why it may or may not need addressing
- User effect if this ships
- Recommended fix if the user chooses to act on it
Write the user-effect bullet in product language: describe what the user would experience, misunderstand, lose, or be blocked from doing if the issue reached production.
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:
ui/goose2 refactors, ask — did any confirmed final-shape smell survive in decomposition, layering, hooks/effects, pure helpers, type shapes, duplication, tests, or feature wiring?After these passes, tag each surviving issue as one of:
Only present issues that survived these passes.
Merge duplicate concerns before presenting findings. If the same underlying issue appears in multiple passes, report it once under the most specific applicable reason. Prefer the UI Refactor Quality framing for ui/goose2 maintainability issues.
Do not include an "Applied Well" section in the review output. If there are no issues, say that clearly and mention any remaining test gaps or residual risk.
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.