agentleFS
yuan-ai-cloudyuan-ai-cloud/yuanliaofan-harness/skills/review/SKILL.md

review

Skill1 starsChanged 33 days agoApache-2.0View on GitHub

审查代码变更或 Spec 的正确性、质量、遗漏与规范符合度;/review 审代码,/review spec 做结构审和逐节审。不适用于依赖影响面分析(yuanfen-pr-review)、例行夜审或交付前运行时冒烟(debug-runner)。

190 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use close-spec, design-with-images and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • dzhngSkill

    close-spec

    When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

    Also in 5 projects that use this

  • dzhngSkill

    design-with-images

    Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.

    Also in 5 projects that use this

  • LambenthanSkill

    daily-arxiv

    每日从 arXiv 拉取新论文,过滤相关性,auto-ingest 高优先级论文,检测 SOTA 更新

    Also in 5 projects that use this

  • LambenthanSkill

    exp-eval

    实验判决门:Review LLM 独立评判实验结果 → 4 种判决路径 → 自动更新 claims confidence、ideas status、graph edges

    Also in 5 projects that use this

  • +3 more from dzhng
  • +5 more from Lambenthan

The file

Files
SKILL.md

代码 / Spec 审查

根据 $ARGUMENTS 决定模式:

  • 空或 code → 代码审查
  • spec → Spec 文档审查

代码审查(默认)

对当前分支相对于 main 的变更进行审查。

第 0 步:影响面基线(MUST)

开审前先跑 yuanfen-pr-review skill,拿当前 diff 的影响面清单(每个改动符号的 blast radius / 风险分级)。这是审查的上下文基线——没有它你只能靠猜"这个改动会影响谁"。

降级路径:yuanfen 是作者仓库的私有代码符号图谱引擎。无此引擎时跳过本步并标注「无符号图谱引擎,影响面基线 = 人工通读全量 diff」,NEVER 拿 grep 的"查不到"当"没有影响"。

跳过条件:纯文案 / CSS token / 仅文档 / 改动全部落在 test/ 且无生产代码影响。跳过时在输出里标注"跳过 yuanfen-pr-review 原因:X"。

用法:读 PR review 报告 → 把 High 风险符号标记出来 → 审查时对这些符号下游路径加倍仔细(类型/行为/权限是否断)。

审查维度

  • 安全:SQL 注入、XSS(dangerouslySetInnerHTML + 用户输入)、硬编码密钥、不安全的 eval
  • 安全(远程诊断/SSH forced-command,V2.05 实证立):审查 SSH 白名单/远程诊断通道时——命令白名单 MUST 精确到 argv(命令名白名单不够:cat/openssl -in 可读任意路径);敏感路径由服务端 env 钉死而非客户端传参;只读命令的输出也是 secret 通道(docker inspect 默认带出容器 env——MUST 裁字段);token/密钥 NEVER 进 argv(ps 可见,用 curl --config 等机制)。"命令只读" ≠ "不会泄密"
  • DDD 分层:路由是否超 30 行?是否直接调 Domain Service / Repository / Prisma?是否用了 handler() 声明式?
  • 错误处理:catch 块是否有日志?是否吞掉了 error?API 是否返回标准错误格式?
  • 可观测性(coding-practice §37):5 类关键路径(外部依赖调用 / 跨进程跨服务边界 / 异步回调链 / catch→throw AppError / mobile error 显示)有无埋 log?失败 cause 对排查者必然可见吗(后端 log 或 mobile 上报,NEVER 只塞 HTTP 响应 body)?含外部 cause 的 AppError 是否被 sendError/createAppError 自动 warn log(架构层兜底)?原始 error message 在 catch 包装后是否仍留存?
  • 性能:N+1 查询?大列表未分页?组件内 fetch 无 dedup?
  • 边界条件:null/undefined 防护?空数组?并发?事务一致性?
  • 跨服务数据契约:代码使用来自其他服务的标识符(JWT tenantIds、外部 API 返回的 ID)查询本服务数据库时,标识符格式是否匹配?
  • 可维护性:命名清晰?职责单一?重复代码?Magic number?
  • 重构行为一致性:迁移/重构涉及运行时路径变更时,MUST 逐条追踪"新代码在运行时的实际路径 = 旧代码的行为"。类型编译通过 ≠ 行为不变。特别注意:权限规则组合变更、路由 auth 模式变更、shared 包导出变更后消费者的实际调用链。
  • 跨层契约完整性(两头锁定,V1.40 两轮实证最高产出维度):改了服务端分支/新路径时 MUST 查真实调用方是否会触发它(例:服务端 logout 新吊销分支 vs 客户端从不发 refreshToken → 空转;透支判定 vs 读口过滤 EXHAUSTED 券 → 修复无效)。修复 MUST 两端桥塔一起验,NEVER 只看被改的那端。
  • 移动端模块边界(仅 apps/yuanai-mobile/ 变更时):coach/ 是否 import 了 client/(反之亦然)?shared 组件是否包含 variant 判断?是否误用了 @design-system / @shared-components / react-dom?是否用 AsyncStorage 存了 token?

审查标准来源

以目标仓库自己的 AGENTS.md 的 MUST/NEVER 和 .claude/rules/ 为准(作者仓库实例:移动端代码额外参照 apps/yuanai-mobile/CLAUDE.md 和 .claude/rules/mobile.md——在你的仓库里替换成对应的模块边界约定)。不要用通用最佳实践稀释项目特有的规则。


