npx skills add https://github.com/jwynia/agent-skills --skill code-review系统化的代码审查能在生产前捕获 60-90% 的缺陷,将维护成本降低 40%,并作为有效的知识传递手段。此技能为人工审查者和 AI 代理提供结构化的审查指导。
在以下情况使用此技能:
在以下情况不要使用此技能:
审查效果随 PR 规模增大而急剧下降。 低于 400 行:缺陷检测率最高。400-800 行:效果降低 50%。800 行以上:效果降低 90%。
| 因素 | 最佳值 | 效果下降值 |
|---|---|---|
| PR 规模 | < 400 行 | > 800 行 |
| 审查时间 | < 60 分钟 | > 90 分钟 |
| 审查速度 | 200-400 行/小时 | > 500 行/小时 |
| 审查者数量 | 2 人 | 4 人以上(收益递减) |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 层级 | 检查项 | 捕获缺陷 | 频率 |
|---|
问题:
验证项: 测试覆盖率、业务逻辑、数据完整性、并发处理
问题:
指标: 清晰的命名、单一职责、低耦合、高内聚
问题:
危险信号: N+1 查询、无限循环、异步上下文中的同步 I/O、内存泄漏
问题:
关键检查项: 无硬编码密钥、SQL 参数化、XSS 防护、CSRF 令牌
| 异味 | 阈值 | 措施 |
|---|---|---|
| 过长方法 | > 50 行 | 提取方法 |
| 过长参数列表 | > 5 个参数 | 参数对象 |
| 重复代码 | > 10 行相似代码 | 提取公共部分 |
| 死代码 | 从未调用 | 删除 |
| 异味 | 症状 | 措施 |
|---|---|---|
| 上帝类 | > 1000 行,> 20 个方法 | 拆分类 |
| 特性依恋 | 过度使用其他类的数据 | 移动方法 |
| 数据泥团 | 相同的参数组 | 提取类 |
| 异味 | 检测方法 | 措施 |
|---|---|---|
| 循环依赖 | 依赖循环 | 引入接口 |
| 不稳定依赖 | 依赖于易变模块 | 依赖倒置 |
[BLOCKING] - 必须在合并前修复
[MAJOR] - 应在合并前修复
[MINOR] - 可在后续修复
[QUESTION] - 寻求澄清
观察 + 影响 + 建议
示例:
"这个方法有 200 行长 [观察]。
这使得它难以理解和测试 [影响]。
考虑提取辅助方法 [建议]。"
| 范围 | 分类 | 措施 |
|---|---|---|
| 1-10 | 简单 | 通过 |
| 11-20 | 中等 | 考虑重构 |
| 21-50 | 复杂 | 需要重构 |
50 | 不可测试 | 必须分解
| 范围 | 分类 |
|---|---|
| < 7 | 清晰 |
| 7-15 | 可接受 |
15 | 令人困惑 - 需要重构
未经彻底审查即批准。在 < 1 分钟内回复 "LGTM"。解决方法: 设定最低审查时间、要求评论、随机抽查。
提出 50+ 个风格评论,遗漏真正的问题。解决方法: 自动化风格检查、关注逻辑/设计、限制次要评论数量。
2000+ 行的 PR 让人不堪重负。解决方法: 使用小 PR 堆叠、功能标志、尽早审查草稿。
| 级别 | 定义 | SLA |
|---|---|---|
| 严重 | 可能远程执行代码 | 立即修复 |
| 高 | 可能导致数据泄露 | 24 小时内修复 |
| 中 | 影响有限 | 本迭代内修复 |
| 低 | 风险极小 | 方便时修复 |
| 指标 | 目标 |
|---|---|
| 首次审查周转时间 | < 4 小时 |
| 审查轮次 | < 3 轮 |
| PR 到合并时间 | < 24 小时 |
| 指标 | 目标 |
|---|---|
| 缺陷检测率 | > 80% |
| 合并后缺陷 | < 0.5 个/PR |
| 审查覆盖率 | 100% |
每周安装数
187
仓库
GitHub 星标数
37
首次出现
Jan 20, 2026
安全审计
安装于
opencode160
codex158
github-copilot151
gemini-cli150
cursor139
amp129
Systematic code review catches 60-90% of defects before production, reduces maintenance costs by 40%, and serves as effective knowledge transfer. This skill provides structured review guidance for both human reviewers and AI agents.
Use this skill when:
Do NOT use this skill when:
Review effectiveness degrades sharply with PR size. Under 400 lines: highest defect detection. 400-800 lines: 50% less effective. 800+ lines: 90% less effective.
| Factor | Optimal | Degraded |
|---|---|---|
| PR size | < 400 lines | > 800 lines |
| Review time | < 60 minutes | > 90 minutes |
| Review speed | 200-400 LOC/hour | > 500 LOC/hour |
| Reviewers | 2 | 4+ (diminishing returns) |
| Level | Checks | Catches | Frequency |
|---|---|---|---|
| 1. Automated | Lint, types, unit tests, security scan | 60% | Every commit |
| 2. Integration | Integration tests, contracts, performance | 25% | Every PR |
| 3. Human Review | Design, logic, maintainability, context | 15% | Significant changes |
Questions:
Validation: Test coverage, business logic, data integrity, concurrency handling
Questions:
Indicators: Clear naming, single responsibility, minimal coupling, high cohesion
Questions:
Red Flags: N+1 queries, unbounded loops, synchronous I/O in async context, memory leaks
Questions:
Critical Checks: No hardcoded secrets, SQL parameterized, XSS prevention, CSRF tokens
| Smell | Threshold | Action |
|---|---|---|
| Long method | > 50 lines | Extract method |
| Long parameter list | > 5 params | Parameter object |
| Duplicate code | > 10 similar lines | Extract common |
| Dead code | Never called | Remove |
| Smell | Symptoms | Action |
|---|---|---|
| God class | > 1000 lines, > 20 methods | Split class |
| Feature envy | Uses other class data excessively | Move method |
| Data clumps | Same parameter groups | Extract class |
| Smell | Detection | Action |
|---|---|---|
| Circular dependencies | Dependency cycles | Introduce interface |
| Unstable dependencies | Depends on volatile modules | Dependency inversion |
[BLOCKING] - Must fix before merge
[MAJOR] - Should fix before merge
[MINOR] - Can fix in follow-up
[QUESTION] - Seeking clarification
Observation + Impact + Suggestion
Example:
"This method is 200 lines long [observation].
This makes it hard to understand and test [impact].
Consider extracting helper methods [suggestion]."
| Range | Classification | Action |
|---|---|---|
| 1-10 | Simple | OK |
| 11-20 | Moderate | Consider refactoring |
| 21-50 | Complex | Refactor required |
50 | Untestable | Must decompose
| Range | Classification |
|---|---|
| < 7 | Clear |
| 7-15 | Acceptable |
15 | Confusing - refactor needed
Approving without thorough review. "LGTM" in < 1 minute. Fix: Minimum review time, required comments, random audits.
50+ style comments, missing real issues. Fix: Automate style checks, focus on logic/design, limit minor comments.
2000+ line PRs that overwhelm. Fix: Stack small PRs, feature flags, review drafts early.
| Level | Definition | SLA |
|---|---|---|
| Critical | Remote code execution possible | Fix immediately |
| High | Data breach possible | Fix within 24 hours |
| Medium | Limited impact | Fix within sprint |
| Low | Minimal risk | Fix when convenient |
| Metric | Target |
|---|---|
| First review turnaround | < 4 hours |
| Review cycles | < 3 |
| PR to merge time | < 24 hours |
| Metric | Target |
|---|---|
| Defect detection rate | > 80% |
| Post-merge defects | < 0.5 per PR |
| Review coverage | 100% |
Weekly Installs
187
Repository
GitHub Stars
37
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode160
codex158
github-copilot151
gemini-cli150
cursor139
amp129
AI绩效改进计划PIP技能:提升AI任务执行主动性、交付质量与问题解决能力
833 周安装