code-review

A review process for a pull request, which is a proposed set of code changes. It examines the changed code and its surrounding files for bugs, security problems, design issues, and lint errors.

In plain words
What is it for?
Use it to review a pasted diff, a diff file, or a Git commit range, with findings linked to specific files and line numbers.
Why use it?
It helps catch problems in code—especially code generated by AI—before the changes are merged into the project.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rushengzhou/sid-code/code-review
Any agent
npx skills add rushengzhou/sid-code --skill code-review
Clone the repo
git clone --depth 1 https://github.com/rushengzhou/sid-code

Made for: Claude Code, Codex.

Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,742 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00049 $0.04742
Opus 5 $0.00024 $0.02371
Sonnet 5 $0.00010 $0.00948
Haiku 4.5 $0.00005 $0.00474

Measured yesterday against content hash 2cb32e751830, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/coverage-check.ts, scripts/lint-diff.ts, scripts/parse-diff.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/core/src/skill/builtin/code-review/SKILL.md · 290 lines

How it starts

The opening of the file, as written. The whole thing — 290 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Review Skill

你是 sid-code 内置的 code-review Skill,负责针对 PR diff 输出结构化的 Code Review 摘要。 你的目标受众是 AI 生成代码场景下的开发者——AI 代码漏洞密度是人类的 2.74×,OWASP 失败率 45%,因此 Review 是必经的兜底环节。


1. 输入与触发

典型输入(用户消息中提供之一):

  • PR diff 文件路径(unified diff format):例如 /tmp/pr-1234.diff
  • Git 仓库路径 + commit range:例如 "review master..feature/refactor"
  • 直接粘贴 diff 文本

触发不命中的场景(直接返回"无需 Review"):

  • 仅 README.md / docs/ 下文档变更(M3+ orch_005 由 dispatcher 拦截)
  • 二进制文件变更(.png / .pdf / .lock)
  • 仅格式化变更(whitespace-only)

2. 工作流程(Agent 执行步骤)

Step 2.1:变更范围识别

  1. 调用 bash 工具运行 scripts/parse-diff.ts <diff-path>(确定性脚本)
  2. 得到结构化输出:变更文件列表 + 每个文件的行号区间 + 语言类型
  3. 如果文件数 > 50 或总行数 > 1000,先警告"超大 PR,建议拆分",再缩小范围(按 orch_006 拆分逻辑就位前,本 Skill 仅 review 前 10 个文件 + 给出"长 PR 提示")

Step 2.2:上下文获取

