跳转到正文
报告库
用途分类 / 开发辅助

Code Simplification Skill 安全审计

作者说它能做什么(原文)

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

第三方安全检查结论

发现安全风险

已检查文件
1
发现的风险
2
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
中风险

推荐的 async 简化可能改变异常与 Promise 行为

原文依据:3 处
发现了什么

示例把 async 函数改成普通函数并直接返回底层调用,但该 Skill 同时要求错误行为完全相同。如果 findById 在返回 Promise 前同步抛错,原函数会返回被拒绝的 Promise,而改写后的函数会同步抛出异常;返回 Promise 的对象身份也可能不同。仅凭声明的 Promise 返回类型不能排除这些差异。

为什么需要注意

调用方的 try/catch、Promise 链、重试或错误上报可能走不同路径,导致未处理异常、跳过恢复逻辑或运行时中断。

该示例是明确推荐的改写,却可能违反 Skill 自己要求的“错误行为完全相同”。如果 `findById` 在返回 Promise 前同步抛错,原 `async` 包装会产生 rejected Promise,改写后则会同步抛错;调用方的捕获方式可能因此失效。用户可要求仅在确认底层调用不会同步抛错且测试覆盖该差异时采用此改写。

SKILL.md:32来自说明文档打开原文件
### 1. Preserve Behavior ExactlyDon't change what the code does — only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
查看另外 2 个位置
SKILL.md:192来自说明文档打开原文件
```typescript// SIMPLIFY: Unnecessary async wrapper// Beforeasync function getUser(id: string): Promise<User> {  return await userService.findById(id);}// Afterfunction getUser(id: string): Promise<User> {  return userService.findById(id);}
SKILL.md:34来自说明文档打开原文件
Don't change what the code does — only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 1 项风险
中风险

测试通过后可能在未确认授权的情况下创建 Git 提交

原文依据:2 处
发现了什么

逐项流程明确写着测试通过后“commit”,但没有要求先确认用户是否允许修改仓库历史。请求代码简化并不必然授权代理创建提交。

为什么需要注意

代理可能生成用户未要求的永久提交,改变分支历史,并把尚未人工审阅的重构记录为已提交工作。

这是实际流程指令,不是单纯示例:每次简化测试通过后可执行 `commit`,且前文还要求拆分提交。Git 提交会修改仓库历史,而 Skill 没有在这些步骤中要求确认用户是否授权提交。因此,仅要求重构的用户可能得到未预期的提交。用户可限制为只修改和测试,并要求任何提交前单独确认。

SKILL.md:161来自说明文档打开原文件
```FOR EACH SIMPLIFICATION:1. Make the change2. Run the test suite3. If tests pass → commit (or continue to next simplification)4. If tests fail → revert and reconsider```
查看另外 1 个位置
SKILL.md:159来自说明文档打开原文件
Make one simplification at a time. Run tests after each change. **Submit refactoring changes separately from feature or bug fix changes.** A PR that refactors and adds a feature is two PRs — split them.
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。未发现风险
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该 Skill 指导代理在理解调用关系、错误路径、测试和历史背景后,对近期修改的代码做增量式重构,并要求保持输入、输出、副作用和错误行为不变。

查看原文
SKILL.md:34来自说明文档打开原文件
Don't change what the code does — only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
SKILL.md:112来自说明文档打开原文件
```BEFORE SIMPLIFYING, ANSWER:- What is this code's responsibility?- What calls it? What does it call?- What are the edge cases and error paths?- Are there tests that define the expected behavior?- Why might it have been written this way? (Performance? Platform constraint? Historical reason?)- Check git blame: what was the original context for this code?```
SKILL.md:101来自说明文档打开原文件
### 5. Scope to What ChangedDefault to simplifying recently modified code. Avoid drive-by refactors of unrelated code unless explicitly asked to broaden scope. Unscoped simplification creates noise in diffs and risks unintended regressions.

它要求逐项修改并运行测试,同时建议把重构与功能或缺陷修复分开提交。

查看原文
SKILL.md:157来自说明文档打开原文件
### Step 3: Apply Changes IncrementallyMake one simplification at a time. Run tests after each change. **Submit refactoring changes separately from feature or bug fix changes.** A PR that refactors and adds a feature is two PRs — split them.```FOR EACH SIMPLIFICATION:1. Make the change2. Run the test suite3. If tests pass → commit (or continue to next simplification)4. If tests fail → revert and reconsider```
从这里开始 · 工作说明SKILL.md
code-simplification
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。
文件与检查记录1 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明

代码和说明中提到的操作

连接外部网站
SKILL.md:8来自说明文档打开原文件
> Inspired by the [Claude Code Simplifier plugin](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/code-simplifier/agents/code-simplifier.md). Adapted here as a model-agnostic, process-driven skill for any AI coding agent.
读取了多少行
332
文件校验值(用于核对版本)
f2f1a31c6d13baa40d77841ad61dc10b353b8c017c74c893bf0d4e17a6a74deb