code-review-checklist by sickn33/antigravity-awesome-skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill code-review-checklist提供一个系统化的清单,用于进行彻底的代码审查。此技能帮助审查者确保代码质量、发现错误、识别安全问题,并保持整个代码库的一致性。
在审查代码之前,我将帮助你理解:
检查代码是否正确工作:
评估代码的可维护性:
检查安全问题:
寻找性能问题:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
验证测试覆盖率:
## 功能审查
### 需求
- [ ] 代码解决了所述问题
- [ ] 所有验收标准都已满足
- [ ] 边界情况已处理
- [ ] 错误情况已处理
- [ ] 用户输入已验证
### 逻辑
- [ ] 无逻辑错误或缺陷
- [ ] 条件正确(无差一错误)
- [ ] 循环正确终止
- [ ] 递归有适当的基准情况
- [ ] 状态管理正确
### 错误处理
- [ ] 错误被适当地捕获
- [ ] 错误信息清晰且有用
- [ ] 错误不会暴露敏感信息
- [ ] 失败的操作已回滚
- [ ] 日志记录适当
### 要捕获的示例问题:
**❌ 不好 - 缺少验证:**
```javascript
function createUser(email, password) {
// 没有验证!
return db.users.create({ email, password });
}
```
**✅ 好 - 适当的验证:**
```javascript
function createUser(email, password) {
if (!email || !isValidEmail(email)) {
throw new Error('Invalid email address');
}
if (!password || password.length < 8) {
throw new Error('Password must be at least 8 characters');
}
return db.users.create({ email, password });
}
```
## 安全审查
### 输入验证
- [ ] 所有用户输入都经过验证
- [ ] SQL 注入已预防(使用参数化查询)
- [ ] XSS 已预防(转义输出)
- [ ] CSRF 保护已就位
- [ ] 文件上传已验证(类型、大小、内容)
### 身份验证与授权
- [ ] 需要身份验证的地方已要求
- [ ] 授权检查存在
- [ ] 密码已哈希(绝不存储明文)
- [ ] 会话安全管理得当
- [ ] 令牌适时过期
### 数据保护
- [ ] 敏感数据已加密
- [ ] API 密钥未硬编码
- [ ] 环境变量用于存储密钥
- [ ] 个人数据遵循隐私法规
- [ ] 数据库凭据安全
### 依赖项
- [ ] 没有已知的易受攻击的依赖项
- [ ] 依赖项是最新的
- [ ] 不必要的依赖项已移除
- [ ] 依赖项版本已固定
### 要捕获的示例问题:
**❌ 不好 - SQL 注入风险:**
```javascript
const query = `SELECT * FROM users WHERE email = '${email}'`;
db.query(query);
```
**✅ 好 - 参数化查询:**
```javascript
const query = 'SELECT * FROM users WHERE email = $1';
db.query(query, [email]);
```
**❌ 不好 - 硬编码密钥:**
```javascript
const API_KEY = 'sk_live_abc123xyz';
```
**✅ 好 - 环境变量:**
```javascript
const API_KEY = process.env.API_KEY;
if (!API_KEY) {
throw new Error('API_KEY environment variable is required');
}
```
## 代码质量审查
### 可读性
- [ ] 代码易于理解
- [ ] 变量名具有描述性
- [ ] 函数名解释了其功能
- [ ] 复杂逻辑有注释
- [ ] 魔法数字已替换为常量
### 结构
- [ ] 函数小巧且专注
- [ ] 代码遵循 DRY 原则(不要重复自己)
- [ ] 关注点分离得当
- [ ] 代码风格一致
- [ ] 没有死代码或注释掉的代码
### 可维护性
- [ ] 代码是模块化的且可重用
- [ ] 依赖项最少
- [ ] 更改向后兼容
- [ ] 破坏性更改已记录
- [ ] 技术债务已注明
### 要捕获的示例问题:
**❌ 不好 - 命名不清晰:**
```javascript
function calc(a, b, c) {
return a * b + c;
}
```
**✅ 好 - 描述性命名:**
```javascript
function calculateTotalPrice(quantity, unitPrice, tax) {
return quantity * unitPrice + tax;
}
```
**❌ 不好 - 函数做太多事情:**
```javascript
function processOrder(order) {
// 验证订单
if (!order.items) throw new Error('No items');
// 计算总额
let total = 0;
for (let item of order.items) {
total += item.price * item.quantity;
}
// 应用折扣
if (order.coupon) {
total *= 0.9;
}
// 处理支付
const payment = stripe.charge(total);
// 发送邮件
sendEmail(order.email, 'Order confirmed');
// 更新库存
updateInventory(order.items);
return { orderId: order.id, total };
}
```
**✅ 好 - 关注点分离:**
```javascript
function processOrder(order) {
validateOrder(order);
const total = calculateOrderTotal(order);
const payment = processPayment(total);
sendOrderConfirmation(order.email);
updateInventory(order.items);
return { orderId: order.id, total };
}
```
症状: 代码在正常路径下工作,但在边界情况下失败 解决方案: 提出"如果...会怎样?"的问题
症状: 代码暴露安全风险 解决方案: 使用安全清单
症状: 新代码没有测试或测试不足 解决方案: 要求所有新代码都有测试
症状: 审查者无法理解代码的作用 解决方案: 请求改进
**问题:** [描述问题]
**当前代码:**
```javascript
// 显示有问题的代码
```
**建议的修复:**
```javascript
// 显示改进后的代码
```
**原因:** [解释为什么这样更好]
**问题:** [你的问题]
**上下文:** [你为什么提问]
**建议:** [如果你有的话]
**很好!** [你喜欢的地方]
这很棒,因为 [解释原因]
@requesting-code-review - 准备代码以供审查@receiving-code-review - 处理审查反馈@systematic-debugging - 调试审查中发现的问题@test-driven-development - 确保代码有测试专业提示: 为每次审查使用清单模板,以确保一致性和彻底性。根据你团队的具体需求进行定制!
每周安装数
523
仓库
GitHub 星标数
27.4K
首次出现
Jan 20, 2026
安全审计
安装于
opencode419
gemini-cli399
claude-code395
codex367
cursor356
github-copilot333
Provide a systematic checklist for conducting thorough code reviews. This skill helps reviewers ensure code quality, catch bugs, identify security issues, and maintain consistency across the codebase.
Before reviewing code, I'll help you understand:
Check if the code works correctly:
Assess code maintainability:
Check for security issues:
Look for performance issues:
Verify test coverage:
## Functionality Review
### Requirements
- [ ] Code solves the stated problem
- [ ] All acceptance criteria are met
- [ ] Edge cases are handled
- [ ] Error cases are handled
- [ ] User input is validated
### Logic
- [ ] No logical errors or bugs
- [ ] Conditions are correct (no off-by-one errors)
- [ ] Loops terminate correctly
- [ ] Recursion has proper base cases
- [ ] State management is correct
### Error Handling
- [ ] Errors are caught appropriately
- [ ] Error messages are clear and helpful
- [ ] Errors don't expose sensitive information
- [ ] Failed operations are rolled back
- [ ] Logging is appropriate
### Example Issues to Catch:
**❌ Bad - Missing validation:**
\`\`\`javascript
function createUser(email, password) {
// No validation!
return db.users.create({ email, password });
}
\`\`\`
**✅ Good - Proper validation:**
\`\`\`javascript
function createUser(email, password) {
if (!email || !isValidEmail(email)) {
throw new Error('Invalid email address');
}
if (!password || password.length < 8) {
throw new Error('Password must be at least 8 characters');
}
return db.users.create({ email, password });
}
\`\`\`
## Security Review
### Input Validation
- [ ] All user inputs are validated
- [ ] SQL injection is prevented (use parameterized queries)
- [ ] XSS is prevented (escape output)
- [ ] CSRF protection is in place
- [ ] File uploads are validated (type, size, content)
### Authentication & Authorization
- [ ] Authentication is required where needed
- [ ] Authorization checks are present
- [ ] Passwords are hashed (never stored plain text)
- [ ] Sessions are managed securely
- [ ] Tokens expire appropriately
### Data Protection
- [ ] Sensitive data is encrypted
- [ ] API keys are not hardcoded
- [ ] Environment variables are used for secrets
- [ ] Personal data follows privacy regulations
- [ ] Database credentials are secure
### Dependencies
- [ ] No known vulnerable dependencies
- [ ] Dependencies are up to date
- [ ] Unnecessary dependencies are removed
- [ ] Dependency versions are pinned
### Example Issues to Catch:
**❌ Bad - SQL injection risk:**
\`\`\`javascript
const query = \`SELECT * FROM users WHERE email = '\${email}'\`;
db.query(query);
\`\`\`
**✅ Good - Parameterized query:**
\`\`\`javascript
const query = 'SELECT * FROM users WHERE email = $1';
db.query(query, [email]);
\`\`\`
**❌ Bad - Hardcoded secret:**
\`\`\`javascript
const API_KEY = 'sk_live_abc123xyz';
\`\`\`
**✅ Good - Environment variable:**
\`\`\`javascript
const API_KEY = process.env.API_KEY;
if (!API_KEY) {
throw new Error('API_KEY environment variable is required');
}
\`\`\`
## Code Quality Review
### Readability
- [ ] Code is easy to understand
- [ ] Variable names are descriptive
- [ ] Function names explain what they do
- [ ] Complex logic has comments
- [ ] Magic numbers are replaced with constants
### Structure
- [ ] Functions are small and focused
- [ ] Code follows DRY principle (Don't Repeat Yourself)
- [ ] Proper separation of concerns
- [ ] Consistent code style
- [ ] No dead code or commented-out code
### Maintainability
- [ ] Code is modular and reusable
- [ ] Dependencies are minimal
- [ ] Changes are backwards compatible
- [ ] Breaking changes are documented
- [ ] Technical debt is noted
### Example Issues to Catch:
**❌ Bad - Unclear naming:**
\`\`\`javascript
function calc(a, b, c) {
return a * b + c;
}
\`\`\`
**✅ Good - Descriptive naming:**
\`\`\`javascript
function calculateTotalPrice(quantity, unitPrice, tax) {
return quantity * unitPrice + tax;
}
\`\`\`
**❌ Bad - Function doing too much:**
\`\`\`javascript
function processOrder(order) {
// Validate order
if (!order.items) throw new Error('No items');
// Calculate total
let total = 0;
for (let item of order.items) {
total += item.price * item.quantity;
}
// Apply discount
if (order.coupon) {
total *= 0.9;
}
// Process payment
const payment = stripe.charge(total);
// Send email
sendEmail(order.email, 'Order confirmed');
// Update inventory
updateInventory(order.items);
return { orderId: order.id, total };
}
\`\`\`
**✅ Good - Separated concerns:**
\`\`\`javascript
function processOrder(order) {
validateOrder(order);
const total = calculateOrderTotal(order);
const payment = processPayment(total);
sendOrderConfirmation(order.email);
updateInventory(order.items);
return { orderId: order.id, total };
}
\`\`\`
Symptoms: Code works for happy path but fails on edge cases Solution: Ask "What if...?" questions
Symptoms: Code exposes security risks Solution: Use security checklist
Symptoms: New code has no tests or inadequate tests Solution: Require tests for all new code
Symptoms: Reviewer can't understand what code does Solution: Request improvements
**Issue:** [Describe the problem]
**Current code:**
\`\`\`javascript
// Show problematic code
\`\`\`
**Suggested fix:**
\`\`\`javascript
// Show improved code
\`\`\`
**Why:** [Explain why this is better]
**Question:** [Your question]
**Context:** [Why you're asking]
**Suggestion:** [If you have one]
**Nice!** [What you liked]
This is great because [explain why]
@requesting-code-review - Prepare code for review@receiving-code-review - Handle review feedback@systematic-debugging - Debug issues found in review@test-driven-development - Ensure code has testsPro Tip: Use a checklist template for every review to ensure consistency and thoroughness. Customize it for your team's specific needs!
Weekly Installs
523
Repository
GitHub Stars
27.4K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode419
gemini-cli399
claude-code395
codex367
cursor356
github-copilot333
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
Google Apps Script 自动化脚本教程 - 免费实现 Google Sheets 与 Workspace 自动化
502 周安装
Sensei:GitHub Copilot for Azure技能合规性自动化改进工具
502 周安装
Electron 跨平台桌面应用开发教程 - 从入门到精通
1,100 周安装
Monorepo 包链接指南:pnpm/npm/yarn/bun 工作区依赖管理详解
502 周安装
Flutter无障碍访问与自适应设计指南:实现WCAG标准与响应式布局
974 周安装
Redis 性能优化最佳实践指南:数据结构、向量搜索、语义缓存与查询引擎
1,200 周安装