by supercent-io
此技能使AI助手能够通过检查bug、安全问题、代码质量和最佳实践来进行专业代码审查。它为拉取请求提供结构化反馈。
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 code-review 技能" 开始使用
=== code-review 技能 === 作者: supercent-io 描述: 此技能使AI助手能够通过检查bug、安全问题、代码质量和最佳实践来进行专业代码审查。它为拉取请求提供结构化反馈。 使用方法: 1. 调用技能: "使用 code-review 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 code-review 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
productivity
safe
Read the PR description:
Check the scope:
Architecture and design:
Code organization:
Naming:
Functions:
Classes and objects:
Error handling:
Code quality:
Input validation:
Authentication & Authorization:
Data protection:
Dependencies:
Algorithms:
Database:
Caching:
Resource management:
Test coverage:
Test quality:
Test naming:
# Good
def test_user_creation_with_valid_data_succeeds():
pass
# Bad
def test1():
pass
Code comments:
Function documentation:
def calculate_total(items: List[Item], tax_rate: float) -> Decimal:
"""
Calculate the total price including tax.
Args:
items: List of items to calculate total for
tax_rate: Tax rate as decimal (e.g., 0.1 for 10%)
Returns:
Total price including tax
Raises:
ValueError: If tax_rate is negative
"""
pass
README/docs:
Be constructive:
✅ Good:
"Consider extracting this logic into a separate function for better
testability and reusability:
def validate_email(email: str) -> bool:
return '@' in email and '.' in email.split('@')[1]
This would make it easier to test and reuse across the codebase."
❌ Bad:
"This is wrong. Rewrite it."
Be specific:
✅ Good:
"On line 45, this query could cause N+1 problem. Consider using
.select_related('author') to fetch related objects in a single query."
❌ Bad:
"Performance issues here."
Prioritize issues:
Acknowledge good work:
"Nice use of the strategy pattern here! This makes it easy to add
new payment methods in the future."
God class:
# Bad: One class doing everything
class UserManager:
def create_user(self): pass
def send_email(self): pass
def process_payment(self): pass
def generate_report(self): pass
Magic numbers:
# Bad
if user.age > 18:
pass
# Good
MINIMUM_AGE = 18
if user.age > MINIMUM_AGE:
pass
Deep nesting:
# Bad
if condition1:
if condition2:
if condition3:
if condition4:
# deeply nested code
# Good (early returns)
if not condition1:
return
if not condition2:
return
if not condition3:
return
if not condition4:
return
# flat code
SQL Injection:
# Bad
query = f"SELECT * FROM users WHERE id = {user_id}"
# Good
query = "SELECT * FROM users WHERE id = %s"
cursor.execute(query, (user_id,))
XSS:
// Bad
element.innerHTML = userInput;
// Good
element.textContent = userInput;
Hardcoded secrets:
# Bad
API_KEY = "sk-1234567890abcdef"
# Good
API_KEY = os.environ.get("API_KEY")
Linters:
Security:
Code quality:
View Count
0
Download Count
0
Favorite Count
0
Quality Score
73