通用编程8.2k · #12527
code-review-checklist
它能做什么
这项技能为你的 AI 提供一份实用的代码改动评审清单。它涵盖正确性、安全性、速度、代码质量、测试和文档。适合希望进行仔细评审的开发者。
适用场景
- ✓当你要求 AI 在合并之前评审拉取请求或代码改动时。
- ✓当你想检查代码中的安全问题,例如注入或泄露的密钥时。
- ✓当你在评审 AI 编写的代码,并想查找提示注入或不安全输出时。
技能链接
https://github.com/vudovn/ag-kit/blob/main/.agents/skills/code-review-checklist/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
请用这个技能帮我:https://github.com/vudovn/ag-kit/blob/main/.agents/skills/code-review-checklist/SKILL.md
阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
npx skills add vudovn/ag-kit --skill code-review-checklist
下载 SKILL.md,放进智能体的技能文件夹。
curl -L https://raw.githubusercontent.com/vudovn/ag-kit/main/.agents/skills/code-review-checklist/SKILL.md -o SKILL.md
可以这样问 AI
“在我合并之前,请评审这项代码改动,检查其中的安全问题和漏洞。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能引导 AI 对每个领域逐条检查问题清单。AI 会对照这些问题检查代码,并报告任何未通过的项目。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Code Review Checklist
Quick Review Checklist
Correctness
- Code does what it's supposed to do
- Edge cases handled
- Error handling in place
- No obvious bugs
Security
- Input validated and sanitized
- No SQL/NoSQL injection vulnerabilities
- No XSS or CSRF vulnerabilities
- No hardcoded secrets or sensitive credentials
- AI-Specific: Protection against Prompt Injection (if applicable)
- AI-Specific: Outputs are sanitized before being used in critical sinks
Performance
- No N+1 queries
- No unnecessary loops
- Appropriate caching
- Bundle size impact considered
Code Quality
- Clear naming
- DRY - no duplicate code
- SOLID principles followed
- Appropriate abstraction level
Testing
- Unit tests for new code
- Edge cases tested
- Tests readable and maintainable
Documentation
- Complex logic commented
- Public APIs documented
- README updated if needed
AI & LLM Review Patterns
Logic & Hallucinations
- Chain of Thought: Does the logic follow a verifiable path?
- Edge Cases: Did the AI account for empty states, timeouts, and partial failures?
- External State: Is the code making safe assumptions about file systems or networks?
Prompt Engineering Review
// ❌ Vague prompt in code
const response = await ai.generate(userInput);
// ✅ Structured & Safe prompt
const response = await ai.generate({
system: "You are a specialized parser...",
input: sanitize(userInput),
schema: ResponseSchema
});
Anti-Patterns to Flag
// ❌ Magic numbers
if (status === 3) { ... }
// ✅ Named constants
if (status === Status.ACTIVE) { ... }
// ❌ Deep nesting
if (a) { if (b) { if (c) { ... } } }
// ✅ Early returns
if (!a) return;
if (!b) return;
if (!c) return;
// do work
// ❌ Long functions (100+ lines)
// ✅ Small, focused functions
// ❌ any type
const data: any = ...
// ✅ Proper types
const data: UserData = ...
Review Comments Guide
// Blocking issues use 🔴
🔴 BLOCKING: SQL injection vulnerability here
// Important suggestions use 🟡
🟡 SUGGESTION: Consider using useMemo for performance
// Minor nits use 🟢
🟢 NIT: Prefer const over let for immutable variable
// Questions use ❓
❓ QUESTION: What happens if user is null here?
常见问题
检查清单涵盖哪些领域?
正确性、安全性、性能、代码质量、测试和文档。
它包括针对 AI 功能的检查吗?
包括。它包含关于提示注入的条目,以及在使用 AI 输出之前进行清理的条目。
它也检查测试吗?
检查。它会询问新代码是否有单元测试,以及边界情况是否经过测试。
详情
作者的原始描述
Code review guidelines covering code quality, security, and best practices.
repo: vudovn/ag-kit
热度
- GitHub 星标
- 8.2k
- 排名
- #12527
- 许可证
- MIT
- 更新时间
- 2026/10/18
评论
- …