安全扫描
OpenClaw
安全
high confidence该技能的要求与说明与其既定目的保持一致:它会检查最近的代码更改并提供保守的、需用户确认的编辑;无需凭据或安装,仅提供指令。
评估建议
This skill appears to do what it claims: scan recent git changes, produce a reuse/quality/efficiency checklist, and apply conservative fixes after asking you. Before using it: (1) make sure your repo is backed up or committed (it runs git diff and will edit files); (2) expect it to run simple dev tools (git, grep) though they aren't listed in metadata; (3) confirm and review every proposed edit (the skill promises to ask and explain each change); (4) it will not auto-install dependencies or run ...详细分析 ▾
ℹ 用途与能力
The name/description (code simplification before PR) matches the instructions: locate recent git changes, scan the touched files, produce a triaged checklist, and optionally apply edits. Minor mismatch: SKILL.md assumes availability of developer tools (git, grep) but the skill metadata lists no required binaries.
✓ 指令范围
Instructions are narrowly scoped to reading only the changed files (by default), producing a checklist, and asking the user before making edits. The skill explicitly forbids wide scans, automatic dependency installs, renaming across files without confirmation, editing tests, touching generated files, or running builds/tests unless asked — these limits keep the instruction scope appropriate.
✓ 安装机制
Instruction-only skill with no install spec or code files — lowest installation risk. Nothing is downloaded or written to disk by a packaging/install step.
✓ 凭证需求
The skill requests no environment variables or credentials. It operates on local repository files, which is expected for its purpose.
✓ 持久化与权限
always is false and the skill does not declare elevated persistence. The skill can edit files when the user consents, which is consistent with its stated behavior. Note: model invocation is allowed by default (normal for skills); ensure you consent to autonomous edits if you enable that capability.
安全有层次,运行前请审查代码。
运行时依赖
无特殊依赖
版本
latestv1.0.02026/4/24
首发 — 代码简化三维审查(复用/质量/效率)+ 分级修复清单
● Pending
安装命令
点击复制官方npx clawhub@latest install huo15-openclaw-simplify
镜像加速npx clawhub@latest install huo15-openclaw-simplify --registry https://cn.longxiaskill.com
技能文档
对刚写完的代码做“复用/质量/效率”三维体检 — 青岛火一五信息科技有限公司
---
一、触发场景
当用户刚完成一段实现,或准备提 PR,说:- “简化一下”
- “这段代码能不能更简洁”
- “帮我清理下冗余”
- “重构一下”
- “code review 一下(偏重质量)”
产出:三维清单(复用 / 质量 / 效率)+ 每条命中标注严重程度 + 自动修复可安全改的(保守策略)。
---
二、三维审查清单
维度 A:复用(Reuse)
| 项 | 命中信号 | 默认行动 | |----|---------|---------| | 与仓库内已有函数重复 | grep 到名称/行为相似的函数 | 标记 → 建议替换,不自动改(需用户确认契合) | | 逻辑可抽函数(重复出现 ≥3 次的片段)| 肉眼识别 + grep 验证 | 抽函数,放到最近的共用模块 | | 重新发明了标准库 / 已有依赖 | 出现如自写 deep-merge / debounce | 改用依赖;若依赖未装,不自动npm install,给命令让用户装 |
| 可下沉到 util | 业务代码里混进了纯函数 | 提取到 utils/ 或 lib/ | 维度 B:质量(Quality)
| 项 | 命中信号 | 默认行动 | |----|---------|---------| | 裸 any / 裸unknown 未收窄 | TS 语言明显 | 收窄类型,优先用 TypeBox / Zod 已有 schema |
| 魔法数字 / 魔法字符串 | 42, "pending" 散落 | 提常量,放到 constants.ts |
| 嵌套 if-else > 3 层 | 阅读困难 | 提前返回 / early return / 卫语句 |
| console.log 残留 | grep console\.(log|info|debug) | 删 / 改 logger;test 文件放过 |
| 注释是“做了什么”而非“为什么” | 注释重复代码 | 改“为什么”或删 |
| 命名不达意(data / temp / obj) | 一眼看不出含义 | 改成表达意图的名字 | 维度 C:效率(Efficiency)
| 项 | 命中信号 | 默认行动 | |----|---------|---------| | O(n²) 可降 O(n) | 嵌套 for + 查找 | Map / Set 替代 | | 同一对象重复 JSON.parse/stringify | 显眼的往返 | 缓存中间结果 | | 在循环里做 I/O(db 查询 / fetch)| await 在 for 里 | Promise.all 或批量查 | | 不必要的 re-render / 重新计算 | React useMemo 缺失;大对象每次新建 | 加记忆化 | | 整包导入(import *)| 引起 bundle 膨胀 | 按需导入 | ---
三、工作流(严格按序)
- 定位本次改动
git diff HEAD~1 或 git diff --staged
- 若 git 不干净,问用户“审查当前整个工作区还是只看刚改的?”
- 只读扫描
- 生成清单
file:line
- 与用户同步
- 执行修复
- 收尾
---
四、产出模板
``markdown
简化报告 —
🔴 必改(3 项)
[reuse]src/a.ts:45— deep-merge 自写实现,应改用 lodash.merge(已装)[quality]src/b.ts:12— 裸 any,应收窄为User | null[quality]src/c.ts:88— 3 层嵌套 if,建议 early return
🟡 建议(2 项)
[efficiency]src/d.ts:33— for 循环里 await fetch,改 Promise.all 减 3× 耗时[reuse]src/e.ts:70— 与utils/slugify.ts逻辑重复
🟢 可选(1 项)
[quality]src/f.ts:5— 变量名data可改为userProfiles
未动
- [quality] test 文件中的 console.log(按惯例放过)
` ---
五、硬红线(绝不触碰)
- 不自动重命名跨文件符号 — 除非用户明确说“改所有引用”
- 不动测试断言 — 可以补测试,不改已有断言
不引入新依赖 — 即使建议了,也只给npm install x命令,不 exec- 不跑格式化器 — 除非用户明确说“顺便跑 prettier”
不碰 generated 代码 — 识别@generated/// DO NOT EDIT/dist//build/
---
六、与相邻技能的边界
| 场景 | 用哪个 |
|------|--------|
| 只看代码质量 | 本技能 |
| 看安全漏洞(密钥 / 注入 / XSS)| huo15-openclaw-security-review |
| PR 全流程评审(含安全 + 质量 + 设计)| huo15-openclaw-code-review |
| 设计稿 / UI 打分 | huo15-openclaw-design-critique` |