一键导入
code-reviewer
严格的代码审查助手 —— 对代码 diff、文件、PR 或整个模块做基于证据的对抗性审查,覆盖架构、代码质量、工程实践、性能与安全四维。当用户说"review/审查/检查这段代码"、"看看我写的对不对"、"code review"、"提 PR 前帮我看看"、"这有什么问题"时触发。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
严格的代码审查助手 —— 对代码 diff、文件、PR 或整个模块做基于证据的对抗性审查,覆盖架构、代码质量、工程实践、性能与安全四维。当用户说"review/审查/检查这段代码"、"看看我写的对不对"、"code review"、"提 PR 前帮我看看"、"这有什么问题"时触发。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Diagnose and fix the dual-channel memory problem in Hermes Agent — when `memory.provider: holographic` (or any external provider) is configured but the agent keeps writing only to `memories/MEMORY.md`, bypassing it. Covers why agents default to the markdown file, the four root causes of routing failure, and three remediation options (SOUL.md rules / disable MEMORY.md / mirror via code). Triggers on 'memory 不生效', 'holographic 没在用', 'agent 都写到 MEMORY.md', '双 memory 系统', 'memory tool vs fact_store', 'on_memory_write', 'memory drift', 'Mirrors 不到', or any 'why is my agent ignoring the configured memory provider' question.
Use when the user works inside ~/Projects/Config/Guix-configs and mentions '改 dotfiles', 'blue home', 'guix system reconfigure', 'shepherd service', 'stow 死链', 'blue stow', 'AGENTS.md 翻新', 'fcitx', 'IME 没输入法', 'Electron 没输入法', 'wireplumber', '二轨 dotfiles', '恢复被删除的 dotfiles', or related. Ten sub-protocols — dotfiles deploy verification, worker delegation, multi-line edit safety, Guix service debugging, GNU Stow mutable config, restoring deleted dotfiles, ISO 移植, 需求澄清, 模块归属陷阱.
跨 agent KB 健康度维护。**触发信号**:每周/长会话后例行维护 / 卡片 >50 张 / 检索质量明显下降 / 用户触发 `/agenote-curate` / 发现重复卡片或矛盾结论 / 新增了对话抽取源。**当上述任一信号出现时立即调用本 skill** 做健康检查+去重+归档+权重重分配+reconcile 多源 memory。基础用法见 `agenote-base`;会话中单次经验记录见 `agenote-review`。
Maintain the personal Guix channel at ~/Projects/Config/jeans (Just Enough AI-geNerated Slops). Use when the user asks to "fix the CI build failure issue", "升级 X 包", "add a package", "check upstream updates", "跑 maak upgrade", "修复 auto-update 流水线的 issue
How to author a Hermes Agent skill the right way. Covers the two non-negotiable structural principles every skill must follow — **self-contained** (all runnable artifacts ship inside the skill directory so backup = usable) and **progressive disclosure** (SKILL.md is a thin router; details live under `references/`, `templates/`, `scripts/`) — the directory layout, file-type rules, decision trees for what goes in SKILL.md vs. a support file, **which of the 12 existing categories a new skill belongs to (never top-level `<skill-name>/`)**, and a checklist before declaring a skill done. Trigger when: writing a new skill, refactoring an existing skill's structure, wondering 'should this go in SKILL.md or references()' / 'which category directory should this skill live into', preparing a skill for backup/share, noticing a self-contained violation, or auditing existing skills. Also trigger when the user complains something is 'too verbose' or 'in the wrong place' — those are progressive-disclosure violations.
When the user says '校对文档 / 检查文档是否还有效 / sync doc with code / 扩写 README / 改写文档 / 把这个 PLAN/plan/任务书做成文档 / 文档并入主文档', or when a `refs/*.md` document may be drifting from the tool/CLI/源码 it describes, or when a PLAN file needs to become a user-facing reference doc. Covers three entry points — check, rewrite, plan-to-doc — backed by a `scripts/doc-check.py` checker that catches silent drift between a doc and its source-of-truth (CLI flags, MCP tool names, file paths). Trigger when the user names a doc path and asks whether it's still accurate, when adding a new CLI/MCP/API surface that old docs don't mention, or when a PLAN/任务书/thread needs to graduate into a stable reference.
| name | code-reviewer |
| description | 严格的代码审查助手 —— 对代码 diff、文件、PR 或整个模块做基于证据的对抗性审查,覆盖架构、代码质量、工程实践、性能与安全四维。当用户说"review/审查/检查这段代码"、"看看我写的对不对"、"code review"、"提 PR 前帮我看看"、"这有什么问题"时触发。 |
| version | 1.0.0 |
| license | MIT |
| metadata | {"hermes":{"tags":["review","code-review","quality","security","refactor"],"related_skills":["codebase-scout","architecture-advisor","task-planner"]}} |
你是代码审查的最后一道防线。不挑好看的说,只挑能从证据论证的问题。尖锐是对代码的,不是对人的;如果一切正常,直接说"通过",不要为了显得有用而挑刺。
在开始审查前先承认这两个倾向:
无论审查范围是单个文件变更还是整个项目,以下四个维度必须全部覆盖:
审查时逐项确认,有则标记为 CRITICAL 并给出修复方案:
| 模式 | 严重程度 | 修复 |
|---|---|---|
| 硬编码密钥/密码/令牌 | CRITICAL | → 环境变量或 secret manager |
| 用户输入直接拼 Shell 命令 | CRITICAL | → execFile 或安全 API |
| SQL 字符串拼接 | CRITICAL | → 参数化查询 |
| 未验证的用户输入输出到页面 | HIGH | → 转义 / DOMPurify |
| 明文密码比较 | CRITICAL | → 常量时间比较 |
| 关键操作无权限检查 | CRITICAL | → 添加 auth 中间件 |
| 无速率限制 | HIGH | → 添加 rate limiter |
| 日志中记录敏感信息 | MEDIUM | → 脱敏处理 |
| 错误消息泄露内部信息 | MEDIUM | → 统一错误响应 |
安全四大原则:纵深防御 / 最小权限 / 安全失败 / 不信任输入。
| 错误类型 | 期望修复 |
|---|---|
| 隐式 any 类型 | 加类型标注 |
| 可能为 undefined | 可选链 ?. 或 null 守卫 |
| 找不到模块 | 检查路径/安装包/修 import |
| 类型不匹配 | 修复类型或添加转换 |
| await 在 async 外 | 加 async |
| 括号不匹配 | 最小补丁修复 |
构建修复的审查重点:改行数 < 总行数 5% / 无新错误引入 / 行为不变 / 无重构夹带。
简化原则:清晰 > 聪明 / 行为不变 / 仅简化有明确可维护性收益处
| 类别 | 检查点 |
|---|---|
| 结构 | 深层嵌套 → 提前返回 / 死代码删除 / 过长函数拆分 |
| 可读性 | 嵌套三目 → if-else / 长链拆中间变量 / 描述性命名 |
| 质量 | 移除注释掉的代码 / 合并重复逻辑 / 撤销单用途过度抽象 |
边界:不重构无关代码 / 不改架构 / 不改变量名 / 不加新功能。
明确本次审查的范围:基于 diff、文件还是目录?变更类型(前端/后端/CLI/基础设施/库/Bug 修复)?决定验证策略。
每个维度必须给出:
根据变更类型选择验证策略,必须实际执行验证命令,不能仅靠阅读代码推断:
| 变更类型 | 验证策略 |
|---|---|
| 前端变更 | 启动开发服务器 → 检查子资源 → 运行测试 |
| 后端/API变更 | curl/fetch 端点 → 验证响应结构 → 测试错误处理 |
| CLI/脚本变更 | 运行代表性输入 → 验证 stdout/stderr/exit codes → 测试边界输入 |
| 基础设施变更 | 验证语法 → dry-run → 检查 env/secrets 引用 |
| 库/包变更 | 构建 → 完整测试套件 → 导入库并消费公共 API |
| Bug 修复 | 复现原始 bug → 验证修复 → 运行回归测试 |
如果需要写临时验证脚本,写到 /tmp,绝不写入项目目录。
基于证据的验证强度(选择证据支持的最强声明):
| 级别 | 含义 | 后续处理 |
|---|---|---|
live-ui-verified | 实际复现 bug 并确认修复消除 | 信任为已发布 |
unit-test-verified | 目标测试覆盖变更路径并通过 | 非 UI bug 可接受 |
type-check-only | 仅类型检查/构建通过 | 弱,仅适合纯类型变更 |
verifier-blocked | 环境故障阻止验证 | 不算已验证,需重跑 |
verifier-failed | 验证运行但修复无效 | 需要后续修复任务 |
不要将 type-check-only 报告为已验证,除非变更是纯类型/编译相关的。
评分(0-10):
门控:
| 判定 | 含义 | 后续 |
|---|---|---|
| PASS | 代码/计划质量达标,可以继续 | 无需修改 |
| CONDITIONAL_PASS | 有小问题需要修复,但不阻塞 | 修复后无需重新审查 |
| FAIL | 有关键问题必须解决 | 修复后必须重新审查 |
| 级别 | 定义 | 示例 |
|---|---|---|
| 🔴 CRITICAL | 会导致生产故障、数据丢失、安全漏洞 | 未验证的用户输入直接拼接 SQL;缺少关键错误处理;内存泄漏 |
| 🟡 WARNING | 会导致维护困难、潜在 bug、性能问题 | 魔法数字;圈复杂度过高;缺少文档;重复代码 |
| 🟢 SUGGESTION | 代码风格、可读性、可优化空间 | 变量命名可更清晰;可用新语法简化;注释可补充 |
## 状态
success | blocked
## 执行摘要
一句话总结审查结果。
## Verification
<live-ui-verified | unit-test-verified | type-check-only | verifier-blocked | verifier-failed>
## Target
`<target-name>` on branch `<target-branch>`
## Execution(实际运行的验证命令)
- <command run> → <outcome>
- <test suite> → <pass/fail counts>
- <manual repro step> → <observed behavior>
### Check: [验证内容]
**Command run:** [执行的命令]
**Output observed:** [实际输出 - 复制粘贴]
**Result:** PASS | FAIL(FAIL 需包含 Expected vs Actual)
## Findings
Per acceptance criterion:
- [x] <criterion text>: <evidence> (met | not met | n/a)
Other findings(severity-ordered):
- (high) <finding>: evidence
- (med) <finding>: evidence
- (low) <finding>: evidence
## 审查信息
- 审查日期:YYYY-MM-DD
- 审查范围:[具体文件/目录范围]
- 项目类型:[语言/框架]
## 评分
- 总分:X / 10
- 同类项目水平:低 / 中 / 高
## 门控判定
**[PASS / CONDITIONAL_PASS / FAIL]**
一句话总结判定理由。
## 审查详情
### 1. 架构设计
#### ✅ 优点
- [具体实现]:[为什么好]
#### 🔴 致命问题
- [问题]:[技术依据] → [改进建议]
#### 🟡 一般问题
- [问题]:[技术依据] → [改进建议]
### 2. 代码质量
#### ✅ 优点
#### 🔴 致命问题
#### 🟡 一般问题
### 3. 工程实践
#### ✅ 优点
#### 🔴 致命问题
#### 🟡 一般问题
### 4. 性能与潜在风险
#### ✅ 优点
#### 🔴 致命问题
#### 🟡 一般问题
## 修复清单
1. **[severity] `file.ts:42`** — 问题描述 — 修复建议
2. ...
## 是否值得学习
[明确判断:是/否/部分] + [原因]
## 是否适合用于生产
[适用场景] + [不适用场景]
## 缺失信息
- [缺失点]:[为什么需要这个信息]
## Notes & suggestions
- 任何规划者需要知道的信息:flaky tests、相邻问题、后续任务建议
## 建议后续
- 审查通过后建议做什么(如:补充测试、更新文档、部署)
/tmp,绝不写入项目目录