codebase-design
Skill1 starsChanged 2 months agoMITView on GitHub
Part of the Lenny suite (Lenny = the orchestration layer; the conductors are its skills); also triggers on "codebase design", "design this module", "deep modules", "is this module shallow", "where does the seam go". A compact synthesis of three canonical design disciplines - Ousterhout's deep modules (A Philosophy of Software Design), Feathers' seams (Working Effectively with Legacy Code), and Evans' ubiquitous language + ADRs (DDD). Runs as a Build-phase gate (after repo-map, before slicing) and as a typed council lens. Glossary/ADR files are opt-in; an in-context lens + gate by default.
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 repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bayesianSkill
- claudes-gambleSkill
- councilSkill
- elon-first-principlesSkill
- find-skillsSkill
- first-principlesSkill
- fleet-conductorSkill
- garciaSkill
- gbrain-captureSkill
- grill-meSkill
- karpathySkill
- kissingerSkill
- meta-conductorSkill
- outcome-lockSkill
- pre-kSkill
- release-managerSkill
- rumsfeldSkill
- setup-lennySkill
- ship-conductorSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 181 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
One adapter = hypothetical seam; two = real: Don't introduce a seam until something actually varies across it.
- Distinctive: line 58
Cross-check names against code: If the glossary says cancellation means X but the code does Y, surface the contradiction.
- Distinctive: line 80
If ADRs already exist, don't re-litigate them - flag a *real* conflict when the friction warrants reopening the decision.
“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
The module-shape lens Lenny was missing. karpathy gives simplicity,
first-principles gives grounding, repo-map tells you what exists - this
tells you what the shape should be. It compacts three canonical disciplines
into one vocabulary + gate:
- Ousterhout - deep modules: a lot of behaviour behind a small interface.
- Feathers - seams: places you can alter behaviour without editing there.
- Evans - ubiquitous language: name things after the domain, and record hard-to-reverse decisions as ADRs.
Aim: leverage for callers, locality for maintainers, testability for
everyone. (Distilled from mattpocock/skills' codebase-design + domain-modeling
- improve-codebase-architecture - rebuilt as Lenny doctrine, not ported.)
The vocabulary (use these words exactly - don't drift to "component/service/API/boundary")
- Module - anything with an interface + an implementation (scale-agnostic: function, class, package, tier-spanning slice).
- Interface - everything a caller must know: type signature plus invariants, ordering, error modes, required config, performance. Not just the type-level surface.
- Depth - leverage at the interface: behaviour a caller/test exercises per unit of interface they must learn. Deep = lots of behaviour behind a small interface; shallow = interface nearly as complex as the implementation.
- Seam (Feathers) - the location where a module's interface lives; where you can swap behaviour without editing in place. Say "seam", not "boundary" (overloaded with DDD bounded context).
- Adapter - a concrete thing satisfying an interface at a seam (a role, not a substance).
- Leverage (what callers get) / Locality (what maintainers get: change, bugs, and verification concentrate in one place).
The tests (the actual thinking tools - apply these at the gate)
- Deletion test. Imagine deleting the module. Complexity vanishes → it was a pass-through (shallow, delete it). Complexity reappears across N callers → it earned its keep (deep).
- The interface is the test surface. Callers and tests cross the same seam. If you need to test past the interface, the module is the wrong shape.
- One adapter = hypothetical seam; two = real. Don't introduce a seam until something actually varies across it.
- Shallow-module smell. Interface almost as complex as the implementation, or a pure function extracted only for testability while the real bug hides in how it's called (no locality).
- Testable by construction. Accept dependencies (don't
newthem); return results (don't mutate in place); keep the surface small.
Ubiquitous language (Evans - the naming half)
- Name modules and seams after domain concepts, not
FooBarHandleror a generic "service". If the domain has an "Order", it's "the Order intake module". - Challenge fuzzy terms inline. "You say 'account' - Customer or User? Those are different things." Sharpen the moment it comes up.
- Cross-check names against code. If the glossary says cancellation means X but the code does Y, surface the contradiction.
When it runs (inside a conductor)
- Build-phase gate - after
repo-map, before slicing. Pressure-test the planned module shape before code is written: anything shallow? is the seam real (2+ adapters) or speculative? is the interface the true test surface? are the names honest? Feed findings into the plan/slices. Log the verdict toCONDUCTOR-RUN.md. - Council lens (typed-councils-as-config). Available as a "deep-module" lens
the Phase-3 councils can convene: scores the diff on depth / seam placement /
locality using the vocabulary, emitting
severity + confidence + file:linelike any council seat. (A lens the council reads, not auto-wired machinery.) - On demand. Designing or refactoring a specific module outside a conductor run.
Opt-in artifacts (default OFF)
- Evans' machinery - a
CONTEXT.mdglossary anddocs/adr/ADRs - is opt-in. Maintain them only when the user asks OR the repo already has them. Default: the vocabulary + gate live in-context (notes inCONDUCTOR-RUN.md), creating no new repo files. Do not scaffoldCONTEXT.md/ADR files into a repo unasked (simplicity-first). - If ADRs already exist, don't re-litigate them - flag a real conflict when the friction warrants reopening the decision; don't enumerate every refactor an ADR forbids.
Hard rails
- Config the agent READS, never a runtime. A lens + checklist, not an engine.
karpathystill wins. "Deep" ≠ "clever" or "over-abstracted." A deep module is simple to use; prefer the simplest implementation that keeps the interface small. One adapter is never a reason to pre-build a seam.- Proportional to shape. A gate for shape-bearing work - builds that add or restructure a module/seam. Skip it for a localized fix that introduces no new module (don't audit a one-line change for depth); applicability is the conductor's call at slice time.
- Surgical-change discipline holds. It recommends shape; it does not license refactoring adjacent code beyond the request's scope.
What it is / isn't
IS: the compacted deep-module / seam / ubiquitous-language lens + a Build gate +
a council seat. ISN'T: a mandate to write CONTEXT.md/ADRs everywhere (opt-in), a
license to refactor beyond scope, or a runtime. Complements repo-map (what
exists) with what should exist, and karpathy (simplicity) with the depth frame.
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.

