用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/vinvcn/mattpocock-skills-zh-CN --skill improve-codebase-architecture命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
询问当前情境适合哪个技能或流程;它是本仓库所有 skills 的路由器。
从固定点(commit、branch、tag 或 merge-base)开始,按 Standards(代码是否符合本仓库记录的编码标准?)和 Spec(代码是否符合来源 issue/spec 的要求?)两个轴线审查变更。两个审查会在并行子代理中运行,并并排报告。适用于用户想审查 branch、PR、进行中的变更,或要求 “review since X” 时。
用于设计深模块的共享词汇。适用于用户想设计或改进模块接口、寻找深化机会、决定 seam 放在哪里、让代码更容易测试或更适合 AI 导航,或其他技能需要深模块词汇时。
基于 SOC 职业分类
正在显示 SKILL.md
| name | improve-codebase-architecture |
| description | 扫描代码库中的深化机会,生成可视化 HTML 报告,然后围绕你选中的候选项继续追问。 |
| disable-model-invocation | true |
暴露 architectural friction,并提出 deepening opportunities:把 shallow modules 变成 deep modules 的 refactors。目标是 testability 和 AI-navigability。
这个命令由项目的 domain model 提供信息,并建立在共享 design vocabulary 上:
/codebase-design skill,获取 architecture vocabulary(module、interface、depth、seam、adapter、leverage、locality)及其 principles(deletion test、"the interface is the test surface"、"one adapter = hypothetical seam, two = real")。每条建议都准确使用这些术语,不要漂移到 "component"、"service"、"API" 或 "boundary"。CONTEXT.md 中的 domain language 会为好的 seams 命名;docs/adr/ 中的 ADRs 记录这个命令不应重新争论的 decisions。先划定扫描范围——YAGNI。 深化 module 的收益在于让未来修改更容易,因此要更关注最近仍在变化的 codebase 区域。开始探索前先决定去哪里看:
git log --oneline),找出反复出现的 files 和 areas,让这些 hot spots 成为首要关注点。如果变更分散、没有明显 hot spot,再扩大范围。先读取项目 domain glossary(CONTEXT.md)以及你将触碰区域的 ADRs。
然后 spawn 一个 sub-agent 来遍历 codebase。不要套死板 heuristics;自然探索,并记录你感到 friction 的地方:
对任何你怀疑 shallow 的东西应用 deletion test:删除它会让复杂度集中,还是只把复杂度移动到别处?"yes, concentrates" 才是你要的 signal。
把 self-contained HTML file 写到 OS temp directory,避免任何内容落进 repo。Temp dir 从 $TMPDIR 解析,fallback 到 /tmp(Windows 用 %TEMP%),写到 <tmpdir>/architecture-review-<timestamp>.html,让每次运行都有新文件。为用户打开它:Linux 用 xdg-open <path>,macOS 用 open <path>,Windows 用 start <path>,并告诉用户 absolute path。
Report 使用 Tailwind via CDN 做 layout/styling,用 Mermaid via CDN 做能可靠传达结构的 diagrams。Mermaid 和手写 CSS/SVG visuals 可以混用:关系是 graph-shaped(call graphs、dependencies、sequences)时用 Mermaid;需要 editorial 表达(mass diagrams、cross-sections、collapse animations)时用手写 divs/SVG。每个 candidate 都要有 before/after visualisation。要视觉化。
每个 candidate 渲染一张 card,包含:
Strong、Worth exploring、Speculative 之一,渲染为 badgeReport 末尾包含 Top recommendation section:你会先处理哪个 candidate,以及为什么。
用 CONTEXT.md vocabulary 表达 domain,用 /codebase-design vocabulary 表达 architecture。 如果 CONTEXT.md 定义了 "Order",就说 "Order intake module",不要说 "FooBarHandler",也不要说 "Order service"。
ADR conflicts:如果 candidate 与现有 ADR 冲突,只有在 friction 真实到值得重新打开 ADR 时才提出。Card 中明确标记(例如 warning callout:"contradicts ADR-0007 - but worth reopening because...")。不要列出 ADR 理论上禁止的每个 refactor。
完整 HTML scaffold、diagram patterns 和 styling guidance 见 HTML-REPORT.md。
现在不要提出 interfaces。写完文件后问用户:"Which of these would you like to explore?"
用户选中 candidate 后,运行 /grilling skill,与用户走完 decision tree:constraints、dependencies、deepened module 的形状、seam 后面放什么、哪些 tests 能保留。
Side effects 随 decisions 成形而内联发生;运行 /domain-modeling skill,让 domain model 保持最新:
CONTEXT.md 中不存在的概念命名 deepened module? 把 term 加入 CONTEXT.md。若文件不存在,按需创建。CONTEXT.md。/codebase-design skill,并使用其中的 design-it-twice parallel sub-agent pattern。