code-review 精选
Perform thorough code reviews with security, performance, and maintainability analysis. Use when user asks to review code, check for bugs, or audit a codebase.
安装方式
cp -r skills/code-review ~/.claude/skills/code-review把该 skill 目录放进客户端 skills 目录。不同客户端的目录可能不同,Claude Code 默认是 ~/.claude/skills/
https://raw.githubusercontent.com/shareAI-lab/learn-claude-code/ce8f9f186058939da54c9d6fead78dfb5d0fd6c3/skills/code-review/SKILL.md下载后另存为 ~/.claude/skills/code-review/SKILL.md。链接锁定采集时的 commit,内容与本站展示一致。
整仓一次性获取:git clone --depth 1 https://github.com/shareAI-lab/learn-claude-code.git
依赖与权限
- 需要 API Key —— 使用前需配置相应的密钥环境变量
- 无需联网
- 依赖外部命令:
gitnodenpmpythonpipcargogo - 以上为按正文与 frontmatter 自动推断的信号,仅供参考;安装前建议先阅读原文。
触发场景
user asks to review codecheck for bugsaudit a codebase
SKILL.md 正文
Code Review Skill
You now have expertise in conducting comprehensive code reviews. Follow this structured approach:
Review Checklist
1. Security (Critical)
Check for:
- [ ] Injection vulnerabilities: SQL, command, XSS, template injection
- [ ] Authentication issues: Hardcoded credentials, weak auth
- [ ] Authorization flaws: Missing access controls, IDOR
- [ ] Data exposure: Sensitive data in logs, error messages
- [ ] Cryptography: Weak algorithms, improper key management
- [ ] Dependencies: Known vulnerabilities (check with
npm audit,pip-audit)
# Quick security scans
npm audit # Node.js
pip-audit # Python
cargo audit # Rust
grep -r "password\|secret\|api_key" --include="*.py" --include="*.js"
2. Correctness
Check for:
- [ ] Logic errors: Off-by-one, null handling, edge cases
- [ ] Race conditions: Concurrent access without synchronization
- [ ] Resource leaks: Unclosed files, connections, memory
- [ ] Error handling: Swallowed exceptions, missing error paths
- [ ] Type safety: Implicit conversions, any types
3. Performance
Check for:
- [ ] N+1 queries: Database calls in loops
- [ ] Memory issues: Large allocations, retained references
- [ ] Blocking operations: Sync I/O in async code
- [ ] Inefficient algorithms: O(n^2) when O(n) possible
- [ ] Missing caching: Repeated expensive computations
4. Maintainability
Check for:
- [ ] Naming: Clear, consistent, descriptive
- [ ] Complexity: Functions > 50 lines, deep nesting > 3 levels
- [ ] Duplication: Copy-pasted code blocks
- [ ] Dead code: Unused imports, unreachable branches
- [ ] Comments: Outdated, redundant, or missing where needed
5. Testing
Check for:
- [ ] Coverage: Critical paths tested
- [ ] Edge cases: Null, empty, boundary values
- [ ] Mocking: External dependencies isolated
- [ ] Assertions: Meaningful, specific checks
Review Output Format
## Code Review: [file/component name]
### Summary
[1-2 sentence overview]
### Critical Issues
1. **[Issue]** (line X): [Description]
- Impact: [What could go wrong]
- Fix: [Suggested solution]
### Improvements
1. **[Suggestion]** (line X): [Description]
### Positive Notes
- [What was done well]
### Verdict
[ ] Ready to merge
[ ] Needs minor changes
[ ] Needs major revision
Common Patterns to Flag
Python
# Bad: SQL injection
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
# Good:
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
# Bad: Command injection
os.system(f"ls {user_input}")
# Good:
subprocess.run(["ls", user_input], check=True)
# Bad: Mutable default argument
def append(item, lst=[]): # Bug: shared mutable default
# Good:
def append(item, lst=None):
lst = lst or []
JavaScript/TypeScript
// Bad: Prototype pollution
Object.assign(target, userInput)
// Good:
Object.assign(target, sanitize(userInput))
// Bad: eval usage
eval(userCode)
// Good: Never use eval with user input
// Bad: Callback hell
getData(x => process(x, y => save(y, z => done(z))))
// Good:
const data = await getData();
const processed = await process(data);
await save(processed);
Review Commands
# Show recent changes
git diff HEAD~5 --stat
git log --oneline -10
# Find potential issues
grep -rn "TODO\|FIXME\|HACK\|XXX" .
grep -rn "password\|secret\|token" . --include="*.py"
# Check complexity (Python)
pip install radon && radon cc . -a
# Check dependencies
npm outdated # Node
pip list --outdated # Python
Review Workflow
- Understand context: Read PR description, linked issues
- Run the code: Build, test, run locally if possible
- Read top-down: Start with main entry points
- Check tests: Are changes tested? Do tests pass?
- Security scan: Run automated tools
- Manual review: Use checklist above
- Write feedback: Be specific, suggest fixes, be kind
质量与来源
- 所属仓库
- shareAI-lab/learn-claude-code
- 仓库星标
- 7.8 万
- 最近更新
- 14 天前
- 采集时间
- 今天
- commit
- ce8f9f186058
- 内容指纹
- sha256:a64c8c43b4962f2
- 文件路径
- skills/code-review/SKILL.md
同仓库其它 Skill
查看全部 4 个agent-builder
Design and build AI agents for any domain. Use when users: (1) ask to "create an agent", "build an assistant", or "design an AI system" (2) want to understand agent architecture, agentic patterns, or autonomous AI (3) need help with capabilities, subagents, planning, or skill mechanisms (4) ask about Claude Code, Cursor, or similar agent internals (5) want to build agents for business, research, creative, or operational tasks Keywords: agent, assistant, autonomous, workflow, tool use, multi-step, orchestration
mcp-builder
Build MCP (Model Context Protocol) servers that give Claude new capabilities. Use when user wants to create an MCP server, add tools to Claude, or integrate external services.
pdf
Process PDF files - extract text, create PDFs, merge documents. Use when user asks to read PDF, create PDF, or work with PDF files.
相似 Skill
更多「编码」access
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.
configure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how do I set this up" or "who can reach me," or wants to check channel status.
access
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the iMessage channel.
configure
Check iMessage channel setup and review access policy. Use when the user asks to configure iMessage, asks "how do I set this up" or "who can reach me," or wants to know why texts aren't reaching the assistant.
access
Manage Telegram channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Telegram channel.
configure
Set up the Telegram channel — save the bot token and review access policy. Use when the user pastes a Telegram bot token, asks to configure Telegram, asks "how do I set this up" or "who can reach me," or wants to check channel status.