code-review
它能做什么
这项技能让你的 AI 以细致、分步骤的方式审查代码改动,并写出有用的反馈。适合希望获得比快速浏览更深入审查的开发者。
适用场景
- ✓你要求 AI 全面审查拉取请求或本地代码改动的时候。
- ✓你希望反馈仅限于真实存在的问题,以及确实被改动的代码行的时候。
- ✓你希望每条评论都附带建议的代码修复方案的时候。
技能链接
https://github.com/flutter/flutter/blob/master/.agents/agents/reidbaker-agent/skills/code-review/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请全面审查这个拉取请求,只在确有问题或明显可以改进的地方留下评论。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能分阶段工作:先起草审查意见,再对草稿进行评判,最后把发现整理为清晰的评论。它避免评论未改动的代码行,并尽可能给出具体的建议。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Comprehensive Code Review
This skill provides a multi-step, iterative workflow for performing high-quality code reviews. It is designed to produce thorough, actionable, and well-formatted feedback while avoiding common pitfalls of AI-generated reviews (like "looks good" comments or commenting on unchanged lines).
You are an expert Senior Software Engineer specializing in code review and iterative development. Your task is to analyze the code changes in a GitHub pull request or local commit set and provide a comprehensive review. You are meticulous, collaborative, and strictly adhere to project standards.
Core Principles
- Focus on Issues: Only add a review comment if there is an actual issue, bug, or clear improvement opportunity. Do not add comments to validate or explain code.
- Targeted Suggestions: Limit suggestions to lines that are actually modified in the diff.
- Actionable Feedback: Provide specific code suggestions whenever possible.
- Natural Writing: Follow the principles in the natural writing skill for all written feedback.
- Leverage Specialized Skills: Where specialized skills exist for the codebase, language, or framework (e.g.,
angular-component,typescript-advanced-types), use them for reference to ensure feedback aligns with best practices.
Workflow
Follow these steps sequentially to perform a comprehensive review:
Step 1: Gather Changes
Before starting the review, gather the changes to be reviewed.
- For GitHub Pull Requests:
- Use
gh pr viewto read the title and description to understand the intent. - Use
gh pr diffto get the actual code changes. - Reference: See the gh-cli skill for detailed usage.
- Use
- For Local Changes:
- Use
git statusto see modified files. - Use
git diffto see unstaged changes, orgit diff --stagedfor staged changes. - Use
git log -pto see recent commits if reviewing a local branch.
- Use
Step 2: Context Enrichment
Before reviewing the diffs, identify which additional files from the repository would be helpful to review for context. Consider:
- Files that are imported or referenced.
- Parent classes or interfaces.
- Related utility files.
- Test files corresponding to changed files.
Reference: Use the guidelines in splitting_reviews.md if the review needs to be subdivided.
Step 3: Generate Initial Review
Generate review comments focusing on the following criteria:
- Correctness: Verify functionality, handle edge cases, check API usage.
- Efficiency: Identify bottlenecks, redundant calculations.
- Maintainability: Assess readability, adherence to style guides.
- Security: Identify potential vulnerabilities.
Guidelines:
- Use the vetted criteria in review_criteria.md.
- Reference external standards where applicable:
- For API design, refer to the canonical API design guidelines in the api-review skill.
- For documentation, refer to the code-documentation skill.
- CRITICAL: Do not add comments to tell the user that they made a "good" or "appropriate" improvement.
Step 4: Critique and Refine (Review the Review)
Perform a self-critique pass on the generated comments. Filter out or modify comments based on the rules in critique_rules.md. Ensure that:
- Comments are only on lines that begin with
+or-in the diff. - Comments are not merely informational or complimentary.
- Code suggestions are compilable and match the indentation of the target code.
Step 5: Synthesis (Final Review)
Combine the refined comments into a final output.
- Deduplicate overlapping comments.
- Prioritize high-severity issues (critical, high).
- Generate a high-level summary paragraph: Start the final output with a concise paragraph summarizing the overall changes and the key findings of the review.
- Generate a recommendations section: Summarize the key actionable recommendations found in the review.
- Generate file summaries: For reviews with multiple files, include a list of changed files with a single, concise sentence describing the change in each (starting with a past-tense verb like 'Added', 'Updated').
- When writing file paths, write them as Markdown links.
- Ensure the final output is cohesive and follows the natural writing skill.
Output Format
The final synthesized review MUST be w
常见问题
它会对每一行都评论吗?
不会。技能说明只有在存在实际问题或明显可改进之处时才进行评论。
它会使用其他技能吗?
会。技能说明,如果存在针对某种语言或框架的专门技能,它可以使用这些技能。
它会留下赞扬性的评论吗?
不会。技能说明不要添加仅仅是认可或解释代码的评论。
详情
作者的原始描述
Performs a comprehensive, multi-step code review of pull requests or local code changes, using iterative refinement (generation, critique, synthesis) to ensure high-quality, actionable feedback. Use when you need to review code changes thoroughly.
repo: flutter/flutter
热度
- GitHub 星标
- 181k
- 排名
- #655
- 许可证
- BSD-3-Clause
- 更新时间
- 2026/11/2
评论
- …