agentleFS
bushuhuibushuhui/skills/pd-review/SKILL.md

pd-review

Skill2 starsChanged 5 months agoMITView on GitHub

对本地 git 变更进行多维度代码审查(规范合规、Bug 扫描、代码质量、安全风险),自带 0-100 置信度自评,仅报告高置信度(>=80)问题。Use when reviewing local code changes before commit, checking for bugs or security issues, or verifying CLAUDE.md compliance.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

pd-review — 本地代码审查

使用方式

/pd-review              # 审查未暂存的修改(git diff)
/pd-review --staged     # 审查已暂存的修改(git diff --cached)
/pd-review --file path  # 审查指定文件或目录
/pd-review --range A..B # 审查两个 commit 之间的差异

如果没有任何变更,告知用户无需审查。

审查流程

1. 收集项目规范

搜索 CLAUDE.md(根目录 + 变更涉及的子目录),读取相关规范要求。若无规范文件,跳过维度 A。

2. 四维度审查

依次从以下四个维度审查变更代码,每个维度独立分析:

维度 A — 规范合规性(仅当有 CLAUDE.md 时执行):检查变更是否违反明确的规则。只检查变更代码直接违反的规则。

维度 B — 明显 Bug 扫描:逻辑错误、空值处理遗漏、资源泄漏、竞态条件、边界条件未处理。专注大 bug,忽略琐碎细节。

维度 C — 代码质量:过度复杂/深层嵌套、DRY 违反、命名混乱、缺失关键错误处理。只报告"资深工程师会指出来"的问题。

维度 D — 安全风险:输入验证缺失(SQL 注入/XSS)、敏感信息泄露、权限/认证绕过。

3. 置信度自评

对发现的每个问题独立评估置信度:

分数含义
0误报或历史遗留问题
25可能是真问题,也可能是误报
50真问题但影响小
75大概率是真问题,会影响功能
100完全确定,必然发生且影响重大

对每个问题给出分数和一句话理由。

4. 过滤并输出

只报告置信度 >= 80 的问题。 对每个问题提供:问题描述、所属维度、置信度分数和理由、文件:行号、修复建议。

误报过滤

以下情况一律不报告:本次变更之前就存在的遗留问题;linter/编译器能捕获的问题;通用代码质量问题(除非 CLAUDE.md 明确要求);已有 lint ignore 注释的问题;用户未修改行上的问题;故意的设计取舍;CI 能自动检查的问题。

输出格式

### 代码审查
变更范围:{N 个文件,+X/-Y 行}
发现 {N} 个问题:

**1. {问题简述}**
- 维度:Bug
- 置信度:85(已验证该路径在 X 条件下会触发)
- 位置:`src/auth.ts:67-72`
- 说明:OAuth 回调缺少错误处理
- 建议:添加 try-catch 或错误回调处理

若无问题:未发现高置信度问题。已检查规范合规性、Bug、质量和安全。

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.