code-review
作者: anthropic
针对PR差异和文件变更的结构化代码审查,涵盖安全性、性能、正确性和可维护性。审计安全风险,包括SQL注入、XSS、CSRF、认证缺陷和凭证泄露;识别性能问题,如N+1查询、内存泄漏、算法复杂度和资源泄漏;检查正确性,涉及边界情况、竞态条件、错误处理和类型安全漏洞。可独立处理差异和文件路径,并与源代码控制集成...
npx skills add https://github.com/anthropics/knowledge-work-plugins --skill code-review/code-review
If you see unfamiliar placeholders or need to check which tools are connected, see CONNECTORS.md.
Review code changes with a structured lens on security, performance, correctness, and maintainability.
Usage
/code-review <PR URL or file path>
Review the provided code changes: @$1
If no specific file or URL is provided, ask what to review.
How It Works
┌─────────────────────────────────────────────────────────────────┐
│ CODE REVIEW │
├─────────────────────────────────────────────────────────────────┤
│ STANDALONE (always works) │
│ ✓ Paste a diff, PR URL, or point to files │
│ ✓ Security audit (OWASP top 10, injection, auth) │
│ ✓ Performance review (N+1, memory leaks, complexity) │
│ ✓ Correctness (edge cases, error handling, race conditions) │
│ ✓ Style (naming, structure, readability) │
│ ✓ Actionable suggestions with code examples │
├─────────────────────────────────────────────────────────────────┤
│ SUPERCHARGED (when you connect your tools) │
│ + Source control: Pull PR diff automatically │
│ + Project tracker: Link findings to tickets │
│ + Knowledge base: Check against team coding standards │
└─────────────────────────────────────────────────────────────────┘
Review Dimensions
Security
- SQL injection, XSS, CSRF
- Authentication and authorization flaws
- Secrets or credentials in code
- Insecure deserialization
- Path traversal
- SSRF
Performance
- N+1 queries
- Unnecessary memory allocations
- Algorithmic complexity (O(n²) in hot paths)
- Missing database indexes
- Unbounded queries or loops
- Resource leaks
Correctness
- Edge cases (empty input, null, overflow)
- Race conditions and concurrency issues
- Error handling and propagation
- Off-by-one errors
- Type safety
Maintainability
- Naming clarity
- Single responsibility
- Duplication
- Test coverage
- Documentation for non-obvious logic
Output
## Code Review: [PR title or file]
### Summary
[1-2 sentence overview of the changes and overall quality]
### Critical Issues
| # | File | Line | Issue | Severity |
|---|------|------|-------|----------|
| 1 | [file] | [line] | [description] | 🔴 Critical |
### Suggestions
| # | File | Line | Suggestion | Category |
|---|------|------|------------|----------|
| 1 | [file] | [line] | [description] | Performance |
### What Looks Good
- [Positive observations]
### Verdict
[Approve / Request Changes / Needs Discussion]
If Connectors Available
If ~~source control is connected:
- Pull the PR diff automatically from the URL
- Check CI status and test results
If ~~project tracker is connected:
- Link findings to related tickets
- Verify the PR addresses the stated requirements
If ~~knowledge base is connected:
- Check changes against team coding standards and style guides
Tips
- Provide context — "This is a hot path" or "This handles PII" helps me focus.
- Specify concerns — "Focus on security" narrows the review.
- Include tests — I'll check test coverage and quality too.
来自 anthropic 的更多技能
comps-analysis
anthropic
始终遵循此数据源层级:
official
analyzing-financial-statements
anthropic
该技能从财务报表数据中计算关键财务比率和指标,用于投资分析。
official
applying-brand-guidelines
anthropic
该技能为所有生成的文档应用一致的企业品牌和样式,包括颜色、字体、布局和信息传达。
official
cookbook-audit
anthropic
根据评分标准审核Anthropic Cookbook笔记本。每当请求笔记本审核或审计时使用。
official
creating-financial-models
anthropic
该技能提供了一套高级财务建模工具,包括DCF分析、敏感性测试、蒙特卡洛模拟以及投资情景规划等功能。
official
action-creator
anthropic
创建用户专属的一键操作模板,在聊天界面点击即可执行邮件操作。当用户需要可复用的操作时使用…
official
docx
anthropic
全面的文档创建、编辑和分析,支持修订、批注、格式保留和文本提取。当Claude…
official
executive-briefing
anthropic
将研究发现转化为可供高管使用的简报。当用户提及“executive”、“briefing”、“C-suite”、“board”等词时自动激活。
official