Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Lightweight Diff Review

A read-only, bounded code-review skill for recent diffs: find regressions and interface mistakes without turning every change into a repository-wide audit.

面向近期代码变更的只读、有界代码审查 Skill:优先发现回归和接口问题,不把每个 diff 扩大成全仓库审计。

License: MIT

What it does / 它解决什么问题

Most review agents either inspect too little to find a real regression or expand every change into an expensive repository-wide investigation. Lightweight Diff Review stays between those extremes:

很多审查 Agent 要么只看表面,找不到真实回归;要么把每次修改都扩大成昂贵的全仓库调查。Lightweight Diff Review 保持在两者之间:

  • start from the changed diff, not the whole repository;

  • expand context only to answer a concrete unresolved question;

  • check correctness, interface consistency, relevant security, async/performance risks, and test coverage in risk order;

  • run at most one targeted validation by default;

  • report actionable findings first, with location, impact, recommendation, and coverage;

  • remain read-only unless the user explicitly requests a separate implementation task.

  • 从变更 diff 开始,而不是扫描整个仓库;

  • 只有为回答明确问题时才扩展上下文;

  • 按风险顺序检查正确性、接口一致性、相关安全问题、异步/性能风险和测试覆盖;

  • 默认最多运行一次定向验证;

  • 优先输出带位置、影响、建议和覆盖范围的可执行发现;

  • 默认保持只读,除非用户明确提出独立的修复任务。

This is a focused recent-change review skill, not a repository-wide audit, security red team, test-generation tool, or automatic fixer.

它专注于近期变更审查,不是全仓库架构审计、安全红队、测试生成器或自动修复器。

Quick start / 快速开始

Inspect and install with Hermes / 使用 Hermes 检查和安装

Inspect before installing:

安装前先检查:

hermes skills inspect linnnn89/lightweight-diff-review/skills/lightweight-diff-review

Install directly:

直接安装:

hermes skills install linnnn89/lightweight-diff-review/skills/lightweight-diff-review

Or add the repository as a tap:

也可以将仓库添加为 tap:

hermes skills tap add linnnn89/lightweight-diff-review
hermes skills install linnnn89/lightweight-diff-review/lightweight-diff-review

Invoke / 调用

/lightweight-diff-review Review my recent changes.
/lightweight-diff-review 审核我刚刚修改的代码,只检查功能回归和接口一致性,不修改代码。

The more precisely you name the change range and risk, the less context the reviewer needs to load.

越明确地说明变更范围和风险重点,审查器就越不需要加载额外上下文。

Operating contract / 执行契约

The default workflow is deliberately conservative:

默认流程刻意保持保守:

Default behavior / 默认行为 Meaning / 含义
Read-only / 只读 No code, configuration, dependency, commit, branch, PR, or review-comment changes / 不修改代码、配置、依赖、提交、分支、PR 或审查评论
Diff-first / 优先 diff Inspect the requested change before surrounding files / 先看目标变更,再看必要上下文
Evidence expansion / 证据扩展 Read one direct caller or callee layer only when a concrete question requires it / 只有具体问题需要时才扩展一层调用关系
Bounded validation / 有界验证 Run at most one targeted check by default / 默认最多运行一次定向检查
No network by default / 默认不联网 Do not fetch remotes or external data unless explicitly requested / 未明确要求时不抓取远程或外部数据
Stop on sufficiency / 证据足够即停止 Do not continue for completeness when the conclusion is already supported / 结论有证据支持后不为“完整”而继续扩大范围

The skill does not install dependencies, rebuild environments, launch subagents, or create an automatic-fix loop.

本 Skill 不安装依赖、不重建环境、不启动子 Agent,也不创建自动修复循环。

Review budget / 审查预算

Unless the user explicitly asks for a broader review, the default limits are:

除非用户明确要求扩大范围,默认限制为:

  • no more than 8 changed source files / 最多 8 个变更源文件
  • no more than 1,200 changed lines / 最多 1,200 行变更
  • no more than one direct caller or callee layer outside the diff / diff 外最多扩展一层直接调用关系;
  • no more than one targeted test, check, or command after static review / 静态审查后最多运行一次定向验证。

When a change exceeds the budget, the reviewer starts with the highest-risk portion, states current coverage, and asks before expanding the audit.

如果变更超过预算,审查器先检查最高风险部分,说明当前覆盖范围,并在扩大审计前征求确认。

Workflow / 工作流

1. Establish target
   → status, diff stat, complete relevant diff
2. Identify concrete questions
   → expand only to the closest required context
