improve-codebase-architecture
Installation
SKILL.md
Improve Codebase Architecture
暴露 architectural friction,并提出 deepening opportunities:把 shallow modules 变成 deep modules 的 refactors。目标是 testability 和 AI-navigability。
这个命令由项目的 domain model 提供信息,并建立在共享 design vocabulary 上:
- 运行
/codebase-designskill,获取 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。
Process
1. Explore
先划定扫描范围——YAGNI。 深化 module 的收益在于让未来修改更容易,因此要更关注最近仍在变化的 codebase 区域。开始探索前先决定去哪里看:
- 如果用户点名了方向——module、subsystem 或 pain point——就按该方向探索,跳过下面的推断。
- 否则,向前回看一段足够长的 commit history(
git log --oneline),找出反复出现的 files 和 areas,让这些 hot spots 成为首要关注点。如果变更分散、没有明显 hot spot,再扩大范围。
先读取项目 domain glossary(CONTEXT.md)以及你将触碰区域的 ADRs。