首页 / 全部技能 / 基础工具与工作流 / code-review-and-quality
基础工具与工作流 · addyosmani/agent-skills

code-review-and-quality

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch. Use when asked to review a diff or a pull request, even when the diff is pasted inline.

L1 基础 · 登记来源即可V1 已固定Dual-pass Audit
💬 对话试用 (预览)
Author addyosmaniGitHub addyosmani/agent-skills ↗Stars 113872License MITCommit 301b02b12b
管控等级描述 skill 的能力与建议配套的管控措施,不代表质量或安全认证,也不表示可用或不可用。是否使用由用户和管理者决定。不同 agent 宿主对权限的约束各不相同,请勿假定宿主一定会提供安全兜底。第三方 skill 版权归原作者,使用风险由使用者自行承担。

1实现原理 · 为什么它能做到

实施五维代码审查标准(正确性、可读性、架构、安全性、性能),杜绝无审查合并

skills/code-review-and-quality/SKILL.md
Multi-dimensional code review with quality gates. Every change gets reviewed before merge — no exceptions. Review covers five axes: correctness, readability, architecture, security, and performance.
这里在做什么:确立 PR 合并前必须经过五个核心维度全面审查的铁律规范

确立实用主义审批标准:代码只要切实提升整体代码健康度即可批准,不苛求完美或个人风格对齐

skills/code-review-and-quality/SKILL.md
Approve a change when it definitely improves overall code health, even if it isn't perfect. Perfect code doesn't exist — the goal is continuous improvement. Don't block a change because it isn't exactly how you would have written it.
这里在做什么:明确审查的核心目标是持续改进而非阻挠合并,防止陷入主观挑刺

提出针对架构异味的具名重构方案(Structural Remedies),拒绝仅指出问题不给解法

skills/code-review-and-quality/SKILL.md
When you flag a structural problem, propose the move — not just the problem. A review that only says "this is complex" leaves the author guessing. Reach for a named restructuring: - **Replace a chain of conditionals** with a typed model or an explicit dispatcher. - **Collapse duplicate branches** into a single clearer flow. - **Separate orchestration from business logic** so each reads on its own.
这里在做什么:强制要求审查者提出具体结构化重构建议,如条件链改分发器、解耦编排与业务

通过变异测试实验验证测试用例的真实有效性,而非单纯看代码覆盖率

skills/code-review-and-quality/SKILL.md
Invert one condition the change adds (drop a negation, swap `&&` for `||`), run the suite, then restore the file from a copy. A mutation that stays green is a finding: name the test case that is missing.
这里在做什么:指导审查者反转代码条件进行冒烟测试,若测试依然通过则说明测试用例存在盲区

采用带前缀的审查意见分级系统(Critical/Required/Nit/Optional/FYI),明确责任与行动项

skills/code-review-and-quality/SKILL.md
Label every comment with its severity so the author knows what's required vs optional: | Prefix | Meaning | Author Action | |--------|---------|---------------| | *(no prefix)* | Required change | Must address before merge | | **Critical:** | Blocks merge | Security vulnerability, data loss, broken functionality | | **Nit:** | Minor, optional | Author may ignore — formatting, style preferences | | **Optional:** / **Consider:** | Suggestion | Worth considering but not required | | **FYI** | Informational only | No action needed — context for future reference |
这里在做什么:通过规范化严重度前缀防止作者将微小建议当成强制阻塞,提升审查沟通效率

推广多模型审查模式(Multi-Model Review),利用不同模型的认知盲区互相补充交叉验证

skills/code-review-and-quality/SKILL.md
Model A writes the code │ ▼ Model B reviews for correctness and architecture │ ▼ Model A addresses the feedback │ ▼ Human makes the final call
这里在做什么:建立由生成模型编写、第二模型独立挑错、最终人工定夺的 Agent 协作审查链