3. Review in risk order
   → behavior, interfaces, security, async/performance, tests
4. Run one proportionate validation
   → one test, syntax check, type check, or dry run
5. Stop and report
   → findings first, then validation and coverage
1. 建立目标:状态、diff 统计、完整相关变更
2. 提取具体问题:只扩展必要的最近上下文
3. 按风险顺序审查:行为、接口、安全、异步/性能、测试
4. 做一次相称验证:测试、语法、类型或 dry run
5. 停止并报告:先发现,再验证与覆盖范围

Finding standard / 发现标准

An item is actionable only when the review has all four parts:

一个发现只有同时具备以下四项,才会作为可执行问题输出:

  1. a concrete file and line or code location;

  2. a plausible execution path or affected behavior;

  3. an observable consequence;

  4. a proportionate correction or next check.

  5. 明确的文件和代码位置;

  6. 可信的执行路径或受影响行为;

  7. 可观察的后果;

  8. 相称的修复建议或下一步检查。

Findings are classified by evidence level:

发现按证据强度分类:

  • CONFIRMED — demonstrated by the diff or executed validation / 已由代码或验证直接证明;
  • HIGH-PROBABILITY — strongly supported but not executed end to end / 证据很强但尚未端到端执行;
  • NEEDS-CONTEXT — cannot be decided within the bounded scope / 在当前范围内无法判断;
  • OPTIONAL — non-blocking maintainability improvement / 非阻塞的可维护性建议。

Low-confidence speculation is not presented as a defect.

低置信度推测不会被包装成缺陷。

Output format / 输出格式

The default report is compact and findings-first:

默认报告保持紧凑,并优先列出发现:

Lightweight Diff Review: <N> actionable finding(s)

[CONFIRMED | HIGH-PROBABILITY] <severity> — <file:line>
Problem: <specific defect and triggering path>
Impact: <observable consequence>
Recommendation: <minimal correction or verification>

Validation:
- <command or static-only review result>

Coverage:
- Reviewed: <diff/files/context>
- Not reviewed: <explicit exclusions>

If no substantive issue is found, the report says so directly and still states validation and exact coverage limits.

如果没有实质问题,报告会直接说明,并仍然列出验证方式和准确的覆盖边界。

When to escalate / 何时升级审查

Recommend a broader review only when the diff gives a concrete reason, such as:

只有在 diff 提供明确理由时,才建议扩大审查,例如:

  • public API or schema changes / 公共 API 或 Schema 变化;
  • authentication, authorization, or sensitive-data paths / 认证、授权或敏感数据路径;
  • data migrations or destructive persistence changes / 数据迁移或破坏性持久化变化;
  • concurrency or shared infrastructure changes / 并发或共享基础设施变化;
  • a change that clearly exceeds the default budget / 明显超过默认预算的变更。

The reviewer explains the required scope and waits for approval before expanding.

审查器会说明所需范围,并在扩大审查前等待批准。

Repository layout / 仓库结构

skills/
└── lightweight-diff-review/
    └── SKILL.md

The runtime skill is intentionally small; the repository README is documentation for people and installers, not a file loaded into every review context.

运行时 Skill 刻意保持小型;本 README 面向人类和安装器,不会在每次审查时加载进上下文。

Design goals / 设计目标

  1. Diff before repository — start with the smallest evidence surface that can answer the question.

  2. Bounded context — spend tokens on unresolved questions, not completeness theater.

  3. Independent review — inspect the recent change without silently fixing it.

  4. Evidence-calibrated language — separate confirmed defects from context gaps.

  5. A clear stop — stop when the evidence supports the conclusion.

  6. 先 diff 后仓库:从足以回答问题的最小证据面开始;

  7. 上下文有界:Token 用于解决未决问题,而不是制造“完整感”;

  8. 独立审查:检查近期变更,不静默修复;

  9. 证据匹配措辞:区分已确认缺陷与上下文不足;

  10. 明确停止:证据足够支持结论后停止。

Attribution / 方法来源

The workflow is independently written for low-token, low-side-effect diff review. It is conceptually informed by useful review categories in garrytan/gstack, but it does not copy its prompts, implementation, CLI, or detector corpus.

本工作流针对低 Token、低副作用的 diff 审查独立编写。它在概念上参考了 garrytan/gstack 的部分审查分类,但不复制其 Prompt、实现、CLI 或 Detector 数据集。

License / 许可证

MIT

About

A lightweight, read-only AI agent skill for reviewing recent code diffs with bounded context, targeted validation, and no automatic fixes. 面向近期代码变更的轻量只读 AI 审查 Skill。

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors