code-review

code-review is a skill for Claude Code from rushengzhou/sid-code. It costs 49 tokens per session (4,742 once invoked), scanned A, original, MIT.

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 Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Good fit Use it to review a pasted diff, a diff file, or a Git commit range, with findings linked to specific files and line numbers.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rushengzhou/sid-code/code-review
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.

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.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-review

README.md
[![agentmods](https://agentmods.dev/badge/skills/rushengzhou/sid-code/code-review/github.svg)](https://agentmods.dev/skills/rushengzhou/sid-code/code-review)
Your own site
<a href="https://agentmods.dev/skills/rushengzhou/sid-code/code-review"><img src="https://agentmods.dev/badge/skills/rushengzhou/sid-code/code-review/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-review

Your own site · 80×15
<a href="https://agentmods.dev/skills/rushengzhou/sid-code/code-review"><img src="https://agentmods.dev/badge/skills/rushengzhou/sid-code/code-review.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00049 $0.04742
Opus 5.5 $0.00020 $0.01897
Sonnet 5.5 $0.00010 $0.00948
Haiku 4.5 $0.00005 $0.00474

Measured 1mo ago against content hash 2cb32e751830, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo ago.

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. 1mo ago 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 1mo ago), licensed MIT. It adds 49 tokens to every session and 4,742 once invoked, about $0.0002 per session on Opus 5.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.