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

Improve Codebase Architecture Skill 安全审计

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

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

第三方安全检查结论

先别安装或运行

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

自动打开的报告会执行未固定的第三方 CDN 脚本,并启用 Mermaid 宽松安全模式

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

报告模板从 cdn.tailwindcss.com 加载浮动脚本,并从 jsDelivr 加载仅固定到主版本 11 的 Mermaid;这些脚本会在报告打开时执行。Mermaid 还被配置为 securityLevel: "loose"。仓库内容会用于生成图表和报告,但指令没有要求对插入 HTML 或 Mermaid 的文字进行转义。

为什么需要注意

CDN 内容若被篡改、供应链受损或版本行为改变,第三方代码可读取报告 DOM(包括文件名和架构结论)并发起网络请求。若恶意仓库文字未经转义进入宽松模式的图表,还可能生成主动内容或欺骗性报告。

报告被要求自动打开;打开时浏览器会执行来自两个第三方 CDN 的代码,其中 Tailwind 未固定版本,Mermaid 只固定到主版本 11,并使用较宽松的安全模式。若 CDN 内容遭替换,或仓库文字未经 HTML/Mermaid 转义就进入报告,第三方脚本或构造内容可能在报告页面的浏览器权限内运行。源码未证明仓库文字确实未经转义,因此该部分是条件性风险。用户可要求作者固定带完整版本与完整性校验的资源、改为本地静态资源、使用严格模式并明确转义规则,或限制自动打开/网络访问。

