Skip to content
Back to search

code-review-skill

Provides comprehensive code review guidance for React 19, Vue 3, Angular 17+, Svelte 5, Rust, TypeScript, Java, Java 8, PHP, Ruby, Rails, Python, Django, FastAPI, Go, C#/.NET, Kotlin, Swift, Dart, Flutter, NestJS, C/C++, Zig, CSS/Less/Sass, Qt, and more. Covers architecture review, performance review, security audit, code quality anti-patterns, and common bugs across all ecosystems. Use when: reviewing pull requests, conducting PR reviews, code review, reviewing code changes, establishing review standards, mentoring developers, architecture reviews, security audits, performance reviews, checking code quality, finding bugs, giving feedback on code.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/awesome-skills-code-review-skill/badge.svg)](/listings/awesome-skills-code-review-skill)

HTML

<a href="/listings/awesome-skills-code-review-skill"><img src="/api/listings/awesome-skills-code-review-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 232 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. ---
  2. name: code-review-skill
  3. description: |
  4. Provides comprehensive code review guidance for React 19, Vue 3, Angular 17+, Svelte 5,
  5. Rust, TypeScript, Java, Java 8, PHP, Ruby, Rails, Python, Django, FastAPI, Go, C#/.NET, Kotlin, Swift,
  6. Dart, Flutter, NestJS, C/C++, Zig, CSS/Less/Sass, Qt, and more.
  7. Covers architecture review, performance review, security audit, code quality anti-patterns,
  8. and common bugs across all ecosystems.
  9. Use when: reviewing pull requests, conducting PR reviews, code review, reviewing code changes,
  10. establishing review standards, mentoring developers, architecture reviews, security audits,
  11. performance reviews, checking code quality, finding bugs, giving feedback on code.
  12. allowed-tools:
  13. - Read
  14. - Grep
  15. - Glob
  16. - Bash
  17. - WebFetch
  18. ---
  19. # Code Review Skill
  20. Transform code reviews from gatekeeping to knowledge sharing through constructive feedback, systematic analysis, and collaborative improvement.
  21. ## When to Use This Skill
  22. - Reviewing pull requests and code changes
  23. - Establishing code review standards for teams
  24. - Mentoring junior developers through reviews
  25. - Conducting architecture reviews
  26. - Creating review checklists and guidelines
  27. - Improving team collaboration
  28. - Reducing code review cycle time
  29. - Maintaining code quality standards
  30. ## Core Principles
  31. ### 1. The Review Mindset
  32. **Goals of Code Review:**
  33. - Catch bugs and edge cases
  34. - Ensure code maintainability
  35. - Share knowledge across team
  36. - Enforce coding standards
  37. - Improve design and architecture
  38. - Build team culture
  39. **Not the Goals:**
  40. - Show off knowledge
  41. - Nitpick formatting (use linters)
  42. - Block progress unnecessarily
  43. - Rewrite to your preference
  44. ### 2. Effective Feedback
  45. **Good Feedback is:**
  46. - Specific and actionable
  47. - Educational, not judgmental
  48. - Focused on the code, not the person
  49. - Balanced (praise good work too)
  50. - Prioritized (critical vs nice-to-have)
  51. ```markdown
  52. ❌ Bad: "This is wrong."
  53. ✅ Good: "This could cause a race condition when multiple users
  54. access simultaneously. Consider using a mutex here."
  55. ❌ Bad: "Why didn't you use X pattern?"
  56. ✅ Good: "Have you considered the Repository pattern? It would
  57. make this easier to test. Here's an example: [link]"
  58. ❌ Bad: "Rename this variable."
  59. ✅ Good: "[nit] Consider `userCount` instead of `uc` for
  60. clarity. Not blocking if you prefer to keep it."
  61. ```
  62. ### 3. Review Scope
  63. **What to Review:**
  64. - Logic correctness and edge cases
  65. - Security vulnerabilities
  66. - Performance implications
  67. - Test coverage and quality
  68. - Error handling
  69. - Documentation and comments
  70. - API design and naming
  71. - Architectural fit
  72. **What Not to Review Manually:**
  73. - Code formatting (use Prettier, Black, etc.)
  74. - Import organization
  75. - Linting violations
  76. - Simple typos
  77. ## Review Process
  78. ### Phase 1: Context Gathering (2-3 minutes)
  79. Before diving into code, understand:
  80. 1. Read PR description and linked issue
  81. 2. Check PR size (>400 lines? Ask to split)
  82. 3. Review CI/CD status (tests passing?)
  83. 4. Understand the business requirement
  84. 5. Note any relevant architectural decisions
  85. > For large diffs, pipe the diff through [`scripts/pr-analyzer.py`](scripts/pr-analyzer.py) (`git diff main...HEAD | python scripts/pr-analyzer.py`) to triage complexity and get a suggested review approach before reading.
  86. ### Phase 2: High-Level Review (5-10 minutes)
  87. 1. **Architecture & Design** - Does the solution fit the problem?
  88. - For significant changes, consult [Architecture Review Guide](reference/architecture-review-guide.md)
  89. - Check: SOLID principles, coupling/cohesion, anti-patterns
  90. 2. **Performance Assessment** - Are there performance concerns?
  91. - For performance-critical code, consult [Performance Review Guide](reference/performance-review-guide.md)
  92. - Check: Algorithm complexity, N+1 queries, memory usage
  93. 3. **File Organization** - Are new files in the right places?
  94. 4. **Testing Strategy** - Are there tests covering edge cases?
  95. ### Phase 3: Line-by-Line Review (10-20 minutes)
  96. For each file, check:
  97. - **Logic & Correctness** - Edge cases, off-by-one, null checks, race conditions
  98. - **Security** - Input validation, injection risks, XSS, sensitive data
  99. - **Performance** - N+1 queries, unnecessary loops, memory leaks
  100. - **Maintainability** - Clear names, single responsibility, comments
  101. - **Reuse** - Before accepting new code, search for existing utilities/helpers that could replace it. Check adjacent files and shared modules for similar patterns. See [Universal Quality Guide](reference/code-quality-universal.md) for anti-patterns like parameter sprawl, leaky abstractions, nested conditionals, stringly-typed code, TOCTOU, and no-op updates.
  102. ### Phase 4: Summary & Decision (2-3 minutes)
  103. 1. Summarize key concerns
  104. 2. Highlight what you liked
  105. 3. Make clear decision:
  106. - ✅ Approve
  107. - 💬 Comment (minor suggestions)
  108. - 🔄 Request Changes (must address)
  109. 4. Offer to pair if complex
  110. ## Review Techniques
  111. ### Technique 1: The Checklist Method
  112. Use checklists for consistent reviews. See [Security Review Guide](reference/security-review-guide.md) for comprehensive security checklist.
  113. ### Technique 2: The Question Approach
  114. Instead of stating problems, ask questions:
  115. ```markdown
  116. ❌ "This will fail if the list is empty."
  117. ✅ "What happens if `items` is an empty array?"
  118. ❌ "You need error handling here."
  119. ✅ "How should this behave if the API call fails?"
  120. ```
  121. ### Technique 3: Suggest, Don't Command
  122. Use collaborative language:
  123. ```markdown
  124. ❌ "You must change this to use async/await"
  125. ✅ "Suggestion: async/await might make this more readable. What do you think?"
  126. ❌ "Extract this into a function"
  127. ✅ "This logic appears in 3 places. Would it make sense to extract it?"
  128. ```
  129. ### Technique 4: Differentiate Severity
  130. Use labels to indicate priority:
  131. - 🔴 `[blocking]` - Must fix before merge
  132. - 🟡 `[important]` - Should fix, discuss if disagree
  133. - 🟢 `[nit]` - Nice to have, not blocking
  134. - 💡 `[suggestion]` - Alternative approach to consider
  135. - 📚 `[learning]` - Educational comment, no action needed
  136. - 🎉 `[praise]` - Good work, keep it up!
  137. **Severity levels:** 🔴 / 🟡 / 🟢 are the three severity tiers used as the standard across all guides in this skill — 🔴 blocks the merge, 🟡 should be addressed, 🟢 is optional. The remaining markers (💡 / 📚 / 🎉) are non-blocking annotations.
  138. ## Language-Specific Guides
  139. 根据审查的代码语言,查阅对应的详细指南:
  140. | Language/Framework | Reference File | Key Topics |
  141. |-------------------|----------------|------------|
  142. | **React** | [React Guide](reference/react.md) | Hooks, useEffect, React 19 Actions, RSC, Suspense, TanStack Query v5 |
  143. | **Vue 3** | [Vue Guide](reference/vue.md) | Composition API, 响应性系统, Props/Emits, Watchers, Composables |
  144. | **Angular 17+** | [Angular Guide](reference/angular.md) | Signals, Standalone, RxJS, Zoneless, 模板优化, 测试, 路由守卫, HttpInterceptor |
  145. | **Rust** | [Rust Guide](reference/rust.md) | 所有权/借用, Unsafe 审查, 异步代码, 取消安全性, 错误处理 |
  146. | **TypeScript** | [TypeScript Guide](reference/typescript.md) | 类型安全, async/await, 不可变性, 测试, 模块解析, TS 5.x |
  147. | **Python** | [Python Guide](reference/python.md) | 可变默认参数, 异常处理, 类属性 |
  148. | **Django / DRF** | [Django Guide](reference/django.md) | 安全审查, N+1 查询, Serializer 反模式, ViewSet, 异步视图 |
  149. | **FastAPI** | [FastAPI Guide](reference/fastapi.md) | Depends, Pydantic v2 validation, async correctness, sessions/N+1, auth vs authorization, test-driven verification |
  150. | **Java** | [Java Guide](reference/java.md) | Java 17/21 新特性, Spring Boot 3, 虚拟线程, Stream/Optional |
  151. | **Java 8 / Legacy** | [Java 8 Guide](reference/java8.md) | Java 8, Spring Boot 2, javax.*, Stream/Optional, java.time, CompletableFuture |
  152. | **PHP** | [PHP Guide](reference/php.md) | PHP 8.x type system, PDO, security review, Composer, PHPUnit/PHPStan |
  153. | **Ruby / Rails** | [Ruby Guide](reference/ruby.md) | Ruby semantics, Rails 8, Active Record, Active Job, security, testing |
  154. | **C# / .NET** | [C# Guide](reference/csharp.md) | C# 12 特性, 异步编程, EF Core 性能, ASP.NET Core, LINQ |
  155. | **Go** | [Go Guide](reference/go.md) | 错误处理, goroutine/channel, context, 接口设计 |
  156. | **Kotlin / Android** | [Kotlin Guide](reference/kotlin.md) | 协程, Flow, Jetpack Compose, 空安全, 内存泄漏, 架构模式 |
  157. | **Swift / SwiftUI** | [Swift Guide](reference/swift.md) | Optionals, Swift Concurrency, Sendable/actors, SwiftUI property wrappers, value vs reference types, API design |
  158. | **Dart / Flutter** | [Dart Guide](reference/dart.md) | Widget rebuilds, const constructors, null safety, isolates, async in build, Riverpod/Bloc, platform channels, keys, disposal |
  159. | **NestJS** | [NestJS Guide](reference/nestjs.md) | 依赖注入, 分层架构, DTO 验证, Guard/Interceptor, 循环依赖 |
  160. | **Svelte / SvelteKit** | [Svelte Guide](reference/svelte.md) | Runes, Load 函数, Form Actions, Store 迁移, SSR/CSR 边界 |
  161. | **C** | [C Guide](reference/c.md) | 指针/缓冲区, 内存安全, UB, 安全编码, 可移植性, 测试 |
  162. | **C++** | [C++ Guide](reference/cpp.md) | RAII, 智能指针, C++20/23, constexpr, 测试 |
  163. | **Zig** | [Zig Guide](reference/zig.md) | Allocators, error unions, defer/errdefer, comptime, C interop |
  164. | **CSS/Less/Sass** | [CSS Guide](reference/css-less-sass.md) | 变量规范, !important, 性能优化, 响应式, 兼容性 |
  165. | **Qt** | [Qt Guide](reference/qt.md) | 对象模型, 信号/槽, Model/View, QML, Qt6 迁移, 测试 |
  166. ## Cross-Cutting Guides
  167. Language-agnostic patterns applicable to all code reviews:
  168. | Topic | Reference File | Key Topics |
  169. |-------|----------------|------------|
  170. | **Architecture Review** | [Architecture Review Guide](reference/architecture-review-guide.md) | SOLID, anti-patterns, coupling/cohesion, dependency direction |
  171. | **Performance Review** | [Performance Review Guide](reference/performance-review-guide.md) | Web Vitals, N+1, algorithm complexity, memory leaks, caching |
  172. | **Security Review** | [Security Review Guide](reference/security-review-guide.md) | SQLi, XSS, CSRF, SSRF, IDOR, 命令注入, 跨语言示例 |
  173. | **Universal Quality** | [Universal Quality Guide](reference/code-quality-universal.md) | Reuse audit, parameter sprawl, leaky abstractions, nested conditionals, stringly-typed code, TOCTOU, no-op updates, redundant state |
  174. | **Common Bugs** | [Common Bugs Checklist](reference/common-bugs-checklist.md) | Language-specific bug patterns, common pitfalls |
  175. | **SQL Injection Prevention** | [SQL Injection Guide](reference/cross-cutting/sql-injection-prevention.md) | Parameterized queries, ORM safety, 6 languages, dynamic identifiers, detection |
  176. | **XSS Prevention** | [XSS Prevention Guide](reference/cross-cutting/xss-prevention.md) | Output encoding, CSP, 5 frameworks, input validation vs encoding, detection |
  177. | **N+1 Queries** | [N+1 Queries Guide](reference/cross-cutting/n-plus-one-queries.md) | Eager loading, batch fetching, DataLoader, 5 languages, detection |
  178. | **Error Handling** | [Error Handling Guide](reference/cross-cutting/error-handling-principles.md) | Fail fast, error hierarchy, 7 languages, anti-patterns, logging |
  179. | **Async & Concurrency** | [Concurrency Guide](reference/cross-cutting/async-concurrency-patterns.md) | Goroutines, async/await, actors, structured concurrency, 7 languages |
  180. | **Review Best Practices** | [Code Review Best Practices](reference/code-review-best-practices.md) | Communication, reviewer mindset, giving feedback, severity labels |
  181. ## Additional Resources
  182. - [PR Review Template](assets/pr-review-template.md) - PR 审查评论模板
  183. - [Review Checklist](assets/review-checklist.md) - 快速参考清单
