reviewing-code
关于
This skill performs automated code reviews to analyze quality, identify bugs, and suggest improvements while checking for best practices. It is triggered when a developer requests a code review, code analysis, or a quality check. The process involves an initial analysis of the code's purpose and structure, followed by a multi-dimensional assessment of correctness and other quality factors.
技能文档
Code Reviewer
This skill performs comprehensive code reviews to improve quality, identify issues, and suggest best practices.
When to Use This Skill
Invoke this skill when the user:
- Asks for a code review
- Wants to check code quality
- Needs help identifying bugs or issues
- Requests best practice recommendations
- Mentions code analysis or improvement
Review Process
Step 1: Initial Analysis
Read the code and understand:
- Purpose and functionality
- Language and framework used
- Code structure and organization
- Dependencies and imports
Step 2: Quality Assessment
Evaluate code across multiple dimensions:
Correctness:
- Logic errors or bugs
- Edge cases handled
- Error handling implemented
- Return values appropriate
Readability:
- Clear variable/function names
- Consistent formatting
- Appropriate comments
- Logical code organization
Performance:
- Efficient algorithms
- No redundant operations
- Appropriate data structures
- Resource management
Security:
- Input validation
- No hardcoded credentials
- SQL injection prevention
- XSS protection (if applicable)
Maintainability:
- DRY principle followed
- Single responsibility
- Low coupling, high cohesion
- Easy to extend
Step 3: Generate Feedback
Provide structured feedback:
Critical Issues (must fix):
- Bugs that cause failures
- Security vulnerabilities
- Data loss risks
Warnings (should fix):
- Performance problems
- Maintainability issues
- Best practice violations
Suggestions (nice to have):
- Code style improvements
- Optimization opportunities
- Alternative approaches
Step 4: Code Examples
For each issue, provide:
- Location (file:line)
- Description of problem
- Why it matters
- Suggested fix with code example
Review Template
Use this structure for reviews:
## Code Review Summary
**Overall Quality:** [Excellent/Good/Fair/Needs Improvement]
**Lines Reviewed:** [Number]
**Critical Issues:** [Number]
**Warnings:** [Number]
**Suggestions:** [Number]
## Critical Issues
### 1. [Issue Title]
**Location:** file.py:42
**Problem:** [Description]
**Impact:** [Why this matters]
**Fix:**
```language
[Code example of suggested fix]
Warnings
[Same structure as Critical Issues]
Suggestions
[Same structure as Critical Issues]
Positive Observations
- [Good pattern 1]
- [Good pattern 2]
Overall Recommendations
[High-level guidance for improvement]
## Common Review Patterns
**Pattern 1: Bug Identification**
- Trace execution flow
- Check boundary conditions
- Verify error handling
- Test edge cases mentally
**Pattern 2: Security Review**
- Audit all user inputs
- Check authentication/authorization
- Review data handling
- Examine external calls
**Pattern 3: Performance Analysis**
- Identify bottlenecks
- Check algorithmic complexity
- Review database queries
- Examine loop efficiency
**Pattern 4: Maintainability Check**
- Assess code clarity
- Check for duplication
- Evaluate modularity
- Review documentation
## Language-Specific Checks
**Python:**
- PEP 8 compliance
- Pythonic idioms
- Type hints usage
- Exception handling
**JavaScript/TypeScript:**
- ESLint compatibility
- Async/await usage
- Type safety (TS)
- Modern syntax
**Go:**
- Error handling patterns
- Goroutine safety
- Interface usage
- Idiomatic Go
**Other Languages:**
- Follow language conventions
- Use standard library features
- Apply community best practices
## Example Review
**Input Code:**
```python
def get_user(id):
user = db.query("SELECT * FROM users WHERE id = " + id)
return user
Review Output:
Critical Issues
1. SQL Injection Vulnerability Location: example.py:2 Problem: String concatenation in SQL query allows injection attacks Impact: Attacker could execute arbitrary SQL, accessing or deleting data Fix:
def get_user(id):
user = db.query("SELECT * FROM users WHERE id = ?", (id,))
return user
Warnings
2. Missing Error Handling Location: example.py:1-3 Problem: No handling for invalid ID or database errors Impact: Function crashes on errors instead of graceful handling Fix:
def get_user(user_id):
try:
user = db.query("SELECT * FROM users WHERE id = ?", (user_id,))
return user if user else None
except DatabaseError as e:
logger.error(f"Database error retrieving user {user_id}: {e}")
return None
Suggestions
3. Parameter Naming
Location: example.py:1
Problem: Parameter named id shadows Python built-in
Impact: Minor - can cause confusion, not a functional issue
Fix:
def get_user(user_id):
# ... rest of function
Validation Checklist
Before completing review:
- All code sections examined
- Security vulnerabilities identified
- Performance issues noted
- Best practices applied
- Examples provided for fixes
- Positive patterns acknowledged
- Overall recommendations given
Review Scope Options
Quick Review:
- Focus on critical issues only
- Security and correctness
- 5-10 minutes
Standard Review:
- All quality dimensions
- Critical + warnings
- 15-30 minutes
Comprehensive Review:
- All dimensions + suggestions
- Alternative approaches
- Refactoring ideas
- 30+ minutes
Ask the user which scope they prefer if unclear.
快速安装
/plugin add https://github.com/jesseotremblay/claude-skills/tree/main/simple-skill-example在 Claude Code 中复制并粘贴此命令以安装该技能
GitHub 仓库
相关推荐技能
analyzing-dependencies
元这个Claude Skill能自动分析项目依赖的安全漏洞、过时包和许可证合规问题。它支持npm、pip、composer、gem和go modules等多种包管理器,帮助开发者识别潜在风险。当您需要检查依赖安全性、更新过时包或确保许可证兼容时,可使用"check dependencies"等触发短语来调用。
work-execution-principles
其他这个Claude Skill为开发者提供了一套通用的工作执行原则,涵盖任务分解、范围确定、测试策略和依赖管理。它确保开发活动中的一致质量标准,适用于代码审查、工作规划和架构决策等场景。该技能与所有编程语言和框架兼容,帮助开发者系统化地组织代码结构和定义工作边界。
Git Commit Helper
元Git Commit Helper能通过分析git diff自动生成规范的提交信息,适用于开发者编写提交消息或审查暂存区变更时。它能识别代码变更类型并自动匹配Conventional Commits规范,提供包含功能类型、作用域和描述的标准化消息。开发者只需提供git diff内容即可获得即用型的提交消息建议。
nextjs
开发This Next.js Skill provides architectural standards and BFF patterns for Next.js 15.5+ projects using App Router. It enforces clear server/client component separation, implements Server Actions and Route Handlers, and ensures performance optimization with SEO best practices. Use it when designing App Router structures, implementing data fetching strategies, or building BFF architectures.
