Code Review
Perform thorough code review analyzing quality, potential bugs, security issues, and suggesting improvements.
Parameters
{
"type": "object",
"properties": {
"target": {
"type": "string",
"description": "File path, directory, or glob pattern to review"
},
"focus": {
"type": "string",
"enum": ["general", "security", "performance", "maintainability"],
"description": "Primary focus area",
"default": "general"
}
},
"required": ["target"]
}
When to Use
- User asks to "review" or "check" code
- User wants to find bugs or issues
- User asks about code quality
- User wants security analysis
- User asks for improvement suggestions
Methodology
Phase 1: Context Gathering
- Read the target files
- Understand the codebase structure
- Identify the programming language and framework
- Check for related tests and documentation
Phase 2: Analysis
- Logic Review: Check for bugs and edge cases
- Security Scan: Look for vulnerabilities (injection, auth issues, etc.)
- Performance Check: Identify bottlenecks and inefficiencies
- Style Review: Check consistency and best practices
Phase 3: Prioritization
- Categorize issues by severity (Critical, High, Medium, Low)
- Focus on actionable feedback
- Provide concrete examples
Phase 4: Output
Provide structured review with:
- Summary of findings
- Issues list with severity and line numbers
- Specific improvement suggestions
- Code examples where helpful
Guidelines
- Be constructive, not just critical
- Provide specific line references
- Explain WHY something is an issue
- Suggest concrete fixes, not just problems
- Acknowledge good patterns when found
- Consider the project's existing style
Examples
Example 1: File Review
User Input: "Review src/auth.ts for security issues"
Expected Behavior:
- Read the file and understand authentication flow
- Check for common security issues (SQL injection, XSS, weak crypto)
- Verify input validation and sanitization
- Check for proper error handling
- Provide prioritized list of findings with fixes
Example 2: Directory Review
User Input: "帮我 review 一下 src/utils/ 目录的代码质量"
Expected Behavior:
- 列出并读取目录中的所有文件
- 分析代码结构、命名、错误处理
- 检查是否有重复代码或可抽象的模式
- 用中文输出详细的 review 报告
- 按严重程度排序问题列表
1---
2name: code-review-6
3description: Use this skill when user asks to "review code", "check for issues", "analyze code quality", "find bugs", or wants feedback on code implementation.
4version: 1.0.0
5allowed-tools: [Read, Glob, Grep]
6---
7
8# Code Review
9
10Perform thorough code review analyzing quality, potential bugs, security issues, and suggesting improvements.
11
12## Parameters
13
14```json
15{
16 "type": "object",
17 "properties": {
18 "target": {
19 "type": "string",
20 "description": "File path, directory, or glob pattern to review"
21 },
22 "focus": {
23 "type": "string",
24 "enum": ["general", "security", "performance", "maintainability"],
25 "description": "Primary focus area",
26 "default": "general"
27 }
28 },
29 "required": ["target"]
30}
31```
32
33## When to Use
34
35- User asks to "review" or "check" code
36- User wants to find bugs or issues
37- User asks about code quality
38- User wants security analysis
39- User asks for improvement suggestions
40
41## Methodology
42
43### Phase 1: Context Gathering
44- Read the target files
45- Understand the codebase structure
46- Identify the programming language and framework
47- Check for related tests and documentation
48
49### Phase 2: Analysis
501. **Logic Review**: Check for bugs and edge cases
512. **Security Scan**: Look for vulnerabilities (injection, auth issues, etc.)
523. **Performance Check**: Identify bottlenecks and inefficiencies
534. **Style Review**: Check consistency and best practices
54
55### Phase 3: Prioritization
56- Categorize issues by severity (Critical, High, Medium, Low)
57- Focus on actionable feedback
58- Provide concrete examples
59
60### Phase 4: Output
61Provide structured review with:
62- Summary of findings
63- Issues list with severity and line numbers
64- Specific improvement suggestions
65- Code examples where helpful
66
67## Guidelines
68
69- Be constructive, not just critical
70- Provide specific line references
71- Explain WHY something is an issue
72- Suggest concrete fixes, not just problems
73- Acknowledge good patterns when found
74- Consider the project's existing style
75
76## Examples
77
78### Example 1: File Review
79
80**User Input**: "Review src/auth.ts for security issues"
81
82**Expected Behavior**:
831. Read the file and understand authentication flow
842. Check for common security issues (SQL injection, XSS, weak crypto)
853. Verify input validation and sanitization
864. Check for proper error handling
875. Provide prioritized list of findings with fixes
88
89### Example 2: Directory Review
90
91**User Input**: "帮我 review 一下 src/utils/ 目录的代码质量"
92
93**Expected Behavior**:
941. 列出并读取目录中的所有文件
952. 分析代码结构、命名、错误处理
963. 检查是否有重复代码或可抽象的模式
974. 用中文输出详细的 review 报告
985. 按严重程度排序问题列表