Codebase design
One source. Every agent. Zero drift. | 跨 Agent 共享 Skill 管理系统 — 单一数据源,同步到 Claude Code / Codex / Hermes / OpenClaw
npx -y skills add Xuan0629/shared-skills --skill codebase-designAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.1 KB, as published. Nobody here has run it
Codebase Design — 代码库架构分析
哲学
好的代码库架构的特点是:深模块(小接口,深实现)、清晰的依赖方向、恰当的信息隐藏。这个技能帮你评估一个代码库是否具备这些特征。
分析维度
1. 模块边界
- 每个模块做什么?它的公开 API 是什么?
- 模块之间的依赖方向是什么?有没有循环依赖?
- 模块内部的 cohesion 如何?(改一个功能需要改多少文件?)
2. 抽象层级
- 是否有「深模块」—— 接口简单但内部实现涵盖了大量复杂性?
- 是否有「浅模块」—— 接口复杂但实现几乎没做什么?(pass-through 是典型信号)
- 是否存在 Wrong Abstraction?(一个泛化结构只有一个真正的使用者)
3. 信息隐藏
- 实现细节是否被恰当隐藏?
- 是否有模块暴露了内部数据结构的格式?(这会导致 consumer 和格式耦合)
- 修改一个内部实现是否需要改外部 consumer?
4. 依赖方向
- 高层策略代码依赖低层实现细节吗?(依赖倒置原则)
- 是否有 utility/module 被几乎所有模块依赖?(上帝模块反模式)
流程
1. 快速扫描
读顶层目录结构和关键文件(package.json/Cargo.toml/setup.py/主入口),理解项目整体架构。
2. 选择一个功能链
挑一个典型功能,追踪它从入口到输出的完整调用链。这是最好的"理解架构"的方法。
3. 标注问题和亮点
对每个维度打分(✓ 好 / ⚠ 注意 / ✗ 问题),每个标注必须有具体文件路径和行号作为证据。
4. 输出报告
## 架构分析: [项目名]
### 模块边界
- [模块A]: ✓ 职责清晰,API 紧凑
- [模块B]: ⚠ 和模块C之间有隐式耦合(见 src/b.ts:42)
### 抽象层级
- [模块]: ✗ 浅模块 — 接口有 7 个导出但每个只有 1-3 行
### 依赖方向
- 整体: ✓ 单向依赖,无循环
- src/utils → 被 8 个模块依赖 — 考虑拆分
### 建议
1. [优先级最高的问题 + 修复路径]
2. ...