codebase-design
Skill3 starsChanged 2 months agoMITView on GitHub
Design or improve deep modules. Use when shaping a module interface, deepening modules, placing a seam, reducing coupling, designing for testability, or when another skill requires the deep-module vocabulary.
194 other projects use a version of this.
Adopted by
Most recently taken up by
- chrysogonus/power-agentstheir own version, first seen Nov 8, 2026
- wowyuarm/dsh-agent-teamtheir own version, first seen Nov 8, 2026
- Contexera/dsh-agent-teamtheir own version, first seen Nov 8, 2026
- sgaabdu4/appwrite-backendtheir own version, first seen Nov 8, 2026
- The-Vibe-Company/quivrtheir own version, first seen Nov 8, 2026
- dhruvsaxena1998/skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use setup-ts-deep-modules, decision-mapping 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.
liufeng1976Skillsetup-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 43 projects that use this
FabienDehopreSkilldecision-mapping
Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.
Also in 8 projects that use this
RoentekSkillloop-me
Grill me about specs for the workflows I want to build, within this workspace.
Also in 55 projects that use this
LesaniSkillwriting-beats
Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.
Also in 58 projects that use this
AWSSkillto-questionnaire
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
Also in 90 projects that use this
LesaniSkillwriting-shape
Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.
Also in 58 projects that use this
- +1 more from Lesani
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- mattpocock/skills★ 309ksame name
- danny-avila/LibreChat★ 47ksame name
- LibreChat-AI/LibreChat★ 47ksame name
- QuivrHQ/quivr★ 40ksame name
- The-Vibe-Company/quivr★ 40ksame name
- windmill-labs/windmill★ 18ksame name
- MODSetter/SurfSense★ 17ksame name
- GreyDGL/PentestGPT★ 16ksame name
- formbricks/formbricks★ 13ksame name
- humanlayer/humanlayer★ 13ksame name
184 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 repository31 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- code-reviewSkill
- diagnosing-bugsSkill
- dispatch-ticketsSkill
- grill-with-docsSkill
- implementSkill
- improve-codebase-architectureSkill
- orchestrateSkill
- prototypeSkill
- researchSkill
- resolving-merge-conflictsSkill
- setup-omskillsSkill
- tddSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- wayfinderSkill
- cavemanSkill
- designSkill
- excalidrawSkill
- grill-meSkill
- handoffSkill
- model-routingSkill
- prompt-comprehension-auditsSkill
- teachSkill
- tmux-workerSkill
- voiceSkill
- wormholeSkill
- write-a-skillSkill
- writing-great-skillsSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 181 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Use these architecture terms as defined here.
- Distinctive: line 56
When comparing interface designs, check:
“Common” is measured: kept by at least 6 in 10 of the 181 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
Design deep modules: modules whose callers can exercise multiple required behaviors through a smaller interface at a defined seam. Apply the terms and rules below when designing or restructuring code. The target outcomes are leverage across callers, locality of changes and defects, and tests that use the same interface as production callers.
Glossary
Use these architecture terms as defined here. Do not substitute component, service, API, or boundary, because those words identify different or narrower concepts.
Module — any unit with exactly one interface and an implementation, including a function, class, package, or tier-spanning slice. This term does not imply scale. Avoid unit, component, and service for this concept.
Interface — every fact a caller must know to use a module correctly: type signatures, invariants, ordering constraints, error modes, required configuration, and performance characteristics. API and signature name only part of this surface.
Implementation — code inside a module. Use adapter instead when discussing the role a concrete implementation fills at a seam. Implementation size and adapter size are independent; for example, a Postgres repository can be a small adapter with a large implementation, while an in-memory fake can be a large adapter with a small implementation.
Depth — behavior a caller or test can exercise relative to the interface facts it must learn. A module is deeper than an alternative when it preserves required behavior while exposing fewer methods, parameters, invariants, ordering constraints, error modes, configuration requirements, or performance obligations. It is shallow when callers must supply or coordinate the implementation's intermediate states and steps.
Seam (Michael Feathers) — a location where behavior can be altered without editing code at that location. Seam placement and the behavior behind the seam are separate decisions. A seam may be internal to a module. Avoid boundary, which also refers to a DDD bounded context.
Test seam — a seam exposed through the caller-visible interface that production callers and behavior tests share. Tests may use a different adapter at that seam, but do not bypass the interface to reach an internal seam.
Adapter — a concrete module that satisfies an interface at a seam. The term identifies the role, not the implementation technology.
Leverage — reuse of behavior behind one interface across multiple callers or tests. A change behind the interface applies without reproducing the rule at each caller.
Locality — concentration of a behavior's code, required knowledge, defects, changes, and verification in one module rather than its callers.
Deep and shallow modules
A deep module exposes a smaller interface than the behavior it contains:
┌─────────────────────┐
│ Small Interface │ ← fewer caller-visible facts
├─────────────────────┤
│ │
│ Deep Implementation│ ← behavior hidden from callers
│ │
└─────────────────────┘A shallow module exposes an interface that repeats most implementation decisions:
┌─────────────────────────────────┐
│ Large Interface │ ← many caller-visible facts
├─────────────────────────────────┤
│ Thin Implementation │ ← forwards or rearranges inputs
└─────────────────────────────────┘When comparing interface designs, check:
- whether multiple methods can become one operation without losing required behavior;
- whether the module can derive or own any current parameters;
- whether invariants, ordering, configuration, errors, or performance obligations can move behind the interface; and
- whether the reduced surface still supports every required caller and test behavior.
Principles
- Depth is a property of a module relative to its interface. Internal composition does not make an external interface shallow. A module may use internal seams available only to its implementation and implementation-level tests while exposing one external seam to callers.
- Deletion test. Model deleting the module while preserving required behavior. If no caller must absorb rules or knowledge, the module was a pass-through. If rules or knowledge must be copied or coordinated across callers, the module provides locality or leverage. This is design evidence, not an automatic deletion rule: preserve required behavior and safety constraints, and judge total complexity and caller usability.
- The interface is the test surface. Production callers and behavior tests use the same test seam. A test that must bypass the interface is evidence that the interface does not expose required behavior or that the tested behavior belongs to another module.
- Two justified adapters warrant a port. Introduce a port only when at least two adapters are justified (typically production + test).
Designing for testability
Accept dependencies instead of constructing them inside the behavior
// Dependency can vary at the seam.
function processOrder(order, paymentGateway) {}
// Dependency selection is coupled to this implementation.
function processOrder(order) {
const gateway = new StripeGateway();
}Return results instead of producing side effects
// The result is observable without inspecting mutation.
function calculateDiscount(cart): Discount {}
// Verification requires observing mutation and hidden discount state.
function applyDiscount(cart): void {
cart.total -= discount;
}Minimize the caller-visible surface
A smaller caller-visible surface generally requires fewer tests and simpler setup.
Rejected framings
- Implementation-lines divided by interface-lines: this metric can increase by adding implementation code without adding behavior. Evaluate depth by caller-visible facts and exercised behavior instead.
Progressive references
- For deepening a cluster with known dependencies, read DEEPENING.md for dependency categories, seam discipline, and replace-don't-layer testing.
- For comparing alternative interfaces, read DESIGN-IT-TWICE.md for the optional one-designer comparison process. Use it only when the invoking workflow authorizes that designer role and the current caller can dispatch a non-delegating leaf within its inherited depth. A non-delegating leaf resolves accepted sources directly or returns a blocker to its caller.
- To scan an entire repository for candidates, use improve-codebase-architecture. First run
cd '<loaded-skill-directory>' && pwd -Pwith this loaded file's directory and resolve the link from that physical base. Read the target even when absent from discovery.
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.

