codebase-design
stevesolun/ctx/.agents/skills/codebase-design/SKILL.md
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.
Skill583 starsChanged 56 days ago
What's in it
- Codebase Design
- Working vocabulary
- Design workflow
- Heuristics, not laws
--- 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. --- # 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 1. Map representative callers, responsibilities, dependencies, and existing contracts. 2. Look for coordination or policy that can move behind a smaller interface. 3. Place seams where variation, ownership, or test isolation justifies them. 4. Compare alternatives when the choice is consequential. 5. 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](DEEPENING.md) when consolidating a cluster across dependency boundaries. Read [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md) when materially different interface designs can be explored independently.
More agent context in stevesolun/ctx
26 other files this repository gives its agents.
AGENTS.md
CLAUDE.md
Skill
- ask-matt.agents/skills/ask-matt/SKILL.md
- code-review.agents/skills/code-review/SKILL.md
- diagnosing-bugs.agents/skills/diagnosing-bugs/SKILL.md
- domain-modeling.agents/skills/domain-modeling/SKILL.md
- grilling.agents/skills/grilling/SKILL.md
- grill-me.agents/skills/grill-me/SKILL.md
- grill-with-docs.agents/skills/grill-with-docs/SKILL.md
- handoff.agents/skills/handoff/SKILL.md
- implement.agents/skills/implement/SKILL.md
- improve-codebase-architecture.agents/skills/improve-codebase-architecture/SKILL.md
- prototype.agents/skills/prototype/SKILL.md
- research.agents/skills/research/SKILL.md
- resolving-merge-conflicts.agents/skills/resolving-merge-conflicts/SKILL.md
- setup-matt-pocock-skills.agents/skills/setup-matt-pocock-skills/SKILL.md
- tdd.agents/skills/tdd/SKILL.md
- teach.agents/skills/teach/SKILL.md
- to-spec.agents/skills/to-spec/SKILL.md
- to-tickets.agents/skills/to-tickets/SKILL.md
- triage.agents/skills/triage/SKILL.md
- wayfinder.agents/skills/wayfinder/SKILL.md
- writing-great-skills.agents/skills/writing-great-skills/SKILL.md
- ctx-dispatch.claude/skills/ctx-dispatch/SKILL.md
- ctx-verify.claude/skills/ctx-verify/SKILL.md
- skill-routerdocs/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

