deep-modules
Skill4 starsChanged 15 days agoMITView on GitHub
Software design for codebases that stay easy to change, for humans and agents alike. Use when designing a new module, service, class, or API, refactoring a tangled area, deciding where logic belongs or where to split code, reviewing architecture, or when the user mentions maintainability, coupling, abstraction, layering, testability, or "this code is a mess". Applies deep modules (small interface, rich hidden behavior), information hiding, seams, and explicit states, and refactors in safe, behavior-preserving steps.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- anivar/agentic-sdlctheir own version, first seen Nov 16, 2026
- AdityaZxxx/skillstheir own version, first seen Oct 20, 2026
- sammasak/skillstheir own version, first seen Oct 17, 2026
- sammasak/claude-code-skillstheir own version, first seen Oct 13, 2026
- codybrom/clairvoyancetheir own version, first seen Jul 1, 2026
- preetamnath/agent-skillstheir own version, first seen Apr 24, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- codybrom/clairvoyance★ 12same name
- preetamnath/agent-skills★ 4same name
- AdityaZxxx/skills★ 1same name
- sammasak/claude-code-skills★ 1same name
- sammasak/skills★ 1same name
- anivar/agentic-sdlc★ 0same name
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 repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-ready-repoSkill
- bug-triageSkill
- ci-auditorSkill
- evidence-before-claimsSkill
- finish-the-jobSkill
- parallel-agentsSkill
- plan-before-codeSkill
- prior-art-scoutSkill
- security-auditSkill
- senior-engineerSkill
- staff-reviewSkill
- state-machine-hunterSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
6
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
- Distinctive: line 24
Make modules deep: Before adding a module, ask what complexity it hides.
- Very specific: line 28
Make illegal states unrepresentable: Use types that only allow valid combinations (see state-machine-hunter).
- Distinctive: line 29
Functional core, imperative shell: Keep decisions in pure functions that take data and return data.
- Distinctive: line 31
One adapter is a hypothetical seam; two is a real one: Don't create an interface "in case we swap databases".
- Distinctive: line 32
Different layer, different abstraction: If two adjacent layers have the same methods with the same parameters, one of them is probably a …
- Distinctive: line 54
Keep refactors and behavior changes in separate commits, so a reviewer can verify each on its own.
- Distinctive: line 55
Stop when the change you actually needed has become easy.
“Common” is measured: kept by at least 6 in 10 of the 6 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
Deep Modules
Complexity is what makes software hard to change, and it accumulates in small increments: one more parameter, one more pass-through layer, one more place that knows a detail it shouldn't. Good design fights it by hiding complexity behind simple interfaces so that most of the code never has to think about it. Ideas here draw on John Ousterhout's A Philosophy of Software Design, Michael Feathers' work on seams, and the functional-core / imperative-shell pattern.
Vocabulary
- Module: anything with an interface and an implementation: a function, class, package, or service.
- Interface: everything a caller must know to use the module correctly. That covers signatures, but also ordering rules, error modes, invariants, and performance characteristics.
- Deep module: lots of useful behavior behind a small interface. Unix file I/O (
open,read,write,lseek,close) hides caching, devices, and permissions behind five calls. - Shallow module: an interface nearly as complex as its implementation. Pass-through wrappers, getter/setter classes, and "manager" classes that forward every call.
- Seam: a place where behavior can be changed without editing the code there, such as a parameter, an interface, or a configuration point. This is where tests and alternate implementations plug in.
Principles
- Make modules deep. Before adding a module, ask what complexity it hides. If callers still need to understand everything inside, it isn't earning its keep.
- Hide information. Each design decision (a file format, a caching strategy, a vendor API) should live in one module. When a decision leaks into many places, changing it means changing all of them.
- Pull complexity downward. It's better for the module to handle a hard case once than for every caller to handle it. Sensible defaults beat required configuration.
- Define errors out of existence where you can. An API where "delete a missing key" is simply a no-op is easier to use correctly than one that throws.
- Make illegal states unrepresentable. Use types that only allow valid combinations (see
state-machine-hunter). - Functional core, imperative shell. Keep decisions in pure functions that take data and return data; keep I/O at the edges. The core becomes trivially testable and the shell stays thin.
- Accept dependencies, don't construct them. Pass the clock, the HTTP client, and the repository in. It's the cheapest seam there is.
- One adapter is a hypothetical seam; two is a real one. Don't create an interface "in case we swap databases". Create it when the second implementation (often the test fake) exists.
- Different layer, different abstraction. If two adjacent layers have the same methods with the same parameters, one of them is probably a pass-through that should go.
- Names are interface. A name that needs a comment to explain it is a design smell. If you can't name a module simply, its responsibility probably isn't simple.
Red flags
| Smell | What it suggests |
| A change requires edits in many unrelated files | Information leakage; a decision isn't localized |
| A function needs 6+ parameters or boolean flags | Several responsibilities fused together, or complexity pushed up to callers |
Classes named *Manager, *Helper, *Util, *Service with grab-bag methods | Missing domain concepts |
| Tests need heavy mocking of your own code | Logic tangled with I/O; missing seam |
| Same conditional repeated across the codebase | A missing abstraction or an implicit state machine |
| A comment repeats what the code says | The code isn't expressing intent; rename or restructure |
The deletion test
Imagine deleting a module and inlining it into its callers. If complexity vanishes, it was a pass-through; inline it as part of your refactor (or propose removing it, if it isn't code you're already changing). If complexity reappears in many places, it's earning its keep.
Refactoring safely
- Pin current behavior with tests at the module's public interface; add characterization tests if needed.
- Change structure in small, behavior-preserving steps (extract, inline, move, rename), running the tests after each.
- Keep refactors and behavior changes in separate commits, so a reviewer can verify each on its own.
- Stop when the change you actually needed has become easy. Refactoring is in service of a goal, not a goal in itself.
Designing for agents (AX)
Code that's easy for agents to change is code that's easy for anyone to change: one obvious place for each concept, greppable names that match the domain, explicit types and states, small modules with clear entry points, and fast tests at stable interfaces. When a design decision isn't obvious from the code, write it down next to the code (a short README in the module, or an ADR).
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.

