Agent skill
code-review
Code review checklist for LobeHub. Use when reviewing PRs, diffs, or code changes. Covers correctness, security, quality, and project-specific patterns.
Install this agent skill to your Project
npx add-skill https://github.com/lobehub/lobehub/tree/canary/.agents/skills/code-review
SKILL.md
Code Review Guide
Before You Start
- Read
/typescriptand/testingskills for code style and test conventions - Get the diff (skip if already in context, e.g., injected by GitHub review app):
git difforgit diff origin/canary..HEAD
Checklist
Correctness
- Leftover
console.log/console.debug— should usedebugpackage or remove - Missing
return awaitin try/catch — see https://typescript-eslint.io/rules/return-await/ (not in our ESLint config yet, requires type info) - Can the fix/implementation be more concise, efficient, or have better compatibility?
Security
- No sensitive data (API keys, tokens, credentials) in
console.*ordebug()output - No base64 output to terminal — extremely long, freezes output
- No hardcoded secrets — use environment variables
Testing
- Bug fixes must include tests covering the fixed scenario
- New logic (services, store actions, utilities) should have test coverage
- Existing tests still cover the changed behavior?
- Prefer
vi.spyOnovervi.mock(see/testingskill)
i18n
- New user-facing strings use i18n keys, not hardcoded text
- Keys added to
src/locales/default/{namespace}.tswith{feature}.{context}.{action|status}naming - For PRs:
locales/translations for all languages updated (pnpm i18n)
SPA / routing
desktopRouterpair: If the diff touchessrc/spa/router/desktopRouter.config.tsx, does it also updatesrc/spa/router/desktopRouter.config.desktop.tsxwith the same route paths and nesting? Single-file edits often cause drift and blank screens.
Reuse
- Newly written code duplicates existing utilities in
packages/utilsor shared modules? - Copy-pasted blocks with slight variation — extract into shared function
antdimports replaceable with@lobehub/uiwrapped components (Input,Button,Modal,Avatar, etc.)- Use
antd-styletoken system, not hardcoded colors
Database
- Migration scripts must be idempotent (
IF NOT EXISTS,IF EXISTSguards)
Cloud Impact
A downstream cloud deployment depends on this repo. Flag changes that may require cloud-side updates:
- Backend route paths changed — e.g., renaming
src/app/(backend)/webapi/chat/route.tsor changing its exports - SSR page paths changed — e.g., moving/renaming files under
src/app/[variants]/(auth)/ - Dependency versions bumped — e.g., upgrading
nextordrizzle-orminpackage.json @lobechat/business-*exports changed — e.g., renaming a function insrc/business/or changing type signatures inpackages/business/src/business/andpackages/business/must not expose cloud commercial logic in comments or code
Output Format
For local CLI review only (GitHub review app posts inline PR comments instead):
- Number all findings sequentially
- Indicate priority:
[high]/[medium]/[low] - Include file path and line number for each finding
- Only list problems — no summary, no praise
- Re-read full source for each finding to verify it's real, then output "All findings verified."
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
task
i18n
Internationalization guide using react-i18next. Use when adding translations, creating i18n keys, or working with localized text in React components (.tsx files). Triggers on translation tasks, locale management, or i18n implementation.
data-fetching
Data fetching architecture guide using Service layer + Zustand Store + SWR. Use when implementing data fetching, creating services, working with store hooks, or migrating from useEffect. Triggers on data loading, API calls, service creation, or store data fetching tasks.
recent-data
Guide for using Recent Data (topics, resources, pages). Use when working with recently accessed items, implementing recent lists, or accessing session store recent data. Triggers on recent data usage or implementation tasks.
hotkey
Guide for adding keyboard shortcuts. Use when implementing new hotkeys, registering shortcuts, or working with keyboard interactions. Triggers on hotkey implementation or keyboard shortcut tasks.
debug
Debug package usage guide. Use when adding debug logging, understanding log namespaces, or implementing debugging features. Triggers on debug logging requests or logging implementation.
Didn't find tool you were looking for?