From mattpocock-skills
Analyzes codebase architecture to identify shallow modules and propose refactoring opportunities that increase depth, testability, and AI-navigability. Use when improving architecture, finding refactoring candidates, or consolidating tightly-coupled code.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mattpocock-skills:improve-codebase-architectureThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
暴露 architecture friction,并提出 **deepening opportunities**,也就是把 shallow modules 变成 deep modules 的 refactors。目标是 testability 和 AI-navigability。
暴露 architecture friction,并提出 deepening opportunities,也就是把 shallow modules 变成 deep modules 的 refactors。目标是 testability 和 AI-navigability。
在每个建议中精确使用这些术语。语言一致性就是重点,不要漂移到 “component”、“service”、“API” 或 “boundary”。完整定义见 LANGUAGE.md。
关键原则(完整列表见 LANGUAGE.md):
这个 skill 会参考项目的 domain model。Domain language 为好的 seams 命名;ADRs 记录 skill 不应重新争论的决策。
先读取项目的 domain glossary 和你将触碰区域的任何 ADR。
然后使用 Agent tool 和 subagent_type=Explore 遍历 codebase。不要死套启发式规则;自然探索并记录你感到 friction 的地方:
对任何疑似 shallow 的东西应用 deletion test:删除它会集中复杂性,还是只是移动复杂性?“会集中”就是你要找的信号。
写一个 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>,并告诉用户绝对路径。
Report 使用 Tailwind via CDN 做 layout 和 styling,使用 Mermaid via CDN 处理适合 graph/flow/sequence 的 diagrams。Mermaid 要和手写 CSS/SVG visual 混用:关系是 graph-shaped(call graphs、dependencies、sequences)时用 Mermaid;想要更 editorial 的效果(mass diagrams、cross-sections、collapse animations)时用 hand-built divs/SVG。每个 candidate 都要有一个 before/after visualisation。要视觉化。
每个 candidate 仍使用之前的模板,但渲染成 card:
Strong、Worth exploring、Speculative 之一,渲染成 badgeReport 最后加一个 Top recommendation section:你会先处理哪个 candidate,以及原因。
domain 词汇使用 CONTEXT.md,architecture 词汇使用 LANGUAGE.md。 如果 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。文件写好后,问用户:“你想探索哪一个?”
用户选中 candidate 后,进入 grilling conversation。和他们走完整个 design tree:constraints、dependencies、deepened module 的形状、seam 后面是什么、哪些 tests 能经受变化。
决策成形时内联产生 side effects:
CONTEXT.md 中没有的概念命名 deepened module? 把 term 加到 CONTEXT.md,纪律同 /grill-with-docs(见 CONTEXT-FORMAT.md)。文件不存在就懒创建。CONTEXT.md。npx claudepluginhub vinvcn/mattpocock-skills-zh-cnIdentifies shallow modules and architectural friction in a codebase, using domain language from CONTEXT.md and ADR decisions, to propose refactoring opportunities for testability and AI-navigability.
Analyzes codebase architecture, identifies shallow modules, and proposes deepening refactors to improve testability and AI-navigability using precise vocabulary (Module, Interface, Depth, Seam, Adapter).
Analyzes codebase architecture to find refactoring opportunities, consolidate tightly-coupled modules, and improve testability and AI-navigability using domain language and ADRs.