死代码清理机制:识别无用遗留代码并在征得同意后安全移除,拒绝积累技术债

skills/code-review-and-quality/SKILL.md
1. Identify code that is now unreachable or unused 2. List it explicitly 3. **Ask before deleting:** "Should I remove these now-unused elements: [list]?" Don't leave dead code lying around — it confuses future readers and agents. But don't silently delete things you're not sure about.
这里在做什么:在重构时系统化清理无引用的死函数与废弃组件,保持代码库精简

严格的依赖纪律与版本升级工作流:单一变更单包升级、审查 lockfile diff 并核查安全审计

skills/code-review-and-quality/SKILL.md
1. **Read the changelog, not just the version number.**… 2. **One dependency per change.** Upgrade and merge them individually (or in small related groups)… 3. **Let the tests decide.**… 4. **Mind the transitive graph.**… 5. **Keep the lockfile honest.** Commit it, review its diff, and never hand-edit it.
这里在做什么:规范第三方依赖的准入与更新,严禁大杂烩批量升级导致排障困难

2核心能力

01五维质量门禁审查(正确性/可读性/架构/安全性/性能)
02具名结构性重构方案指导(Structural Remedies)
03变异条件测试有效性实证(Mutation Verification)
04带严重度前缀的意见分类标注机制
05跨模型结对审查工作流(Multi-Model Review Pattern)
06死代码扫描与确认清理准则
07依赖项单包升级与 lockfile 审查规范

4管控建议与判定依据

建议配套管控措施
面向 Agent
可自动加载
面向管理者
登记来源与版本
审计说明: Skill 自身目录仅包含单个规范指南文档 SKILL.md,无任何可执行脚本、网络通信或凭证读取逻辑。所有审查标准均通过 Prompt 指令实施,判定为 green 纯指令级别

5第二遍独立确认

  • [ok] 零可执行脚本与外发调用复核 — 经风险扫描与目录清查确认,无内置脚本、网络端点或文件写入动作
  • [ok] 五维审查维度核验 — SKILL.md 第 52-113 行完整定义了 Correctness, Readability, Architecture, Security, Performance 五大维度
  • [ok] 意见前缀严重度映射核验 — 文档清晰划分 Critical、Required(无前缀)、Nit、Optional、FYI 五档对应作者处置动作
  • [ok] 变异条件验证策略核验 — 文档第 190 行明确指出通过翻转条件测试冒烟状态以检验测试有效性
  • [ok] 单包依赖升级纪律核验 — 文档第 322-329 行详细规范了单个升级、changelog 研读及 lockfile 严格比对准则

6结论

  • 全面立体的五维质量把关体系,跳出单纯看单元测试是否通过的狭隘视角
  • 富有建设性的具名重构方案建议(Structural Remedies),避免无效的空洞挑刺
  • 建立严谨的单包依赖升级规范与 lockfile 审查流程,有效防范供应链与破坏性更新风险
  • 适合: 适用于团队合并 PR 前的自动化质量门禁、单人开发代码交付前的自审自查、多 Agent 协作中的结对互审,以及存量代码重构后的质量验收
    不适合: 不适用于只求快速原型出稿的极早期 Spike 验证阶段,也不适合全自动无需人工介入的关键核心底层生产发布
    💬 Online Trial Chat Sandbox

    Preview this skill in an interactive chat playground. Generic LLM evaluation trial.

    💬 Open Chat Trial (Preview)
    Under construction · Generic sandbox trial
    Install Agent-Ready
    ① Accelerated Distribution dl.bestaiskill.com
    Option A · Direct Zip Download⚡ Download code-review-and-quality (Zip)
    Edge-accelerated mirror via dl.bestaiskill.com
    Option B · Copy Guide for Agent
    install.json
    agent 读 JSON 指南后会自动从本站下载安装,无需更多说明。
    ② Upstream GitHub
    GitHub Repo ↗
    Pinned to commit 301b02b12b.