code-review
Reviews code changes for bugs, style issues, and best practices. Use when reviewing PRs, checking code quality, or validating changes before commit.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Code Review Skill
When reviewing code changes, follow this systematic approach to ensure quality and consistency.
Review Checklist
1. Correctness
- Does the code do what it's supposed to do?
- Are edge cases handled (null, empty, boundary values)?
- Are error conditions properly caught and handled?
- Is the logic correct and complete?
2. Type Safety
- Are types properly defined (no
anyorunknownwithout justification)? - Are nullable values handled with proper checks?
- Do function signatures match their implementations?
3. Architecture Compliance
Verify changes follow project patterns:
| Layer | Expected Pattern |
|---|---|
| Data Layer | Pure DB queries, no business logic |
| Service Layer | Business logic, caching, typed context (DbContext, AuthContext) |
| API Layer | createServerFn() with middleware chains |
4. Security
- Are user inputs validated (Zod schemas)?
- Is authentication/authorization properly enforced?
- Are sensitive data properly protected?
- No hardcoded secrets or credentials?
5. Performance
- Are there obvious inefficiencies (N+1 queries, unnecessary re-renders)?
- Is caching used appropriately?
- Are background tasks delegated to
waitUntilwhen appropriate?
6. Code Style
- Follows naming conventions (camelCase, PascalCase, kebab-case files)?
- Server Functions end with
Fnsuffix? - Proper use of semantic color variables for styling?
Review Process
Step 1: Understand Context
# View recent commits
git log -5 --oneline
# View staged changes
git diff --cached
# View unstaged changes
git diff
Step 2: Identify Changed Files
Categorize by type:
-
Backend (
.service.ts,.api.ts,.data.ts) -
Frontend (
.tsxin routes/components) -
Config (
.config.ts,wrangler.jsonc) -
Tests (
.test.ts)
Step 3: Review Each Change
For each file, check:
- What changed? (additions, deletions, modifications)
- Why? (bug fix, feature, refactor)
- Is it correct? (logic, types, patterns)
- Any concerns? (breaking changes, missing tests)
Step 4: Validate
# Type check
bun tsc --noEmit
# Lint and format
bun check
# Run tests if applicable
bun run test
Providing Feedback
Format
Structure feedback as:
## Summary
Brief overview of changes and overall assessment.
## Issues Found
- 🔴 **Critical**: Must fix before merge
- 🟡 **Warning**: Should fix, but not blocking
- 🔵 **Suggestion**: Nice to have improvements
## Specific Comments
File-by-file or section-by-section feedback with code references.
## Questions
Any clarifications needed from the author.
Tone Guidelines
- Be specific about what needs to change
- Explain why, not just what
- Suggest alternatives when possible
- Acknowledge good patterns and improvements
- Use questions for subjective preferences
Common Issues to Watch For
Backend
| Issue | Example | Fix |
|---|---|---|
| Wrong context type | context: any |
Use DbContext, AuthContext, etc. |
| Missing cache invalidation | Update without bumpVersion() |
Add cache invalidation |
| Workflow not triggered | Direct DB update on publish | Call workflow via binding |
Frontend
| Issue | Example | Fix |
|---|---|---|
| Missing loading state | No pendingComponent |
Add skeleton component |
| Stale query data | Missing queryKey invalidation |
Call queryClient.invalidateQueries() |
| Hardcoded colors | text-gray-500 |
Use text-muted-foreground |
Tests
| Issue | Example | Fix |
|---|---|---|
| Missing await | await seedUser() not awaited |
Add await |
| No background task wait | Assert immediately after async op | Use waitForBackgroundTasks() |
Using any |
as any cast |
Update test-utils or use proper types |
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!