agentleFS
anivaranivar/agentic-sdlc/skills/deep-modules/SKILL.md

deep-modules

Skill0 starsChanged 37 days agoMITView on GitHub

The vocabulary and the moves for designing deep modules: a lot of behaviour behind a small interface at a clean seam, testable through that interface. Module, interface, implementation, depth, seam, adapter, payback, locality, used exactly. Deepening a cluster given its dependency category, and exploring alternative interfaces with parallel agents only after the decider agrees to the fan-out. Triggers on: "design the interface", "where should the seam go", "deepen this", "module boundary", "make this testable", "too many small modules", "ports and adapters", "design it twice", "which abstraction".

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 5 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
  1. Distinctive:

    Use these words exactly in module design.

    line 31

“Common” is measured: kept by at least 6 in 10 of the 5 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Deep modules

Design deep modules: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. The aim is payback for callers, locality for maintainers, and testability for everyone.

Vocabulary

Use these words exactly in module design; do not substitute "component", "service" or "API" for module and interface, or "boundary" for seam. "Boundary" keeps its other senses: a bounded context, and the system boundary where test-first puts its mocks.

TermIsAvoid
ModuleAnything with an interface and an implementation: a function, a class, a package, a tier-spanning slice.unit, component, service
InterfaceEverything a caller must know to use the module correctly: types, invariants, ordering, error modes, required configuration, performance characteristics.API, signature
ImplementationWhat is inside the module.
DepthBehaviour a caller or a test can exercise per unit of interface learned. Deep: a lot behind a little. Shallow: the interface is nearly as complex as the implementation.
SeamMichael Feathers' term: a place where behaviour can be altered without editing in that place; where a module's interface lives. Where the seam goes is its own decision.boundary
AdapterA concrete thing that satisfies an interface at a seam. A role, not a substance.
PaybackWhat callers get from depth: one implementation pays back across N call sites and M tests.leverage (Ousterhout's and the upstream's word; kept out of this set because VOICE-6 bans it as a verb) <!-- voice-lint: skip -->
LocalityWhat maintainers get from depth: change, bugs and knowledge concentrate in one place.

The rules

IdRuleIn practice
DESIGN-1Deep modulesFewer methods, simpler parameters, more hidden. The deletion test: delete the module; if complexity vanishes it was a pass-through, if it reappears across N callers it was earning its keep.
DESIGN-2The interface is the test surfaceCallers and tests cross the same seam. Wanting to test past the interface means the module is the wrong shape. A module can have internal seams for its own tests without exposing them.
DESIGN-3Two adapters make a seamOne adapter is a hypothetical seam: indirection with no variation. Production plus test counts as two.
DESIGN-4Replace tests after deepeningOld tests at the shallow modules become waste once tests at the deepened interface exist; delete them. New tests assert observable outcomes through the interface and survive internal refactors.
DESIGN-5Design it twice, with consentAsk before a fan-out. With consent, three or more agents each produce a radically different interface; compare on depth, locality and seam placement; recommend one, or a hybrid. Without consent, one design at a time.

Designing for testability

Accept dependencies, do not create them. Return results, do not produce side effects. Keep the surface small: fewer methods mean fewer tests, fewer parameters mean simpler setup.

Rejected framings

Depth as a ratio of implementation lines to interface lines rewards padding; depth is payback. "Interface" as the language keyword or a class's public methods is too narrow. "Boundary" is overloaded with bounded contexts; say seam or interface.

Going deeper

  • Deepening a cluster given its dependencies: references/deepening.md.
  • Exploring alternative interfaces in parallel: references/design-it-twice.md.

Companion skills

NeedSkill
Agreeing the seams before tests (TEST-1)invoke test-first after this skill
Recording a seam placement that is hard to reversedecision-records
The questions that settle the designgrill-plan

Sources

John Ousterhout, A Philosophy of Software Design (deep modules, design it twice). Michael Feathers, Working Effectively with Legacy Code (seams). codebase-design (mattpocock/skills, MIT).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.