对每个变更文件:

  1. read 工具读取当前完整内容(不只看 diff 片段——很多 issue 需要完整文件上下文)
  2. grep 工具查找:
    • 该文件被谁 import / 调用
    • 是否有对应测试文件(<basename>.test.ts / _test.go / test_*.py
  3. glob 检查同模块下相关配置(package.json / tsconfig / Makefile)

Step 2.3:静态规则检查

  1. 调用 bash 运行 scripts/lint-diff.ts <diff-path>(确定性脚本)
  2. 该脚本应调用项目本身配置的 lint 工具(eslint / tsc / golangci-lint),输出结构化 JSON
  3. 解析 lint 结果,归入 findings

Step 2.4:复杂 Issue 检测(核心 LLM 推理)

针对每个变更,主动审查以下维度(不要漏,不要造):

维度 检查清单
正确性 边界条件 / null 检查 / 异常处理 / 逻辑错误
安全性 凭证泄漏 / SQL injection / XSS / 路径遍历 / 命令注入(参考 RL-002)
测试 变更是否有对应测试覆盖(参考 ont_008)
可读性 命名清晰 / 函数过长 / 嵌套过深 / 魔法数字
设计 是否破坏现有抽象 / 重复代码 / 紧耦合 / 违反开闭原则
AI 代码特征 是否有"看似正确实则不可行"代码 / 编造的 API / 不存在的库引用
性能 明显的 N+1 查询 / 无意义的循环嵌套 / 内存泄漏点

⚠️ 每条 finding 必须引用 file:line 具体位置——这是 RL-007(不编造问题)的硬约束。

Step 2.4.1:对抗验证(find → 强制 refute → synthesize,核心质量闸)

Step 2.4 产出的是候选 finding,不是结论。AI review 的最大失信源是"看似合理实则误报"。本步对每条 blocker/high 候选 finding 强制走一次独立证伪,再决定是否保留。

find → refute → synthesize 三段:

  1. find:Step 2.4 已产出候选 findings(每条含 file:line + 初判 severity)。
  2. 强制 refute(独立证伪):对每条 blocker/high 候选,委托一个独立的 verify 子代理去推翻它——
    • sub_agent 工具,agent_type: "verify"(该类型已内置对抗式系统提示词:默认怀疑、读码举证、grep 调用方、不确定降级)。
    • prompt 里给出:候选 finding 的描述、file:line、初判 severity,要求子代理尝试推翻,输出四档裁定之一(CONFIRMED / REFUTED / PARTIAL / UNVERIFIABLE)+ file:line 证据 + 一次证伪尝试记录。
    • 关键:verify 子代理要用与 find 不同的视角读码(读够上下文、grep 调用方),而不是顺着原 finding 的叙事走。
    • 多条候选可在同一轮发起多个 sub_agent 调用并发证伪(受内核并发上限管控)。
    • 降级回退:若 sub_agent 不可用(工具未注册 / 达并发上限报错),则在主上下文内自己扮演 verify——换一个怀疑视角重读 file:line 上下文 + grep 调用方,做一次显式证伪,严禁跳过。
  3. synthesize(裁决合并):按裁定处置每条候选——
    • CONFIRMED → 保留,severity 维持。
    • REFUTED从 findings 中剔除(或降到 note 并注明"经证伪不成立")。这是有价值的产出,不是失败。
    • PARTIAL → 保留但按证伪结果校准 severity(常见:现象真但根因/严重度被高估,下调一档)。
    • UNVERIFIABLE → 保留但标注"需运行时验证",severity 不高于 medium

Read the full file on GitHub · 290 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 290 lines · 49 tokens per session scan A 2cb32e751830

Subscribe to this mod's changes

code-review is a skill published in the GitHub repository rushengzhou/sid-code (2 stars, last pushed 2d ago), licensed MIT. It adds 49 tokens to every session and 4,742 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

omd-contract

把审议结论结晶成正式契约文档落盘 docs/plan/,当 /omd-execute 的执行契约。承接 /omd-grill 的决策记录表,写给没有对话上下文的执行器看。含 crystallize/crystals 职能。Trigger:/omd-contract、定契约、写成执行契约、写成 SDD、SDD、结晶、方案定了记下来、列结晶。.

AbyssCN/oh-my-dag · 105 tokens

omd-grill

锁 plan/SDD 前的对抗式审问:沿决策树走、先给推荐答案、事实自查·技术 Decision 自裁·真 owner 岔口才阻塞问、对标外部实现逼问「为何偏离」;宽解岔口就地开 council;产决策记录表喂 /omd-contract。审议纪律:只讨论不动手。Trigger:/omd-grill、审问、盘问这个方案、把这事讨论清楚、压测计划、stress-test。.

AbyssCN/oh-my-dag · 122 tokens

omd-video

视频→逐段结构化笔记 (MiMo-v2.5 原生吃画面+音频, 非 whisper 转写; 可重入管线)。讲解/课程视频里 PPT 框架图/代码/提示词是画面独有、音频拿不到的信息。产 ALL-NOTES.md 交 /omd-council 或 dagresearch 做综合。Trigger:/omd-video、抖音/B站/YouTube 讲解视频、课程系列、把这些视频学一遍/提炼、画面里有代码/图表/PPT。Skip:文字原文综合→/omd-council;网页内容→dagresearch(检索版)。.

AbyssCN/oh-my-dag · 155 tokens

omd-docs-drift

文档漂移追踪:确定性死路径/死锚闸(bun test 常驻)之外的语义半——按 docs/docs-map.md 声明表裁出「文档 ↔ 变更源」对, 经 dagrun 派 Sonnet 座逐对判"文档原句是否还站得住", 出口恒为 suggested 票, 人 confirm。Trigger:/omd-docs-drift、查文档漂移、文档跟没跟上代码、docs drift。.

AbyssCN/oh-my-dag · 119 tokens

omd-audit

安全专项审计:经 omd run 派多视角安全审查 DAG,按信任边界清单扫注入/认证/fail-open + untrusted 入口校验覆盖率,产按严重度排序的结构化报告。Trigger:/omd-audit、安全审计、查漏洞、信任边界、security review。.

AbyssCN/oh-my-dag · 80 tokens

omd-research-deep

终极档深度调研:种子作者化多角度抓取 + council 分解 + 多轮缺口补挖,一条工具调用出整领域 grounded 报告。Trigger:/omd-research-deep、深度调研、deep research、整领域调研、调研到 grounded 底座、把这个领域研究透。Skip:轻量单点查证(tavily 直查)/ 单问题综合(dagresearch 默认档)/ 代码理解(dag-map)。.

AbyssCN/oh-my-dag · 117 tokens