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
此技能提供一套進階財務建模工具,包含現金流折現分析、敏感度測試、蒙地卡羅模擬及情境規劃,適用於投資…
official
action-creator
anthropic
建立使用者專屬的一鍵動作模板,點擊後可在聊天介面中執行電子郵件操作。當使用者想要可重複使用的動作時使用…
official
docx
anthropic
全面的文件創建、編輯與分析,支援追蹤修訂、註解、格式保留及文字擷取。當Claude…
official
executive-briefing
anthropic
將研究發現轉化為可供高階主管使用的簡報。當使用者提及「executive」、「briefing」、「C-suite」、「board」等詞時自動啟用。
official