Review 收敛与分诊纪律(V1.40 实证:10 轮 review 抓 6 P1+12 P2 后沉淀)

多轮 review 必然出现收敛曲线:第 1 轮抓跨层契约缺口 → 第 2 轮抓生产边界竞态 → 第 3 轮只剩 await 窗口内的交错。每轮都"还有发现"但价值递减——没有止损线就是无限返修循环。

  • 🔴 分诊规则 MUST 在开工前定进 spec,NEVER 等第一份 review 回来才临时定:P0/P1 且破坏既有行为才阻塞返修;窄窗口竞态 / 性能 / pre-existing P2 一律记 backlog 放行
  • 🔴 「修复自身引入新 P1」类 finding MUST 返工(修法在另一部署顺序/边界下自身是 P1,如网关 id#0 兜底两轮返工),但以一轮为限——返工后的复审若只剩窄 P2 即收口
  • 🔴 单包 review hard-stop ≤3-5 轮;收口时未决项显式进 backlog(含 plan Wave 3 D-4 汇总),NEVER 静默丢弃
  • 修复在前一轮 review 后,下一轮 review 范围含上一轮修复的 diff(修复是新的未审代码)
  • codex review 的调用方契约类 finding 质量最高——review prompt 里点名"调用方/消费端契约"维度(但注意 codex review --base 与位置参数 prompt 互斥,focus 只能靠 diff 范围控制)

Spec 审查

对指定的 Spec 文档进行审查。如未指定文件,扫描 docs/specs/ 下最新版本的 spec.md。

两阶段审查(MUST)

Spec 审查 MUST 在一次调用中走完两阶段,不可只做其中一阶段:

阶段 A — 架构原则审查(常规)

  • 代码引用验证:Spec 中提到的文件路径、函数名、变量名是否存在?行为是否与描述一致?
  • 内部一致性:Spec 不同部分之间是否矛盾?同一字段口径 MUST 跨章节逐字一致(多端并行开发时字段级矛盾会让各端「各自合理」实现并行爆开——V1.54 errorKind 枚举 §7.1 vs §7.4 矛盾致三树 4 个 P1 整批 400 连坐,五关交叉才锁定)
  • 与架构兼容:新方案是否与 AGENTS.md 的 MUST/NEVER 冲突?
  • 部署步骤可执行:每个部署步骤的脚本/命令是否实际存在?行为是否与描述一致?
  • AC 完整性:每个功能点是否有对应 AC?AC 是否可测试?
  • 消费者真实性盘问:Spec 声称的消费者是否真实?用户手 curl / 跨服务调用 / 端到端流程是否都能成立?假消费路径 MUST 作为 Critical raise
  • 组件盘点节(UI 类 spec 必查,V1.87 批6 立):涉前端 UI 的 spec MUST 有「组件盘点」节——对照 .claude/rules/frontend-components.md 速查表 + node scripts/audit/ds-inventory.mjs 核对,缺口显式写「本版 DS 缺口:…」并引用 v1.87 台账编号(scripts/audit/ds-exemptions.json)。缺失 = Critical(四步流水线① 的执行器层)

阶段 B — 架构师 DoD 合规 按 docs/definition-of-done.md「架构师 Spec 自检」11 条逐条核对:

  • US/AC 完整 / ac-checklist.md 存在 / 黄金字段 / 决策理由 / No-gos / Appetite / 无矛盾 / 热路径 / 资源影响 / 部署闭环(prod smoke)/ 六维追问

为什么两阶段合一:v0.71 spec review 踩坑——阶段 A 我 raise 了 Critical/Warning 后以为审完了,用户再 request DoD 合规审查又发现 19 条偏离。两次审查应并轨,避免遗漏。

Critical 代价纪律(MUST)

Raise Critical 时 MUST 同时评估并附上:

  • MVP 代价:落地此 Critical 在 MVP 阶段需要多少开发量(小时/天级别)
  • 是否依赖尚不存在的消费者 / 接口 / 基建

降级规则:

  • MVP 代价 > 1 天 且 消费者/接口不存在 → 降级为 Warning + 给"接口预留方案"(零成本兜底)
  • MVP 代价 > 1 天 但 消费者存在 → 保持 Critical
  • MVP 代价 ≤ 1 天 → 保持 Critical

为什么:我有"追求接口完备"的惯性,容易在 MVP 阶段 raise 过度设计的 Critical(如"立即加 feedback endpoint"但 MVP 无消费者)。代价 + 消费者双判据治这个惯性。

历史教训(04-12):Spec 写"手动执行 INSERT 授权 SQL",但代码中已有自动授权机制。Spec 中每个部署步骤 MUST 先验证实际脚本行为。

建议:Spec 审查前,先用 /product 完成需求讨论和数据契约对齐。/product 输出 spec 初稿 → /review spec 验证质量。


输出格式

## Review — [分支名 或 Spec 文件名]

### Critical (must fix)
- **[维度] 问题标题** — `文件:行号`
  问题描述和修复建议

### Warning (should fix)
- **[维度] 问题标题** — `文件:行号`
  问题描述和修复建议

### Suggestion (nice to have)
- **[维度] 问题标题** — `文件:行号`
  问题描述

### 总结
- Critical: N | Warning: N | Suggestion: N
- 推荐处理优先级

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.