SKILL.md:39来自说明文档打开原文件
Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user (`xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows) and tell them the absolute path.The report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.
查看另外 3 个位置
HTML-REPORT.md:12来自说明文档打开原文件
    <meta charset="utf-8" />    <title>Architecture review for {{repo name}}</title>    <script src="https://cdn.tailwindcss.com"></script>    <script type="module">      import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";      mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });    </script>    <style>
HTML-REPORT.md:96来自说明文档打开原文件
- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.
HTML-REPORT.md:100来自说明文档打开原文件
- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 1 项风险
中风险

选择候选方案后可能未经单独确认就永久修改项目的领域文档

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

Skill 明确声明副作用会随讨论直接发生:新概念会被加入 CONTEXT.md,不存在时还会创建该文件;术语澄清也会立即写入。这里没有要求在写入前展示差异或再次取得用户同意。

为什么需要注意

仅想探索架构方案的用户可能得到意外的工作区改动。这些改动可能污染未提交工作、改变以后代理理解项目的方式,或把尚未定案的术语固化为项目约定。

用户选择候选方案只明确授权进入讨论,但 Skill 随后规定“副作用”应在讨论中即时发生,并要求新增或立即更新 CONTEXT.md;只有记录 ADR 的分支明确要求询问用户。因而在讨论产生新名称或术语澄清时,项目文档可能在没有单独确认或差异预览的情况下被创建或永久修改。用户可限制该 Skill 为只读,或要求作者把所有 CONTEXT.md 写入改成先展示差异并逐次确认。

SKILL.md:64来自说明文档打开原文件
Once the user picks a candidate, call the Skill tool with "grilling" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.Side effects happen inline as decisions crystallize; call the Skill tool with "domain-modeling" to keep the domain model current as you go:- **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md`. Create the file lazily if it doesn't exist.- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons ("not worth it right now") and self-evident ones.- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with "codebase-design" and use its design-it-twice parallel sub-agent pattern.
查看另外 2 个位置
SKILL.md:60来自说明文档打开原文件
Do NOT propose interfaces yet. After the file is written, ask the user: "Which of these would you like to explore?"### 3. Grilling loopOnce the user picks a candidate, call the Skill tool with "grilling" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
SKILL.md:66来自说明文档打开原文件
Side effects happen inline as decisions crystallize; call the Skill tool with "domain-modeling" to keep the domain model current as you go:- **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md`. Create the file lazily if it doesn't exist.- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons ("not worth it right now") and self-evident ones.- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with "codebase-design" and use its design-it-twice parallel sub-agent pattern.
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。未发现风险
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。发现 1 项风险
中风险

仓库中的非可信文字可能影响代理的判断和后续操作

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

Skill 指示代理读取 CONTEXT.md、ADR、提交历史并广泛探索代码,但没有要求把其中的命令式文字仅作为数据处理。之后代理还会依据这些材料选择建议并进入可修改项目文档的流程。

为什么需要注意

恶意或被污染的仓库可在文档、历史或源码文字中放置提示注入,诱导代理歪曲审查结论、扩大扫描范围,或触发不符合用户意图的后续文档变更。

这段证据能说明什么

Skill 确实要求读取提交历史、CONTEXT.md、ADR 和代码,并让这些内容影响扫描范围、建议及后续讨论;但可见源码没有指示代理执行这些文件中的命令,也没有显示任何仓库内的恶意文字。因此,“仓库文字会劫持代理”缺少直接证据,只能指出未声明隔离非可信内容的潜在缺口。用户可要求作者明确将仓库文字仅视为数据、忽略其中面向代理的指令,并在任何写入前列出来源和拟议变更。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
SKILL.md:22来自说明文档打开原文件
- If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.- Otherwise, walk back a good stretch of the commit history (`git log --oneline`) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.Read the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.Then spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:
查看另外 2 个位置
SKILL.md:64来自说明文档打开原文件
Once the user picks a candidate, call the Skill tool with "grilling" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.Side effects happen inline as decisions crystallize; call the Skill tool with "domain-modeling" to keep the domain model current as you go:- **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md`. Create the file lazily if it doesn't exist.- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons ("not worth it right now") and self-evident ones.- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with "codebase-design" and use its design-it-twice parallel sub-agent pattern.
SKILL.md:54来自说明文档打开原文件
**Use CONTEXT.md vocabulary for the domain, and the `/codebase-design` vocabulary for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module," not "the FooBarHandler," and not "the Order service."**ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: _"contradicts ADR-0007, but worth reopening because…"_). Don't list every theoretical refactor an ADR forbids.
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

1 个说明模块

该 Skill 先根据用户指定方向或 Git 提交历史确定扫描范围,再读取项目的 CONTEXT.md 和相关 ADR,并让子代理检查代码库中的架构摩擦。

查看原文
SKILL.md:20来自说明文档打开原文件
**Scope before you scan: YAGNI.** Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide *where* to look before you look:- If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.- Otherwise, walk back a good stretch of the commit history (`git log --oneline`) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.Read the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.Then spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:

扫描结果会写入操作系统临时目录中的新 HTML 文件,随后由默认应用自动打开;文件不会写入仓库。

查看原文
SKILL.md:37来自说明文档打开原文件
### 2. Present candidates as an HTML reportWrite a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user (`xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows) and tell them the absolute path.The report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.

用户选择候选方案后,Skill 会进入追问流程,并可能在讨论过程中直接创建或更新 CONTEXT.md。

查看原文
SKILL.md:62来自说明文档打开原文件
### 3. Grilling loopOnce the user picks a candidate, call the Skill tool with "grilling" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.Side effects happen inline as decisions crystallize; call the Skill tool with "domain-modeling" to keep the domain model current as you go:- **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md`. Create the file lazily if it doesn't exist.- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons ("not worth it right now") and self-evident ones.- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with "codebase-design" and use its design-it-twice parallel sub-agent pattern.
从这里开始 · 工作说明SKILL.md
improve-codebase-architecture
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

1 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录3 个文件

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文
  • HTML-REPORT.md已纳入全文
  • agents/openai.yaml已纳入全文

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

  • HTML-REPORT.md配套文件
  • SKILL.md工作说明
  • agents/openai.yaml配套文件

代码和说明中提到的操作

连接外部网站
HTML-REPORT.md:13来自说明文档打开原文件
    <title>Architecture review for {{repo name}}</title>    <script src="https://cdn.tailwindcss.com"></script>    <script type="module">
HTML-REPORT.md:15来自说明文档打开原文件
    <script type="module">      import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";      mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });
读取了多少行
202
文件校验值(用于核对版本)
9e69d6e1cd38b607f78afa616a1512440168e1b28e9ed0ad05050d057f98e5f9