codebase-design
This skill should be used when designing a module interface, reducing coupling, choosing dependency seams, improving testability, or comparing architecture alternatives.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 349
- Forks
- 274
01 前言 Front Matter
- name
- codebase-design
- description
- This skill should be used when designing a module interface, reducing coupling, choosing dependency seams, improving testability, or comparing architecture alternatives.
02 资源文件 5
- 参考文档index.json602 B
- 许可证LICENSE1.0 KB
- 参考文档references/alternatives.md1.0 KB
- 参考文档references/deepening.md1.4 KB
- 参考文档SOURCE.md883 B
03 SKILL.md 正文
Codebase design
Design substantial behavior behind a small, understandable interface. Follow the project's instructions, glossary, and existing primitives. Preserve the assignment's scope and authority: a design assignment produces a proposal; implementation requires an implementation assignment.
Trace the actual design
Read the relevant callers, implementation, tests, and architectural decisions. Identify what each caller must know: types, invariants, ordering, errors, required configuration, resource ownership, and performance guarantees. Treat all of these as part of the interface. A simple signature that hides undocumented ordering requirements still has a complex interface.
Describe a concrete caller journey and where knowledge is repeated. Finish this step with source locations and an inventory of the facts callers currently carry.
Find useful depth
Evaluate capability per fact a caller must learn, rather than implementation line counts. Concentrate decisions and failure handling where a fix can apply to all callers. Use the deletion thought experiment: if removing an abstraction spreads complexity across callers, it earns its place; if the complexity disappears, investigate whether it is only forwarding. Retain forwarding required for compatibility, policy, or ownership when those purposes are real.
Distinguish the public interface from internal composition. Keep internal helpers private when callers have no reason to know them. Use the project's terms; introduce new vocabulary only when it makes a concrete distinction clearer.
Place dependencies deliberately
A seam is a place to change behavior without changing its caller; an adapter supplies behavior there. Justify a seam with actual variation, such as production I/O and a realistic test adapter. Keep pure calculations separate from effects where useful. Accept dependencies at an ownership boundary instead of constructing hidden global resources, without adding interfaces to every function mechanically.
For consolidation or dependencies across storage and network layers, read references/deepening.md. For a consequential design choice with credible alternatives, read references/alternatives.md.
Return a bounded design
Provide the proposed interface, one representative caller, hidden behavior, dependency owners, failure paths, compatibility impact, and migration order. Explain which existing primitives are reused. Account for cancellation, cleanup, concurrency, and rollback where relevant.
Describe verification through the interface that callers actually use. Preserve distinct behavioral coverage during a refactor; identify any adapter or integration behavior a fake cannot prove. Run or write tests only within the user's authorization. Distinguish code-based reasoning from executed evidence, and state what remains uncertain.
Complete when the recommendation explains how callers become simpler, where maintenance concentrates, and how the proposed contract can be checked. Use the team technical-plan asset when assigned as principal. Keep the proposal proportional to the change.
Adapted from Matt Pocock's engineering skills; see SOURCE.md and LICENSE.
04 同仓库更多 Skills
writing-for-agents
This skill should be used when creating or editing skills, agent definitions, AGENTS.md, CLAUDE.md, or reference documents intended for agents.
research
This skill should be used when researching a technical question, checking current API facts, comparing documented capabilities, or gathering primary-source evidence for a decision.
handoff
Summarize the current work so another session can continue it.
diagnosing-bugs
This skill should be used when diagnosing a reported bug, intermittent failure, stuck operation, or performance regression and isolating its cause with reproducible evidence.
codebase-design
This skill should be used when designing a module interface, reducing coupling, choosing dependency seams, improving testability, or comparing architecture alternatives.
code-review
This skill should be used when reviewing a branch, pull request, working tree, or changes since a commit for repository standards and the user's requested behavior.