codebase-design
Shared vocabulary for designing deep modules. Invoke when the user asks to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary. Do not invoke merely because the user mentions codebase-design, names a skill, or writes 'skill <word>'.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- codebase-design
- description
- Shared vocabulary for designing deep modules. Invoke when the user asks to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary. Do not invoke merely because the user mentions codebase-design, names a skill, or writes 'skill <word>'.
- disable-model-invocation
- true
02 资源文件 2
- 参考文档DEEPENING.md1.7 KB
- 参考文档DESIGN-IT-TWICE.md1.7 KB
03 SKILL.md 正文
Codebase Design
Scope
This skill owns the shared vocabulary for deep-module design. It is a reference. It does not implement and it does not run a session.
Objective
Design deep modules: much behaviour behind a small interface at a seam that isolates the implementation. The aim is leverage for callers, locality for maintainers, and a test surface at the interface.
Vocabulary
Use these terms exactly when discussing module design. Do not substitute
component, service, API, signature, or boundary.
- Module: anything with an interface and an implementation: a function, class, package, or tier-spanning slice. Avoid: unit, component, service.
- Interface: every fact a caller must know to use the module: type signature, invariants, ordering constraints, error modes, required configuration, and performance characteristics. Avoid: API, signature.
- Implementation: the code inside a module.
- Adapter: a concrete thing that satisfies an interface at a seam. A thing
can be a small adapter with a large implementation (a Postgres repository) or
a large adapter with a small implementation (an in-memory fake). Use
adapterwhen the seam is the topic; otherwise useimplementation. - Depth: leverage at the interface: the behaviour a caller or test can exercise per unit of interface they must learn. A module is deep when much behaviour sits behind a small interface and shallow when the interface is nearly as complex as the implementation.
- Seam: a place where behaviour changes without editing in that place; the location at which a module's interface lives. Avoid: boundary.
- Leverage: what callers get from depth.
- Locality: what maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place.
Rules
- Depth is a property of the interface, not the implementation. A deep module can contain small, mockable internal parts. Internal seams stay private.
- Deletion test: imagine deleting the module. When complexity vanishes, it was a pass-through. When complexity reappears across callers, it earned its keep.
- The interface is the test surface. Callers and tests cross the same seam. A test that must reach past the interface is a signal the module shape is wrong.
- One adapter is a hypothetical seam. Two adapters make a real one. Introduce no seam unless at least two adapters are justified.
- When designing an interface, reduce the method count, simplify the parameters, and hide more complexity inside.
Testability rules
- Accept dependencies; do not create them inside the module.
- Return results; do not produce hidden side effects.
- Keep the surface small: fewer methods and parameters need less setup.
Relationships
- A module has exactly one external interface.
- Depth is a property of a module, measured against its interface.
- A seam is where a module's interface lives.
- An adapter sits at a seam and satisfies the interface.
- Depth produces leverage for callers and locality for maintainers.
Rejected framings
- Depth as the ratio of implementation lines to interface lines: it rewards padding. Use depth-as-leverage.
- Interface as the TypeScript
interfacekeyword or a class's public methods: too narrow. - Boundary: overloaded with DDD's bounded context. Say seam or interface.
Disclosed reference
- Deepening a cluster given its dependencies: DEEPENING.md.
- Exploring alternative interfaces: DESIGN-IT-TWICE.md.
04 同仓库更多 Skills
writing-for-agents
Reference for writing documents an agent consumes: skills, AGENTS.md or CLAUDE.md, and docs reached by a pointer. Invoke when creating or editing a skill or an agent instruction file, or when a document's pointer wording, load, or structure is in question. Do not invoke merely because the user mentions writing-for-agents, names a skill, or writes 'skill <word>'.
wizard
Generate an interactive bash wizard for steps only a human can perform. Invoke when the user asks for a script or wizard for manual setup: infrastructure provisioning, credentials or CI secrets, a third-party dashboard, or a one-off migration or cutover. Do not invoke for steps the agent can perform, or merely because the user mentions wizard, names a skill, or writes 'skill <word>'.
wait-what
Stop and re-pitch the last message in plain, simplified language.
to-tickets
Split an agreed specification into reviewable vertical-slice issues with explicit blockers, then publish them after confirmation.
to-spec
Turn the current conversation into a specification and publish it after confirmation.
to-pr
Create a pull request from the current branch.