codebase-design
Skill3 starsChanged 2 months agoMITView on GitHub
Shared vocabulary for designing deep modules in a PHP/Laravel codebase. Use when the user wants to design or improve a class or module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill (to-spec, implement, architecture-satisfaction) needs the deep-module vocabulary.
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
- rafaelob/pragmatic-agent-skillsedited, first seen Oct 5, 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
Used with
Projects with it also use writing-beats, writing-shape and 9 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
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
qwlabsSkillclaude-handoff
Hand the current conversation off to a fresh background agent that picks up the work immediately.
Also in 17 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★ 335k88% same
- LibreChat-AI/LibreChat★ 45k88% same
- nodetool-ai/nodetool★ 55187% same
- mxyhi/ok-skills★ 49288% same
- aws/graph-explorer★ 48488% same
- Tiberriver256/mcp-server-azure-devops★ 39388% same
- bighadj22/codflow★ 33888% same
- ninehills/skills★ 28088% same
- loulanyue/skills★ 23188% same
- ayoubben18/ab-method★ 19266% 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 repository48 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- architecture-satisfactionSkill
- autopilotSkill
- browser-testSkill
- chatter-scoutSkill
- code-reviewSkill
- code-smells-auditSkill
- commitSkill
- dependency-auditSkill
- diagnosing-bugsSkill
- distill-sessionsSkill
- domain-modelingSkill
- fix-ci-failuresSkill
- fix-github-issuesSkill
- fix-nightwatch-issuesSkill
- fix-posthog-issuesSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- housekeeperSkill
- implementSkill
- improve-codebase-architectureSkill
- laravel-herd-worktreesSkill
- panelSkill
- prototypeSkill
- releaseSkill
- repository-cleanupSkill
- researchSkill
- resolve-review-commentsSkill
- resolving-merge-conflictsSkill
- scratch-cleanupSkill
- scratch-statusSkill
- setupSkill
- tddSkill
- teachSkill
- to-questionnaireSkill
- to-specSkill
- to-ticketsSkill
- triage-github-prSkill
- triageSkill
- verifySkill
- wait-whatSkill
- wayfinderSkill
- which-skillSkill
- wizardSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
3 rules. 2 are common, 1 is distinctive, and 0 are very specific to this project.
2
Common
Most of the 128 edited versions we read keep these.
1
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
- Common: line 12
Use these terms exactly: don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
- Common: line 54
When designing an interface, ask:
- Distinctive: line 73
Eloquent models are a wide, shared interface: every attribute, scope, and relationship is surface area available to every caller.
“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
Design deep modules: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language 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 exactly: don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
Module: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, Laravel action, package, or tier-spanning slice. Avoid: unit, component, service.
Interface: everything a caller must know to use the module correctly: the method signatures, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. Avoid: API, signature (too narrow, they refer only to the type-level surface).
Implementation: what's inside a module, its body of code. Distinct from Adapter: a thing can be a small adapter with a large implementation (an Eloquent-backed repository) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
Depth: leverage at the interface: the amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is deep when a large amount of behaviour sits behind a small interface, shallow when the interface is nearly as complex as the implementation.
Seam (Michael Feathers); a place where you can alter behaviour without editing in that place; the location at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. Avoid: boundary (overloaded with DDD's bounded context).
Adapter: a concrete thing that satisfies an interface at a seam. Describes role (what slot it fills), not substance (what's inside).
Leverage: what callers get from depth: more capability per unit of interface they learn. 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 rather than spreading across callers. Fix once, fixed everywhere.
Deep vs shallow
Deep module = small interface + lots of implementation:
┌─────────────────────┐
│ Small Interface │ ← Few methods, simple params
├─────────────────────┤
│ │
│ Deep Implementation│ ← Complex logic hidden
│ │
└─────────────────────┘Shallow module = large interface + little implementation (avoid):
┌─────────────────────────────────┐
│ Large Interface │ ← Many methods, complex params
├─────────────────────────────────┤
│ Thin Implementation │ ← Just passes through
└─────────────────────────────────┘When designing an interface, ask:
- Can I reduce the number of methods?
- Can I simplify the parameters?
- Can I hide more complexity inside?
Principles
- Depth is a property of the interface, not the implementation. A deep module can be internally composed of small, swappable parts; they just aren't part of the interface. A module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface.
- The deletion test. Imagine deleting the module. If complexity vanishes, it was a pass-through. 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.
- One adapter means a hypothetical seam. Two adapters means a real one. Don't introduce a seam unless something actually varies across it.
Laravel mapping
Where these concepts land in a Laravel codebase:
- The container is the seam mechanism: a PHP interface plus a service-provider binding. Apply the two-adapter rule before reaching for it: an interface with exactly one implementation, bound "for mocking", is a hypothetical seam. Laravel's fakes usually make it unnecessary (next point).
- Framework fakes are adapters at framework-owned seams.
Storage::fake(),Queue::fake(),Mail::fake(),Http::fake()are the second adapter for filesystem, queue, mail, and HTTP seams: provided free. Prefer them over hand-rolled ports for I/O the framework already owns. - Eloquent models are a wide, shared interface: every attribute, scope, and relationship is surface area available to every caller. Depth in a Laravel app usually lives above them: an action or service class whose small interface (
ReconcileInvoice::run($invoice)) hides the queries, state transitions, and side effects. - Controllers, commands, jobs, and Livewire/Filament components are entry-point adapters: thin things that satisfy a transport's interface and delegate to a deep module. If real logic accumulates in one, that's a deepening candidate (the same logic will soon be needed from a second entry point).
Designing for testability
Good interfaces make testing natural:
Accept dependencies, don't create them.
// Testable: gateway injected via constructor (container resolves it) public function __construct(private PaymentGateway $gateway) {} // Hard to test: hard-wired inside public function process(Order $order): void { $gateway = new StripeGateway(config('services.stripe.secret')); }Return results, don't produce side effects.
// Testable: pure calculation, assert on the return value public function calculateDiscount(Cart $cart): Discount // Hard to test: mutates and persists as a side effect public function applyDiscount(Cart $cart): void- Small surface area. Fewer methods = fewer tests needed. Fewer params = simpler test setup.
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.
Rejected framings
- Depth as ratio of implementation-lines to interface-lines (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
- "Interface" as the PHP
interfacekeyword or a class's public methods: too narrow, interface here includes every fact a caller must know. - "Boundary": overloaded with DDD's bounded context. Say seam or interface.
Going deeper
- Deepening a cluster given its dependencies: see references/deepening.md: dependency categories, seam discipline, and replace-don't-layer testing.
- Exploring alternative interfaces: see references/design-it-twice.md: spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.
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.

