code-review
40
总安装量
19
周安装量
#9553
全站排名
安装命令
npx skills add https://github.com/sgcarstrends/sgcarstrends --skill code-review
Agent 安装分布
claude-code
16
antigravity
12
gemini-cli
11
opencode
10
cursor
10
Skill 文档
Code Review Skill
Quick Checks
# Run all automated checks
pnpm biome check .
pnpm tsc --noEmit
pnpm test
# Search for common issues
grep -r "any" apps/ packages/ --include="*.ts" # any usage
grep -r "console.log" apps/ packages/ --include="*.ts" # debug logs
grep -r "TODO" apps/ packages/ --include="*.ts" # TODOs
Review Checklist
Functionality: Code works, edge cases handled, no obvious bugs
Code Quality: Readable, small focused functions, descriptive names, no duplication
Type Safety: No any, proper TypeScript types, well-defined interfaces
Testing: New code has tests, tests cover edge cases
Performance: No unnecessary re-renders, optimized queries, no N+1
Security: No SQL injection, XSS, or exposed secrets; input validation present
Common Anti-Patterns
// â Magic numbers â â
Use constants
if (user.age > 18) {} // Bad
if (user.age >= LEGAL_AGE) {} // Good
// â Deep nesting â â
Early returns
if (!user || !user.isActive) return;
// â Using any â â
Proper typing
function process(data: any) {} // Bad
function process(data: UserData) {} // Good
// â SQL injection â â
Parameterized queries
const query = `SELECT * FROM users WHERE id = ${userId}`; // Bad
db.query.users.findFirst({ where: eq(users.id, userId) }); // Good
// â N+1 queries â â
Single query with join
for (const post of posts) { post.author = await db.query.users... } // Bad
db.query.posts.findMany({ with: { author: true } }); // Good
// â Missing memoization â â
useMemo for expensive ops
const data = expensiveOperation(data); // Bad
const data = useMemo(() => expensiveOperation(data), [data]); // Good
Review Comments
Use these markers for clarity:
- ð´ Must Fix: Critical issues blocking merge (security, bugs)
- ð¡ Should Fix: Important but not blocking
- ð¢ Suggestion: Nice to have
- ð¡ Learning: Educational context
- â Question: Requesting clarification
Self-Review Before PR
git diff main...HEAD # View changes
pnpm biome check --write . # Format/lint
pnpm tsc --noEmit # Type check
pnpm test # Run tests
git diff --stat main...HEAD # Check PR size
Framework-Specific Checks
React: Check hooks usage, memoization, key props, useEffect deps Next.js: Server vs client components, ‘use client’ directive, metadata Drizzle: Proper indexing, N+1 queries, transactions
Best Practices
- Be Constructive: Focus on improvement, not criticism
- Explain Why: Provide context for suggestions
- Prioritize: Mark critical vs nice-to-have
- Be Timely: Review PRs promptly
References
- See
securityskill for security auditing - See
performanceskill for performance optimization