codebase-design
Design or improve module interfaces using deep-module heuristics. Use when deciding where a seam belongs, reducing caller-facing complexity, improving testability or navigability, or comparing module designs.
- License 许可
- MIT
- 所属仓库
- stevesolun/ctx
- 最近更新
- 2026-10-15
- Stars
- ★ 590
- Forks
- 69
01 前言 Front Matter
- name
- codebase-design
- description
- Design or improve module interfaces using deep-module heuristics. Use when deciding where a seam belongs, reducing caller-facing complexity, improving testability or navigability, or comparing module designs.
02 资源文件 3
- 参考文档agents/openai.yaml102 B
- 参考文档DEEPENING.md2.2 KB
- 参考文档DESIGN-IT-TWICE.md2.2 KB
03 SKILL.md 正文
Codebase Design
Seek deep modules: substantial useful behavior behind a small, stable interface. Use the concepts below as design lenses, while matching the repository's established domain language.
Working vocabulary
- Module: a coherent unit with an interface and implementation, at any scale.
- Interface: everything callers must know, including invariants and failure modes—not just a type signature.
- Seam: a location where behavior can vary without editing its callers.
- Adapter: an implementation that connects at a seam.
- Depth: useful capability relative to interface complexity.
- Leverage: capability gained by callers; locality: change and knowledge concentrated for maintainers.
Translate these terms to the project's vocabulary when that makes the design clearer. Consistency with the codebase is more valuable than enforcing a private lexicon.
Design workflow
- Map representative callers, responsibilities, dependencies, and existing contracts.
- Look for coordination or policy that can move behind a smaller interface.
- Place seams where variation, ownership, or test isolation justifies them.
- Compare alternatives when the choice is consequential.
- Validate the candidate with representative caller code and tests.
Heuristics, not laws
- Reduce methods, parameters, ordering constraints, and configuration callers must understand.
- Use the deletion test: if removing a module merely spreads its complexity across callers, it was likely earning its keep.
- Treat pass-through layers skeptically, but keep them when they provide a real compatibility, ownership, policy, or navigation boundary.
- Introduce dependency seams when actual variation or test isolation repays the indirection; avoid interfaces justified only by hypothetical futures.
- Prefer tests through observable interfaces, while allowing focused internal tests when they provide cheaper or more precise feedback.
- Favor explicit dependencies and returned results when they improve control and testability; side effects and internally created dependencies can still be appropriate at well-defined boundaries.
Read DEEPENING.md when consolidating a cluster across dependency boundaries. Read DESIGN-IT-TWICE.md when materially different interface designs can be explored independently.
04 同仓库更多 Skills
toolbox
Pre/post dev toolbox — named bundles of skills/agents loaded before development work and councils of experts invoked after. Run /toolbox or the toolbox.py CLI to list, activate, initialize, export, import, and validate toolboxes. Invoke at the start or end of a dev session, when setting up a new repo, or when sharing toolboxes with a team.
skill-router
Alive skill router — reads the current project's stack and loads/unloads skills dynamically. Invoke at session start or when project context changes.
repo-stats-autoupdate
Keeps README badge + inline counts in sync with the real number of skills, agents, graph nodes/edges, communities, converted pipelines, and test inventory. Runs automatically on every commit via a git pre-commit hook. Use when the README drifts from reality or before publishing a release.
find-skills
Discover installable agent skills from ctx's shipped Skills.sh catalog, the Skills.sh search API, and the npx skills CLI. Use when a user asks whether a skill exists, wants to add/update a skill, or needs a repeatable procedure for finding candidate skills safely.
no-mistakes
Validate committed feature-branch changes through the no-mistakes pipeline: intent, rebase, review, test, docs, lint, push, PR, and CI. Use when the user asks to run no-mistakes, ship safely, validate before pushing, or gate a change before it reaches upstream.
zoom-out
Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.