code-review
Scannednpx machina-cli add skill JackyST0/awesome-agent-skills/code-review --openclawCode Review
智能代码审查技能,帮助审查代码质量、发现潜在问题、提供改进建议。
Smart code review skill that helps review code quality, identify potential issues, and provide improvement suggestions.
When to Use
当用户请求以下操作时使用此 skill:
- 审查代码 / Review code
- 检查代码质量 / Check code quality
- 寻找代码中的问题 / Find issues in code
- 请求代码改进建议 / Request improvement suggestions
Instructions
审查步骤 / Review Steps
- 阅读代码 - 仔细阅读提供的代码
- 检查问题:
- 语法错误 / Syntax errors
- 逻辑问题 / Logic issues
- 安全隐患 / Security vulnerabilities
- 性能问题 / Performance issues
- 代码风格 / Code style
- 提供建议 - 给出具体的改进建议
- 输出报告 - 使用标准格式生成审查报告
输出格式 / Output Format
## 代码审查报告 / Code Review Report
### 概述 / Summary
[简要总结 / Brief summary]
### 发现的问题 / Issues Found
- [ ] 问题 1 / Issue 1
- [ ] 问题 2 / Issue 2
### 改进建议 / Suggestions
1. 建议 1 / Suggestion 1
2. 建议 2 / Suggestion 2
### 评分 / Score
- 代码质量 / Code Quality: X/10
- 可读性 / Readability: X/10
- 可维护性 / Maintainability: X/10
Examples
输入 / Input
def calc(x,y):
return x+y
输出 / Output
代码审查报告
概述
简单的加法函数,存在命名和格式问题。
发现的问题
- 函数名
calc不具描述性 - 缺少类型提示
- 缺少文档字符串
- 运算符周围缺少空格
改进建议
- 将函数重命名为
add_numbers - 添加类型提示:
def add_numbers(x: int, y: int) -> int: - 添加 docstring 说明函数用途
- 遵循 PEP 8 格式规范
评分
- 代码质量: 6/10
- 可读性: 7/10
- 可维护性: 5/10
Source
git clone https://github.com/JackyST0/awesome-agent-skills/blob/main/examples/code-review/SKILL.mdView on GitHub Overview
Code Review is a smart skill that analyzes code quality, highlights syntax errors, logic flaws, security risks, performance bottlenecks, and style issues, and provides concrete improvement suggestions. It outputs a standardized Code Review Report to help developers fix issues efficiently.
How This Skill Works
The skill ingests the provided code, checks for common problem areas—including syntax, logic, security, performance, and style—and generates targeted improvement recommendations. It then outputs a Code Review Report in the standard format with a clear summary, issues, suggestions, and scoring.
When to Use It
- Review code to assess overall quality and correctness
- Check code quality, adherence to standards, and maintainability
- Find issues in code such as bugs, security gaps, or inefficiencies
- Request improvement suggestions with concrete remediation steps
- Audit patches or pull requests for potential regressions
Quick Start
- Step 1: Paste the code snippet and specify the language and context
- Step 2: Run the Code Review to analyze syntax, logic, security, performance, and style
- Step 3: Review the generated Code Review Report and apply the recommended changes
Best Practices
- Read the entire code segment carefully before identifying issues
- Prioritize issues by impact: security, correctness, performance, and maintainability
- Provide specific, actionable fixes with minimal, clear changes
- Cite concrete lines or snippets to illustrate recommendations
- Follow the project's coding standards and output the report in the standard format
Example Use Cases
- Reviewing a Python function with vague naming and missing type hints to propose a descriptive name and type annotations
- Auditing an API input validator for proper edge-case handling and robust error messages
- Identifying a potential SQL injection vulnerability in dynamically constructed queries
- Spotting a performance bottleneck caused by an O(n^2) loop and suggesting refactoring
- Ensuring code style consistency and maintainability across a module