README.md · README · 780 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. <h1>&#128269; Code Review Skill</h1>
  3. <p>
  4. <strong>A comprehensive, modular code review skill for Claude Code</strong><br/>
  5. <strong>面向 Claude Code 的全面模块化代码审查技能</strong>
  6. </p>
  7. <p>
  8. <a href="https://github.com/awesome-skills/code-review-skill/blob/main/LICENSE">
  9. <img src="https://img.shields.io/badge/License-MIT-22c55e?style=flat-square" alt="License: MIT"/>
  10. </a>
  11. <img src="https://img.shields.io/badge/Claude_Code-Skill-7c3aed?style=flat-square&logo=anthropic&logoColor=white" alt="Claude Code Skill"/>
  12. <img src="https://img.shields.io/badge/Total_Lines-21%2C000%2B-3b82f6?style=flat-square" alt="21000+ lines"/>
  13. <img src="https://img.shields.io/badge/Languages-20%2B-f59e0b?style=flat-square" alt="20+ languages"/>
  14. <img src="https://img.shields.io/badge/PRs-Welcome-ec4899?style=flat-square" alt="PRs Welcome"/>
  15. </p>
  16. <p>
  17. <a href="#english">English</a>
  18. &middot;
  19. <a href="#chinese">中文</a>
  20. &middot;
  21. <a href="./CONTRIBUTING.md">Contributing</a>
  22. </p>
  23. </div>
  24. ---
  25. <a name="english"></a>
  26. ## English
  27. ### What is this?
  28. **Code Review Skill** is a production-ready skill for [Claude Code](https://claude.ai/code) that transforms AI-assisted code review from vague suggestions into a **structured, consistent, and expert-level** process.
  29. It covers **20+ languages and frameworks** with over **21,000 lines** of carefully curated review guidelines — loaded progressively to minimize context window usage.
  30. ---
  31. ### &#10024; Key Features
  32. - **Progressive Disclosure** — Core skill is ~220 lines; language guides (~200–1,100 lines each) load only when needed.
  33. - **Four-Phase Review Process** — Structured workflow from understanding scope to delivering clear feedback.
  34. - **Severity Labeling** — Every finding is categorized: `blocking` · `important` · `nit` · `suggestion` · `learning` · `praise`
  35. - **Security-First** — Dedicated security checklists per language ecosystem.
  36. - **Collaborative Tone** — Questions over commands, suggestions over mandates.
  37. - **Automation Awareness** — Clearly separates what human review should catch vs. what linters handle.
  38. ---
  39. ### &#127760; Supported Languages & Frameworks
  40. <table>
  41. <thead>
  42. <tr>
  43. <th>Category</th>
  44. <th>Technology</th>
  45. <th>Guide</th>
  46. <th>Lines</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. <tr>
  51. <td rowspan="6"><strong>Frontend</strong></td>
  52. <td>&#9883;&#65039; React 19 / Next.js / TanStack Query v5</td>
  53. <td><code>reference/react.md</code></td>
  54. <td>~870</td>
  55. </tr>
  56. <tr>
  57. <td>&#128154; Vue 3.5 + Composition API</td>
  58. <td><code>reference/vue.md</code></td>
  59. <td>~920</td>
  60. </tr>
  61. <tr>
  62. <td>&#128302; Angular 17+ / Signals / Zoneless</td>
  63. <td><code>reference/angular.md</code></td>
  64. <td>~790</td>
  65. </tr>
  66. <tr>
  67. <td>&#128293; Svelte 5 / SvelteKit</td>
  68. <td><code>reference/svelte.md</code></td>
  69. <td>~1,060</td>
  70. </tr>
  71. <tr>
  72. <td>&#127912; CSS / Less / Sass</td>
  73. <td><code>reference/css-less-sass.md</code></td>
  74. <td>~660</td>
  75. </tr>
  76. <tr>
  77. <td>&#128311; TypeScript</td>
  78. <td><code>reference/typescript.md</code></td>
  79. <td>~1,020</td>
  80. </tr>
  81. <tr>
  82. <td rowspan="11"><strong>Backend</strong></td>
  83. <td>&#9749; Java 17/21 + Spring Boot 3</td>
  84. <td><code>reference/java.md</code></td>
  85. <td>~410</td>
  86. </tr>
  87. <tr>
  88. <td>&#9749; Java 8 + Spring Boot 2</td>
  89. <td><code>reference/java8.md</code></td>
  90. <td>~580</td>
  91. </tr>
  92. <tr>
  93. <td>&#9889; FastAPI</td>
  94. <td><code>reference/fastapi.md</code></td>
  95. <td>~590</td>
  96. </tr>
  97. <tr>
  98. <td>PHP 8.x</td>
  99. <td><code>reference/php.md</code></td>
  100. <td>~700</td>
  101. </tr>
  102. <tr>
  103. <td>&#128142; Ruby 3.4+/4.0 + Rails 8.x</td>
  104. <td><code>reference/ruby.md</code></td>
  105. <td>~960</td>
  106. </tr>
  107. <tr>
  108. <td>&#128230; NestJS</td>
  109. <td><code>reference/nestjs.md</code></td>
  110. <td>~590</td>
  111. </tr>
  112. <tr>
  113. <td>&#128013; Django / DRF</td>
  114. <td><code>reference/django.md</code></td>
  115. <td>~1,030</td>
  116. </tr>
  117. <tr>
  118. <td>&#128057; Go</td>
  119. <td><code>reference/go.md</code></td>
  120. <td>~990</td>
  121. </tr>
  122. <tr>
  123. <td>&#129408; Rust</td>
  124. <td><code>reference/rust.md</code></td>
  125. <td>~840</td>
  126. </tr>
  127. <tr>
  128. <td>&#128187; C# / .NET 8</td>
  129. <td><code>reference/csharp.md</code></td>
  130. <td>~520</td>
  131. </tr>
  132. <tr>
  133. <td>&#128013; Python</td>
  134. <td><code>reference/python.md</code></td>
  135. <td>~1,070</td>
  136. </tr>
  137. <tr>
  138. <td rowspan="7"><strong>Mobile / Systems</strong></td>
  139. <td>&#128241; Kotlin / Android</td>
  140. <td><code>reference/kotlin.md</code></td>
  141. <td>~1,020</td>
  142. </tr>
  143. <tr>
  144. <td>&#127822; Swift / SwiftUI</td>
  145. <td><code>reference/swift.md</code></td>
  146. <td>~930</td>
  147. </tr>
  148. <tr>
  149. <td>&#127919; Dart / Flutter</td>
  150. <td><code>reference/dart.md</code></td>
  151. <td>~650</td>
  152. </tr>
  153. <tr>
  154. <td>&#9881;&#65039; C</td>
  155. <td><code>reference/c.md</code></td>
  156. <td>~890</td>
  157. </tr>
  158. <tr>
  159. <td>&#128297; C++</td>
  160. <td><code>reference/cpp.md</code></td>
  161. <td>~890</td>
  162. </tr>
  163. <tr>
  164. <td>&#9889; Zig</td>
  165. <td><code>reference/zig.md</code></td>
  166. <td>~440</td>
  167. </tr>
  168. <tr>
  169. <td>&#128421;&#65039; Qt Framework</td>
  170. <td><code>reference/qt.md</code></td>
  171. <td>~760</td>
  172. </tr>
  173. <tr>
  174. <td rowspan="9"><strong>Cross-Cutting</strong></td>
  175. <td>&#127963;&#65039; Architecture Design Review</td>
  176. <td><code>reference/architecture-review-guide.md</code></td>
  177. <td>~470</td>
  178. </tr>
  179. <tr>
  180. <td>&#9889; Performance Review</td>
  181. <td><code>reference/performance-review-guide.md</code></td>
  182. <td>~820</td>
  183. </tr>
  184. <tr>
  185. <td>&#128269; Universal Quality Anti-Patterns</td>
  186. <td><code>reference/code-quality-universal.md</code></td>
  187. <td>~490</td>
  188. </tr>
  189. <tr>
  190. <td>&#128737;&#65039; Security Review</td>
  191. <td><code>reference/security-review-guide.md</code></td>
  192. <td>~640</td>
  193. </tr>
  194. <tr>
  195. <td>&#128200; N+1 Queries</td>
  196. <td><code>reference/cross-cutting/n-plus-one-queries.md</code></td>
  197. <td>~310</td>
  198. </tr>
  199. <tr>
  200. <td>&#9888;&#65039; Error Handling Principles</td>
  201. <td><code>reference/cross-cutting/error-handling-principles.md</code></td>
  202. <td>~490</td>
  203. </tr>
  204. <tr>
  205. <td>&#9889; Async &amp; Concurrency Patterns</td>
  206. <td><code>reference/cross-cutting/async-concurrency-patterns.md</code></td>
  207. <td>~540</td>
  208. </tr>
  209. <tr>
  210. <td>&#128737;&#65039; SQL Injection Prevention</td>
  211. <td><code>reference/cross-cutting/sql-injection-prevention.md</code></td>
  212. <td>~310</td>
  213. </tr>
  214. <tr>
  215. <td>&#128737;&#65039; XSS Prevention</td>
  216. <td><code>reference/cross-cutting/xss-prevention.md</code></td>
  217. <td>~260</td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. ---
  222. ### &#128260; The Four-Phase Review Process
  223. ```
  224. Phase 1 - Context Gathering
  225. Understand PR scope, linked issues, and intent
  226. |
  227. v
  228. Phase 2 - High-Level Review
  229. Architecture - Performance impact - Test strategy
  230. |
  231. v
  232. Phase 3 - Line-by-Line Analysis
  233. Logic - Security - Maintainability - Edge cases
  234. |
  235. v
  236. Phase 4 - Summary & Decision
  237. Structured feedback - Approval status - Action items
  238. ```
  239. ---
  240. ### &#127991;&#65039; Severity Labels
  241. | Label | Meaning |
  242. |-------|---------|
  243. | &#128308; `blocking` | Must be fixed before merge |
  244. | &#128992; `important` | Should be fixed; may block depending on context |
  245. | &#128993; `nit` | Minor style or preference issue |
  246. | &#128309; `suggestion` | Optional improvement worth considering |
  247. | &#128218; `learning` | Educational note for the author |
  248. | &#127775; `praise` | Explicitly highlight great work |
  249. ---
  250. ### &#128193; Repository Structure
  251. ```
  252. code-review-skill/
  253. |
  254. +-- SKILL.md # Core skill - loaded on activation (~220 lines)
  255. +-- README.md
  256. +-- LICENSE
  257. +-- CONTRIBUTING.md
  258. |
  259. +-- reference/ # On-demand language guides
  260. | +-- react.md # React 19 / Next.js / TanStack Query v5
  261. | +-- vue.md # Vue 3.5 Composition API
  262. | +-- angular.md # Angular 17+ / Signals / Zoneless
  263. | +-- svelte.md # Svelte 5 / SvelteKit
  264. | +-- rust.md # Rust ownership, async/await, unsafe
  265. | +-- typescript.md # TypeScript strict mode, generics, ESLint
  266. | +-- nestjs.md # NestJS DI, Guards, Interceptors, DTOs
  267. | +-- java.md # Java 17/21 & Spring Boot 3
  268. | +-- java8.md # Java 8 & Spring Boot 2 (legacy)
  269. | +-- php.md # PHP 8.x types, PDO, security, Composer
  270. | +-- ruby.md # Ruby 3.4+/4.0, Rails 8.x, Active Record/Job
  271. | +-- python.md # Python async, typing, pytest
  272. | +-- django.md # Django / DRF security, serializers, async
  273. | +-- fastapi.md # FastAPI Depends, Pydantic v2, async, test-driven verification
  274. | +-- go.md # Go goroutines, channels, context, interfaces
  275. | +-- kotlin.md # Kotlin / Android coroutines, Compose, Flow
  276. | +-- swift.md # Swift 5.9+/6, SwiftUI, concurrency, optionals
  277. | +-- dart.md # Dart / Flutter rebuilds, null safety, isolates, state
  278. | +-- csharp.md # C# 12 / .NET 8, EF Core, ASP.NET Core
  279. | +-- c.md # C memory safety, UB, error handling
  280. | +-- cpp.md # C++ RAII, move semantics, exception safety
  281. | +-- zig.md # Zig allocators, errors, comptime, C interop
  282. | +-- qt.md # Qt object model, signals/slots, GUI perf
  283. | +-- css-less-sass.md # CSS/Less/Sass variables, responsive design
  284. | +-- architecture-review-guide.md # SOLID, anti-patterns, coupling/cohesion
  285. | +-- code-quality-universal.md # Reuse audit, parameter sprawl, TOCTOU, no-op updates
  286. | +-- performance-review-guide.md # Core Web Vitals, N+1, memory leaks
  287. | +-- security-review-guide.md # Security checklist (all languages)
  288. | +-- common-bugs-checklist.md # Language-specific bug patterns
  289. | +-- code-review-best-practices.md # Communication & process guidelines
  290. |
  291. +-- reference/cross-cutting/ # Language-agnostic cross-cutting patterns
  292. | +-- sql-injection-prevention.md # Parameterized queries, 6 languages
  293. | +-- xss-prevention.md # Output encoding, CSP, 5 frameworks
  294. | +-- n-plus-one-queries.md # N+1 queries, eager loading, 5 languages
  295. | +-- error-handling-principles.md # Error handling principles, 7 languages
  296. | +-- async-concurrency-patterns.md # Concurrency patterns, 7 languages
  297. |
  298. +-- assets/
  299. | +-- review-checklist.md # Quick reference checklist
  300. | +-- pr-review-template.md # PR review comment template
  301. |
  302. +-- scripts/
  303. +-- pr-analyzer.py # PR complexity analyzer
  304. ```
  305. ---
  306. ### &#128640; Installation
  307. **Install with `npx skills` (Cursor, Claude Code, Codex, OpenCode, and other agents):**
  308. ```bash
  309. npx skills add awesome-skills/code-review-skill
  310. ```
  311. The skills CLI finds `SKILL.md` at the repo root. Do not nest this skill under `skills/`.
  312. **Or clone into the Claude Code skills directory:**
  313. ```bash
  314. # macOS / Linux
  315. git clone https://github.com/awesome-skills/code-review-skill.git \
  316. ~/.claude/skills/code-review-skill
  317. # Windows (PowerShell)
  318. git clone https://github.com/awesome-skills/code-review-skill.git `
  319. "$env:USERPROFILE\.claude\skills\code-review-skill"
  320. ```
  321. **Or add to an existing plugin:**
  322. ```bash
  323. cp -r code-review-skill ~/.claude/plugins/your-plugin/skills/code-review/
  324. ```
  325. ---
  326. ### &#128161; Usage
  327. Once installed, activate the skill in your Claude Code session:
  328. ```
  329. Use code-review-skill to review this PR
  330. ```
  331. Or create a custom slash command in `.claude/commands/`:
  332. ```markdown
  333. <!-- .claude/commands/review.md -->
  334. Use code-review-skill to perform a thorough review of the changes in this PR.
  335. Focus on: security, performance, and maintainability.
  336. ```
  337. **Example prompts:**
  338. | Prompt | What happens |
  339. |--------|-------------|
  340. | `Review this React component` | Loads `react.md` - checks hooks, Server Components, Suspense patterns |
  341. | `Review this Java PR` | Loads `java.md` - checks virtual threads, JPA, Spring Boot 3 patterns |
  342. | `Review this Java 8 / Spring Boot 2 PR` | Loads `java8.md` - Stream/Optional, java.time, RestTemplate timeouts, javax.* |
  343. | `Review this Flutter widget` | Loads `dart.md` - rebuilds, const, null safety, isolates, Riverpod/Bloc, keys, disposal |
  344. | `Security review of this Go service` | Loads `go.md` + `security-review-guide.md` |
  345. | `Architecture review` | Loads `architecture-review-guide.md` - SOLID, anti-patterns, coupling |
  346. | `Performance review` | Loads `performance-review-guide.md` - Web Vitals, N+1, complexity |
  347. ---
  348. ### &#128300; Highlights by Language
  349. <details>
  350. <summary><strong>&#9883;&#65039; React 19</strong></summary>
  351. - `useActionState` - Unified form state management
  352. - `useFormStatus` - Access parent form status without prop drilling
  353. - `useOptimistic` - Optimistic UI updates with automatic rollback
  354. - Server Components & Server Actions patterns (Next.js 15+)
  355. - Suspense boundary design, Error Boundary integration, streaming SSR
  356. - `use()` Hook for consuming Promises
  357. </details>
  358. <details>
  359. <summary><strong>&#9749; Java & Spring Boot 3</strong></summary>
  360. - **Java 17/21**: Records, Pattern Matching for Switch, Text Blocks, Sealed Classes
  361. - **Virtual Threads** (Project Loom): High-throughput I/O patterns
  362. - **Spring Boot 3**: Constructor injection, `@ConfigurationProperties`, `ProblemDetail`
  363. - **JPA Performance**: Solving N+1, correct `equals`/`hashCode` on Entities
  364. </details>
  365. <details>
  366. <summary><strong>&#9749; Java 8 & Spring Boot 2 (Legacy)</strong></summary>
  367. - **Java 8**: Lambda, Stream/`Collectors`, Optional, `java.time` (no Records / virtual threads)
  368. - **Concurrency**: bounded thread pools, `CompletableFuture` + explicit executors
  369. - **Spring Boot 2**: `javax.*`, constructor injection, `RestTemplate` timeouts
  370. - **JPA / Hibernate 5**: N+1, Entity `equals`/`hashCode`, UTC time mapping pitfalls
  371. </details>
  372. <details>
  373. <summary><strong>&#129408; Rust</strong></summary>
  374. - Ownership patterns and common pitfalls
  375. - `unsafe` code review requirements (mandatory `SAFETY` comments)
  376. - Async/await - avoiding blocking in async context, cancellation safety
  377. - Error handling: `thiserror` for libraries, `anyhow` for applications
  378. </details>
  379. <details>
  380. <summary><strong>&#128057; Go</strong></summary>
  381. - Goroutine lifecycle management and leak prevention
  382. - Channel patterns, select usage
  383. - `context.Context` propagation
  384. - Interface design (accept interfaces, return structs)
  385. - Error wrapping with `%w`
  386. </details>
  387. <details>
  388. <summary><strong>&#9881;&#65039; C / C++</strong></summary>
  389. - **C**: Pointer/buffer safety, undefined behavior, resource cleanup, integer overflow
  390. - **C++**: RAII ownership, Rule of 0/3/5, move semantics, exception safety, `noexcept`
  391. - **Qt**: Object parent/child memory model, thread-safe signal/slot connections, GUI performance
  392. </details>
  393. ---
  394. ### &#129309; Contributing
  395. Contributions are welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
  396. **Ideas:**
  397. - New language guides (Elixir, Scala, Lua...)
  398. - Framework-specific guides (Laravel, Spring WebFlux...)
  399. - Additional checklists and templates
  400. - Translations of core documentation
  401. ---
  402. ### &#128196; License
  403. MIT &copy; [awesome-skills](https://github.com/awesome-skills)
  404. ---
  405. <a name="chinese"></a>
  406. ## 中文
  407. ### 这是什么?
  408. **Code Review Skill** 是专为 [Claude Code](https://claude.ai/code) 打造的生产级代码审查技能,将 AI 辅助的代码审查从模糊建议转变为**结构化、一致且专业级**的流程。
  409. 覆盖 **20+ 种语言和框架**,拥有超过 **21,000 行**精心整理的代码审查指南——按需加载,最大程度减少上下文占用。
  410. ---
  411. ### &#10024; 核心特性
  412. - **渐进式加载** — 核心技能仅 ~220 行,各语言指南(每份 200–1,100 行)仅在需要时才加载。
  413. - **四阶段审查流程** — 从理解 PR 范围到输出清晰反馈,每一步都有规可循。
  414. - **严重性标记** — 每条发现均分级:`blocking` · `important` · `nit` · `suggestion` · `learning` · `praise`
  415. - **安全优先** — 每个语言生态均配备专属安全检查清单。
  416. - **协作式语气** — 以提问替代命令,以建议替代指令。
  417. - **自动化感知** — 明确区分人工审查应关注的内容与 linter 自动处理的内容。
  418. ---
  419. ### &#127760; 支持的语言与框架
  420. | 分类 | 技术栈 | 指南文件 | 行数 |
  421. |------|--------|----------|------|
  422. | **前端** | &#9883;&#65039; React 19 / Next.js / TanStack Query v5 | `reference/react.md` | ~870 |
  423. | | &#128154; Vue 3.5 Composition API | `reference/vue.md` | ~920 |
  424. | | &#128302; Angular 17+ / Signals / Zoneless | `reference/angular.md` | ~790 |
  425. | | &#128293; Svelte 5 / SvelteKit | `reference/svelte.md` | ~1,060 |
  426. | | &#127912; CSS / Less / Sass | `reference/css-less-sass.md` | ~660 |
  427. | | &#128311; TypeScript | `reference/typescript.md` | ~1,020 |
  428. | **后端** | &#9749; Java 17/21 + Spring Boot 3 | `reference/java.md` | ~410 |
  429. | | &#9749; Java 8 + Spring Boot 2 | `reference/java8.md` | ~580 |
  430. | | &#9889; FastAPI | `reference/fastapi.md` | ~590 |
  431. | | PHP 8.x | `reference/php.md` | ~700 |
  432. | | &#128142; Ruby 3.4+/4.0 + Rails 8.x | `reference/ruby.md` | ~960 |
  433. | | &#128230; NestJS | `reference/nestjs.md` | ~590 |
  434. | | &#128013; Django / DRF | `reference/django.md` | ~1,030 |
  435. | | &#128013; Python | `reference/python.md` | ~1,070 |
  436. | | &#128057; Go | `reference/go.md` | ~990 |
  437. | | &#129408; Rust | `reference/rust.md` | ~840 |
  438. | | &#128187; C# / .NET 8 | `reference/csharp.md` | ~520 |
  439. | **移动 / 系统** | &#128241; Kotlin / Android | `reference/kotlin.md` | ~1,020 |
  440. | | &#127822; Swift / SwiftUI | `reference/swift.md` | ~930 |
  441. | | &#127919; Dart / Flutter | `reference/dart.md` | ~650 |
  442. | | &#9881;&#65039; C | `reference/c.md` | ~890 |
  443. | | &#128297; C++ | `reference/cpp.md` | ~890 |
  444. | | &#9889; Zig | `reference/zig.md` | ~440 |
  445. | | &#128421;&#65039; Qt 框架 | `reference/qt.md` | ~760 |
  446. | **架构** | &#127963;&#65039; 架构设计审查 | `reference/architecture-review-guide.md` | ~470 |
  447. | | &#9889; 性能审查 | `reference/performance-review-guide.md` | ~820 |
  448. | | &#128269; 通用质量反模式 | `reference/code-quality-universal.md` | ~490 |
  449. | | &#128737;&#65039; 安全审查 | `reference/security-review-guide.md` | ~640 |
  450. | | &#128200; N+1 查询 | `reference/cross-cutting/n-plus-one-queries.md` | ~310 |
  451. | | &#9888;&#65039; 错误处理原则 | `reference/cross-cutting/error-handling-principles.md` | ~490 |
  452. | | &#9889; 异步与并发模式 | `reference/cross-cutting/async-concurrency-patterns.md` | ~540 |
  453. | | &#128737;&#65039; SQL 注入防护 | `reference/cross-cutting/sql-injection-prevention.md` | ~310 |
  454. | | &#128737;&#65039; XSS 防护 | `reference/cross-cutting/xss-prevention.md` | ~260 |
  455. ---
  456. ### &#128260; 四阶段审查流程
  457. ```
  458. 阶段一 - 上下文收集
  459. 理解 PR 范围、关联 Issue 和实现意图
  460. |
  461. v
  462. 阶段二 - 高层级审查
  463. 架构设计 - 性能影响 - 测试策略
  464. |
  465. v
  466. 阶段三 - 逐行深度分析
  467. 逻辑正确性 - 安全漏洞 - 可维护性 - 边界情况
  468. |
  469. v
  470. 阶段四 - 总结与决策
  471. 结构化反馈 - 审批状态 - 后续行动项
  472. ```
  473. ---
  474. ### &#127991;&#65039; 严重性标记说明
  475. | 标记 | 含义 |
  476. |------|------|
  477. | &#128308; `blocking` | 合并前必须修复 |
  478. | &#128992; `important` | 应当修复,视情况可能阻塞合并 |
  479. | &#128993; `nit` | 风格或偏好上的小问题 |
  480. | &#128309; `suggestion` | 值得考虑的可选优化 |
  481. | &#128218; `learning` | 给作者的教育性说明 |
  482. | &#127775; `praise` | 明确表扬优秀代码 |
  483. ---
  484. ### &#128193; 仓库结构
  485. ```
  486. code-review-skill/
  487. |
  488. +-- SKILL.md # 核心技能,激活时加载(~220 行)
  489. +-- README.md
  490. +-- LICENSE
  491. +-- CONTRIBUTING.md
  492. |
  493. +-- reference/ # 按需加载的语言指南
  494. | +-- react.md # React 19 / Next.js / TanStack Query v5
  495. | +-- vue.md # Vue 3.5 组合式 API
  496. | +-- angular.md # Angular 17+ / Signals / Zoneless
  497. | +-- svelte.md # Svelte 5 / SvelteKit
  498. | +-- rust.md # Rust 所有权、async/await、unsafe
  499. | +-- typescript.md # TypeScript strict 模式、泛型、ESLint
  500. | +-- nestjs.md # NestJS 依赖注入、Guard、Interceptor、DTO
  501. | +-- java.md # Java 17/21 & Spring Boot 3
  502. | +-- java8.md # Java 8 & Spring Boot 2(遗留栈)
  503. | +-- php.md # PHP 8.x 类型、PDO、安全、Composer
  504. | +-- ruby.md # Ruby 3.4+/4.0、Rails 8.x、Active Record/Job
  505. | +-- python.md # Python async、类型注解、pytest
  506. | +-- django.md # Django / DRF 安全、Serializer、异步视图
  507. | +-- fastapi.md # FastAPI Depends、Pydantic v2、异步、测试驱动验证
  508. | +-- go.md # Go goroutine、channel、context、接口
  509. | +-- kotlin.md # Kotlin / Android 协程、Compose、Flow
  510. | +-- swift.md # Swift 5.9+/6、SwiftUI、并发、可选值
  511. | +-- dart.md # Dart / Flutter 重建、空安全、isolate、状态
  512. | +-- csharp.md # C# 12 / .NET 8、EF Core、ASP.NET Core
  513. | +-- c.md # C 内存安全、UB、错误处理
  514. | +-- cpp.md # C++ RAII、移动语义、异常安全
  515. | +-- zig.md # Zig allocator、错误处理、comptime、C 互操作
  516. | +-- qt.md # Qt 对象模型、信号/槽、GUI 性能
  517. | +-- css-less-sass.md # CSS/Less/Sass 变量、响应式设计
  518. | +-- architecture-review-guide.md # SOLID、反模式、耦合度分析
  519. | +-- code-quality-universal.md # 复用审查、参数膨胀、抽象泄漏、TOCTOU
  520. | +-- performance-review-guide.md # Core Web Vitals、N+1、内存泄漏
  521. | +-- security-review-guide.md # 安全审查清单(全语言通用)
  522. | +-- common-bugs-checklist.md # 各语言常见 Bug 模式
  523. | +-- code-review-best-practices.md # 沟通与流程最佳实践
  524. |
  525. +-- reference/cross-cutting/ # 语言无关跨领域模式
  526. | +-- sql-injection-prevention.md # 参数化查询, 6 语言
  527. | +-- xss-prevention.md # 输出编码, CSP, 5 框架
  528. | +-- n-plus-one-queries.md # N+1 查询, 预加载, 5 语言
  529. | +-- error-handling-principles.md # 错误处理原则, 7 语言
  530. | +-- async-concurrency-patterns.md # 并发模式, 7 语言
  531. |
  532. +-- assets/
  533. | +-- review-checklist.md # 快速参考清单
  534. | +-- pr-review-template.md # PR 审查评论模板
  535. |
  536. +-- scripts/
  537. +-- pr-analyzer.py # PR 复杂度分析工具
  538. ```
  539. ---
  540. ### &#128640; 安装方法
  541. **使用 `npx skills` 安装(Cursor、Claude Code、Codex、OpenCode 及其他 Agent):**
  542. ```bash
  543. npx skills add awesome-skills/code-review-skill
  544. ```
  545. skills CLI 会发现仓库根目录的 `SKILL.md`。不要把本技能嵌套到 `skills/` 目录下。
  546. **或克隆到 Claude Code skills 目录:**
  547. ```bash
  548. # macOS / Linux
  549. git clone https://github.com/awesome-skills/code-review-skill.git \
  550. ~/.claude/skills/code-review-skill
  551. # Windows(PowerShell)
  552. git clone https://github.com/awesome-skills/code-review-skill.git `
  553. "$env:USERPROFILE\.claude\skills\code-review-skill"
  554. ```
  555. **或添加到现有插件:**
  556. ```bash
  557. cp -r code-review-skill ~/.claude/plugins/your-plugin/skills/code-review/
  558. ```
  559. ---
  560. ### &#128161; 使用方式
  561. 安装后,在 Claude Code 会话中激活技能:
  562. ```
  563. Use code-review-skill to review this PR
  564. ```
  565. 或在 `.claude/commands/` 中创建自定义斜杠命令:
  566. ```markdown
  567. <!-- .claude/commands/review.md -->
  568. 使用 code-review-skill 对这次 PR 的变更进行全面审查。
  569. 重点关注:安全性、性能和可维护性。
  570. ```
  571. **示例提示词:**
  572. | 提示词 | 效果 |
  573. |--------|------|
  574. | `审查这个 React 组件` | 加载 `react.md`,检查 Hooks、Server Components、Suspense |
  575. | `审查这个 Java PR` | 加载 `java.md`,检查虚拟线程、JPA、Spring Boot 3 |
  576. | `审查这个 Java 8 / Spring Boot 2 PR` | 加载 `java8.md`,检查 Stream/Optional、java.time、RestTemplate 超时、javax.* |
  577. | `审查这个 Flutter 组件` | 加载 `dart.md`,检查重建、const、空安全、isolate、Riverpod/Bloc、Key、释放 |
  578. | `对这个 Go 服务进行安全审查` | 加载 `go.md` + `security-review-guide.md` |
  579. | `架构审查` | 加载 `architecture-review-guide.md`,检查 SOLID 与反模式 |
  580. | `性能审查` | 加载 `performance-review-guide.md`,分析 Web Vitals、N+1 等 |
  581. ---
  582. ### &#128300; 各语言核心内容
  583. <details>
  584. <summary><strong>&#9883;&#65039; React 19</strong></summary>
  585. - `useActionState` — 统一的表单状态管理
  586. - `useFormStatus` — 无需 props 透传即可访问父表单状态
  587. - `useOptimistic` — 带自动回滚的乐观 UI 更新
  588. - Server Components & Server Actions(Next.js 15+)
  589. - Suspense 边界设计、Error Boundary 集成、流式 SSR
  590. - `use()` Hook 消费 Promise
  591. </details>
  592. <details>
  593. <summary><strong>&#9749; Java & Spring Boot 3</strong></summary>
  594. - **Java 17/21**:Records、Switch 模式匹配、文本块、Sealed Classes
  595. - **虚拟线程**(Project Loom):高吞吐量 I/O 模式
  596. - **Spring Boot 3**:构造器注入、`@ConfigurationProperties`、`ProblemDetail`
  597. - **JPA 性能**:解决 N+1、Entity 正确的 `equals`/`hashCode` 实现
  598. </details>
  599. <details>
  600. <summary><strong>&#9749; Java 8 & Spring Boot 2(遗留栈)</strong></summary>
  601. - **Java 8**:Lambda、Stream/`Collectors`、Optional、`java.time`(无 Records / 虚拟线程)
  602. - **并发**:有界线程池、`CompletableFuture` + 显式 Executor
  603. - **Spring Boot 2**:`javax.*`、构造器注入、`RestTemplate` 超时
  604. - **JPA / Hibernate 5**:N+1、Entity `equals`/`hashCode`、UTC 时间映射陷阱
  605. </details>
  606. <details>
  607. <summary><strong>&#129408; Rust</strong></summary>
  608. - 所有权模式与常见陷阱
  609. - `unsafe` 代码审查要求(必须有 `SAFETY` 注释)
  610. - Async/await — 避免在异步上下文中阻塞,取消安全性
  611. - 错误处理:库用 `thiserror`,应用用 `anyhow`
  612. </details>
  613. <details>
  614. <summary><strong>&#128057; Go</strong></summary>
  615. - Goroutine 生命周期管理与泄漏预防
  616. - Channel 模式、select 用法
  617. - `context.Context` 传播规范
  618. - 接口设计原则(接受接口,返回结构体)
  619. - 错误包装:使用 `%w`
  620. </details>
  621. <details>
  622. <summary><strong>&#9881;&#65039; C / C++</strong></summary>
  623. - **C**:指针/缓冲区安全、未定义行为、资源清理、整数溢出
  624. - **C++**:RAII 所有权、Rule of 0/3/5、移动语义、异常安全、`noexcept`
  625. - **Qt**:父子内存模型、线程安全的信号/槽连接、GUI 性能优化
  626. </details>
  627. ---
  628. ### &#129309; 参与贡献
  629. 欢迎贡献!请查阅 [CONTRIBUTING.md](./CONTRIBUTING.md) 了解规范。
  630. **可贡献方向:**
  631. - 新增语言指南(Elixir、Scala、Lua...)
  632. - 框架专属指南(Laravel、Spring WebFlux...)
  633. - 补充检查清单和审查模板
  634. - 核心文档的多语言翻译
  635. ---
  636. ### &#128196; 开源协议
  637. MIT &copy; [awesome-skills](https://github.com/awesome-skills)
  638. ---
  639. <div align="center">
  640. Made with &#10084;&#65039; for developers who care about code quality
  641. </div>

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.