codebase-design
Skill23 starsChanged 55 days agoApache-2.0View on GitHub
Use when designing or improving a module's interface (deep modules, small interfaces, clean seams) or finding and assessing shallow modules worth deleting, inlining or deepening. Moves -> refactoring-catalog.
139 other projects use a version of this, 120 of them edited.
Adopted by
Most recently taken up by
- mattpocock/skillsedited, first seen Oct 8, 2026
- hmjBill/skillstheir own version, first seen Oct 5, 2026
- AlexisBalayre/claude-code-configedited, first seen Oct 5, 2026
- KroxiDev/engineering-skillstheir own version, first seen Oct 5, 2026
- gordon1210/reposcoutedited, first seen Oct 4, 2026
- michielvandermeer/skillsedited, first seen Oct 4, 2026
Used with
Projects with it also use writing-beats, writing-shape and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
RoentekSkillwriting-beats
Writing, exploit — assemble raw material into a journey of beats, grounding each term before a beat leans on it.
Also in 23 projects that use this
RoentekSkillwriting-shape
Writing, exploit — shape raw material into an article, paragraph by paragraph.
Also in 23 projects that use this
loulanyueSkillsetup-ts-deep-modules
Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.
Also in 16 projects that use this
risadamsSkillwhich-skill
Router over this pack's skills and flows. Ask it "which skill fits X" when you don't remember what's available.
Also in 5 projects that use this
pahwarangerSkillsetup-skills
Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's ticket tracker (GitHub or local markdown), triage label vocabulary, and domain doc layout. Run before first use of `to-tickets`, `to-prd`, `triage`, `diagnose`, `tdd`, `improve-codebase-architecture`, or `zoom-out` — or if those skills appear to be missing context about the ticket tracker, triage labels, or domain docs.
Also in 7 projects that use this
qhuang20Skillmigrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
Also in 24 projects that use this
- +2 more from Roentek
Other versions139 projects use a version of this.
Word for word · 0
None found.
Edited · 120
- mattpocock/skills★ 335k43% same
- LibreChat-AI/LibreChat★ 45k43% same
- nodetool-ai/nodetool★ 55145% same
- mxyhi/ok-skills★ 49243% same
- aws/graph-explorer★ 48443% same
- Tiberriver256/mcp-server-azure-devops★ 39343% same
- bighadj22/codflow★ 33843% same
- ninehills/skills★ 28043% same
- loulanyue/skills★ 23143% same
- ayoubben18/ab-method★ 19234% same
110 more not listed
Wrote their own version · 19
- vinvcn/mattpocock-skills-zh-CN★ 4.6ksame name
- stevesolun/ctx★ 588same name
- devcxl/mattpocock-skills-zh★ 426same name
- JasonxzWen/harness-hub★ 71same name
- leandrocfe/skills★ 38same name
- sgaabdu4/building-flutter-apps★ 23same name
- aethrox/doctrine★ 18same name
- KroxiDev/engineering-skills★ 4same name
- hahuyhungdev/ai-coding-config★ 3same name
- int2t05/engineering-skills★ 3same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- claude-code-orchestratorSkill
- code-reviewSkill
- codex-subagent-routingSkill
- diagnosing-bugsSkill
- docker-composeSkill
- exhaustive-repo-cleanup-auditSkill
- gemini-cli-orchestratorSkill
- grok-build-orchestratorSkill
- kill-slopSkill
- kimi-cli-orchestratorSkill
- layered-testing-executorSkill
- legacy-code-changeSkill
- pragmatic-engineeringSkill
- refactoring-catalogSkill
- security-reviewSkill
- tddSkill
- test-auditSkill
- testing-e2e-playwrightSkill
- windows-shell-interopSkill
- worktree-lifecycleSkill
- xp-agile-deliverySkill
The file
We split this skill into the rules it gives an agent
6 rules. 1 is common, 2 are distinctive, and 3 are very specific to this project.
1
Common
Most of the 128 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
Use these terms for the concepts below.
- Common: line 71
When designing an interface, ask:
- Distinctive: line 128
When applying this skill to a module or cluster:
- Very specific: line 132
Classify dependencies: Use the 4 categories in references/deepening.md (in-process / local-substitutable / remote-but-owned / …
- Very specific: line 158
Read references/deepening.md to deepen a cluster of shallow modules: 4 dependency categories, seam discipline, replace-don't-layer testing …
- Very specific: line 159
Read references/design-it-twice.md only for the rare high-stakes, hard-to-reverse seam that stays uncertain after step 4, never as the …
“Common” is measured: kept by at least 6 in 10 of the 128 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codebase Design — Deep Modules
Design deep modules: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this vocabulary and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
Glossary
Use these terms for the concepts below; they disambiguate "component," "service," "API," or "boundary" when those words are being used loosely for different things in the same discussion.
| Term | Definition | Avoid |
| Module | Anything with an interface and an implementation. Scale-agnostic: a function, class, package, or tier-spanning slice. | unit, component, service |
| Interface | Everything a caller must know to use the module correctly: type signature, invariants, ordering constraints, error modes, required configuration, performance characteristics. | API, signature (too narrow) |
| Implementation | What is inside a module. Distinct from Adapter: a Postgres repo is a small adapter with large implementation; an in-memory fake is a large adapter with small implementation. | — |
| Depth | Leverage at the interface: the amount of behaviour a caller or test can exercise per unit of interface they must learn. A module is deep when large behaviour sits behind a small interface; shallow when the interface is nearly as complex as the implementation. | impl-lines / interface-lines ratio |
| Seam | A place where behaviour can be altered without editing at that place (Feathers). The location at which a module's interface lives. Where to put the seam is its own design decision. | boundary (overloaded with DDD bounded context) |
| Adapter | A concrete thing that satisfies an interface at a seam. Describes role, not substance. | — |
| Leverage | What callers get from depth: more capability per unit of interface learned. One implementation pays back across N call sites and M tests. | — |
| Locality | What maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place. Fix once, fixed everywhere. | — |
Deep vs Shallow
Deep module Shallow module (avoid)
┌──────────────────┐ ┌──────────────────────────────┐
│ Small Interface │ │ Large Interface │
├──────────────────┤ ├──────────────────────────────┤
│ │ │ Thin Implementation │
│ Deep Impl. │ │ (mostly pass-through) │
│ │ └──────────────────────────────┘
└──────────────────┘When designing an interface, ask:
- Can I reduce the number of methods?
- Can I simplify the parameters?
- Can I hide more complexity inside?
Core Principles
Depth is a property of the interface, not the implementation. A deep module can be internally composed of many small, swappable parts — they just are not part of the external interface. A module can have internal seams (private to its implementation) as well as the external seam at its interface.
The deletion test. Imagine deleting the module. If complexity vanishes, it was a pass-through and is earning nothing. If complexity reappears across N callers, it was earning its keep.
The interface is the test surface. Callers and tests cross the same seam. If you want to test past the interface, the module is probably the wrong shape.
Two adapters are evidence of a real seam, not a requirement for one. A second adapter (typically production + test stand-in) proves something varies across the boundary, which is why it is the easiest justification to check. But it is one sufficient reason, not the only one. A seam is also justified by:
- independent volatility — the two sides change for different reasons, on different cadences;
- an external contract — the boundary is where a protocol, schema, or published API is honoured;
- a security boundary — trust, authorization, or tenancy changes across it, and collapsing it would erase the place the check belongs.
What is not a justification is a seam added because a second implementation might appear someday. Absent one of the reasons above, the seam is speculative — the cost is real now and the variation is hypothetical.
Relationships
- A Module has exactly one Interface — the surface it presents to callers and tests.
- 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.
Designing for Testability
Good interfaces make testing natural without special arrangements:
- Accept dependencies, do not create them.
// Testable — inject the gateway function processOrder(order, paymentGateway) {} // Hard to test — hardwired dependency function processOrder(order) { const gateway = new StripeGateway(); } - Return results, do not produce side effects invisibly.
// Testable — observable return value function calculateDiscount(cart): Discount {} // Hard to test — side effect on shared state function applyDiscount(cart): void { cart.total -= discount; } - Small surface area. Fewer methods = fewer tests needed. Fewer parameters = simpler test setup.
Design Workflow
When applying this skill to a module or cluster:
- Name it. Agree on module, interface, seam, and adapter — use the glossary terms above, not local synonyms.
- Measure depth. Apply the deletion test: if complexity vanishes on deletion, the module is shallow. Count how much a caller must know vs how much behaviour they get.
- Classify dependencies. Use the 4 categories in
references/deepening.md(in-process / local-substitutable / remote-but-owned / true-external) to decide the testing approach. - Find the seam. Decide where the interface lives — this is independent of what goes behind it. Justify it with evidence: a second adapter, independent volatility, an external contract, or a security boundary. A seam with none of those is speculative.
- Explore alternatives — the exception, not the default. Design it once and move on; reach for
references/design-it-twice.md's parallel sub-agent pattern only for a genuinely high-stakes, hard-to-reverse seam where the right interface is still uncertain after step 4. When it applies: compare candidates on depth/locality/seam, pick the strongest or propose a hybrid, using the specialist subagent the runtime lists by task type (generic/default only when none fits). - Validate. Apply the interface-as-test-surface check: tests cross the same seam as callers. If tests need to reach past the interface, the module shape is wrong.
Checking for Shallow Modules
When asked to find or assess shallow modules, examine concrete candidates and apply the deletion test to each. A single caller, a single adapter or a thin wrapper is a lead, never proof: name what the boundary protects (volatility, contract, security, testability) and where its complexity would land without it. A caller count from rg misses dynamic dispatch, registrations, configuration and external consumers. For each candidate say delete, inline, deepen or keep, with that reason; change code only when asked, and delete through kill-slop's proof rules. A repo-wide ranked report of deepening opportunities is a larger exercise than this check: run it as its own piece of work, interviewing the owner on each candidate before changing anything.
Design Checklist
- Every module has an agreed name using vocabulary from the glossary.
- Depth is measured as leverage (behaviour per interface unit), not code-line ratio.
- The deletion test has been applied: deletion reveals complexity redistribution, not nothing.
- Each seam is justified by evidence from step 4 (a second adapter, independent volatility, an external contract or a security boundary) -- not added on the chance a second implementation might appear.
- Dependencies are classified by category; testing strategy matches the category.
- Tests assert on observable outcomes through the interface, not on internal state.
Rejected Framings
- Depth as implementation-lines / interface-lines ratio (Ousterhout original): rewards padding the implementation with dead code. Use depth-as-leverage instead.
- "Interface" = TypeScript
interfacekeyword or public methods: too narrow. Interface here includes every fact a caller must know, including invariants and error modes. - "Boundary": overloaded with DDD's bounded context. Say seam or interface.
Reference Files
- Read
references/deepening.mdto deepen a cluster of shallow modules: 4 dependency categories, seam discipline, replace-don't-layer testing strategy. - Read
references/design-it-twice.mdonly for the rare high-stakes, hard-to-reverse seam that stays uncertain after step 4, never as the default design path: parallel sub-agent pattern sized to the genuinely distinct candidates worth comparing, compare on depth/locality/seam, give an opinionated recommendation.
Attribution
Adapted from mattpocock/skills (MIT). Original skill: codebase-design.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

