mattpocock/skills

improve-codebase-architecturemattpocock/skills

先看架构改进报告,再决定改哪里

  • SKILL.md 已保存
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

improve-codebase-architecture 是什么?

用来找出代码库中难理解、难测试的模块,提出把复杂度收进模块内部的改造候选,并生成带改造前后示意图的 HTML 报告。选中一个候选后,它再通过追问澄清设计;不是扫描后立刻替你重构整个仓库。

中文说明由本站依据来源整理;英文原文保留在页面下方。

适合用在

  • 某个功能总要跨多个小模块修改,想先判断哪里值得重构。
  • 团队需要比较几种架构改进机会,并保留涉及文件、收益和推荐强度。

这些情况不适合

  • 只想格式化代码或自动修复 lint;这不是格式化工具。
  • 没有选定改造方向,就要求它批量改生产代码。

同名项目,请核对仓库和目录

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 improve-codebase-architecture,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 improve-codebase-architecture

请在 Codex 的当前工作环境中安装并检查 improve-codebase-architecture 这个 Skill。

项目身份:mattpocock/skills / improve-codebase-architecture
来源:https://github.com/mattpocock/skills/blob/5863806dd4e15c63174bee4e7515a4256792ecfa/skills/engineering/improve-codebase-architecture/SKILL.md
已定位的源文件:skills/engineering/improve-codebase-architecture/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 提供真实仓库和要检查的模块或痛点;没有指定方向时,来源要求先用 git log --oneline 找近期经常改动的区域。
  • 安装目录需保留 HTML-REPORT.md;完整流程还会调用 codebase-design、grilling 和 domain-modeling。已有 GLOSSARY.md、GLOSSARY-MAP.md 和相关 docs/adr/ 应一起提供。

会得到什么

  • 一个位于系统临时目录的 HTML 报告及绝对路径,含候选改造和首选理由。
  • 选定候选后的设计讨论;讨论可能更新术语表,值得长期保留的取舍才考虑 ADR。

实际使用顺序

  1. 先读领域术语表与相关 ADR,再按指定模块或提交热点确定扫描范围。
  2. 检查理解一个概念是否需要来回跳文件、接口是否和实现一样复杂、测试是否绕过公开接口;用 deletion test 判断删除某个浅模块会集中复杂度还是只把它搬走。
  3. 在系统临时目录生成 architecture-review-<timestamp>.html,每个候选写清文件、问题、方案、收益、前后图及 Strong / Worth exploring / Speculative 推荐强度,给出首选。
  4. 先打开报告让你选择候选,不提前设计接口。选中后调用 grilling 讨论约束和测试;新领域词交由 domain-modeling 记录,需要推翻既有 ADR 的建议应明确标记。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

教学示例:请用 improve-codebase-architecture 检查当前仓库的订单创建流程。先读 GLOSSARY.md、相关 ADR 和最近提交,只分析订单模块。生成带涉及文件、前后图、推荐强度的 HTML 候选报告,放到系统临时目录并给出路径。先让我选一个方向,不直接重构代码。若缺 codebase-design、grilling 或 HTML-REPORT.md,请列出缺项,不猜补内容。
预期结果

预期得到可打开的架构候选报告和需要你选择的问题;不会仅因报告生成就声称架构已优化。此教学任务未在本站运行。

使用前先看这些限制

使用条件与边界

  • 它评估的是模块深度和可测试性,不提供覆盖所有缺陷的静态分析保证。
  • HTML 文件写在临时目录,但所用 Tailwind/Mermaid 样式与图表依赖 CDN;离线打开时需检查展示是否完整。
  • 选中候选后的讨论可能写 GLOSSARY.md;已有 ADR 不是可以默默覆盖的普通建议。
针对这个 Skill 的疑问

常见问题

会直接改我的代码吗?

前半段先生成候选报告并等你选方向,不应直接重构。后续领域建模可能更新术语文档,代码实施需要明确具体范围。

为什么装了它还提到另外三个 Skill?

源文档把架构术语、设计追问和领域词记录分给 codebase-design、grilling、domain-modeling。只复制当前 SKILL.md 不能替代这些依赖及 HTML-REPORT.md。

需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

skills/engineering/improve-codebase-architecture/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

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

查看源文件章节 / Source sections
  • 原文:Improve Codebase Architecture
  • 原文:Process
  • 原文:1. Explore
  • 原文:2. Present candidates as an HTML report
  • 原文:3. Grilling loop
原文:Improve Codebase Architecture

Surface architectural friction and propose **deepening opportunities**: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability. This command is _informed_ by the project's domain model and built on a shared design vocabulary: - Call the Skill tool with "codebase-design" for the architecture vocabulary (**module**, **interface**, **depth**, **seam**, **adapter**, **leverage**, **locality**) and its principles (the deletion test, "the interface is the test surface", "one adapter = hypothetical seam, two = real"). Use these terms exactly in every suggestion, and don't drift into "component," "service," "API," or "boundary." - The domain language in `GLOSSARY.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.

原文:1. Explore

**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 (`GLOSSARY.md`) and any ADRs in the area you're touching first. Then spawn a sub-agent with a fresh context window to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction: - Where does understanding one concept require bouncing between many small modules? - Where are modules **shallow**, with an interface nearly as complex as the implementation? - Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)? - Where do tightly-coupled modules leak across their seams? - Which parts of the codebase are untested, or hard to test through their current interface? Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.

原文:2. Present candidates as an HTML report

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. For each candidate, render a card with: - **Files**: which files/modules are involved - **Problem**: why the current architecture is causing friction - **Solution**: plain English description of what would change - **Benefits**: explained in terms of locality and leverage, and how tests would improve - **Before / After diagram**: side-by-side, custom-drawn, illustrating the shallowness and the deepening - **Recommendation strength**: one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge End the report with a **Top recommendation** section: which candidate you'd tackle first and why. **Use GLOSSARY.md vocabulary for the domain, and the `/codebase-design` vocabulary for the architecture.** If `GLOSSARY.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. See [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.

本段为节选,完整内容见源文件。

原文:3. Grilling loop

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 `GLOSSARY.md`?** Add the term to `GLOSSARY.md`. Create the file lazily if it doesn't exist. - **Sharpening a fuzzy term during the conversation?** Update `GLOSSARY.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.

文件 SHA256:35b03a3db61e0f5aa333ea59b54963e45a3d2ace6649b2ef4f9576603e2582a6

仓库许可证记录:MIT;repository-license-recorded-scope-unverified,查看来源。

Skills.sh收录简介 · 2026-07-28

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

查看历史简介来源

历史收录数据

Skill标识improve-codebase-architecture
来源仓库mattpocock/skills
榜单快照2026-07-28
榜单口径Skills.sh累计安装量
快照名次7
快照累计安装量560332

历史资料说明

  • 安装量用于说明当时的收录次序,不是效果、可信度或当前可用性的证明。

此页用于识别项目与来源。安装入口可在该Skill的Skills.sh页面查看;当前目录是否仍存在、附带脚本和账户依赖尚需按具体版本确认。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源