agentleFS
haintbotasthaintbotast/coding-agent-instructions/skills/codebase-design/SKILL.md

codebase-design

Skill0 starsChanged 22 days agoMITView on GitHub

Use when deciding where a seam goes, how deep a module's interface should be, or how to make code more testable and AI-navigable. For naming and shared vocabulary, use domain-modeling.

194 other projects use a version of this, 145 of them edited.

Adopted by

Most recently taken up by

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.
  • liufeng1976Skill

    setup-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

  • FabienDehopreSkill

    decision-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

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 55 projects that use this

  • LesaniSkill

    writing-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

  • AWSSkill

    to-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

  • LesaniSkill

    writing-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

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 181 edited versions we read keep these.

  • 2

    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:

    One adapter = hypothetical seam. Two adapters = real seam: Don't introduce a seam unless something actually varies across it.

    line 25
  2. Distinctive:

    When designing an interface ask: fewer methods?

    line 39

“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.

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

Codebase Design — deep modules

Design deep modules: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Goal: leverage for callers, locality for maintainers.

Vocabulary (use these terms exactly)

  • Module — anything with an interface and an implementation; scale-agnostic (function, class, package). Avoid: unit, component, service.
  • Interface — everything a caller must know: signature + invariants, ordering, error modes, config, performance. Avoid: API (too narrow).
  • Depth — leverage at the interface: behaviour exercised per unit of interface learned. Deep = small interface, lots behind it. Shallow = interface nearly as complex as the implementation.
  • Seam (Feathers) — where you can alter behaviour without editing in that place; where the interface lives. Avoid: boundary.
  • Adapter — a concrete thing satisfying an interface at a seam (role, not substance).
  • Leverage — callers' payoff: one implementation pays back across N call sites and M tests.
  • Locality — maintainers' payoff: change, bugs, and verification concentrate in one place.

Principles

  • Depth is a property of the interface, not the implementation. Internals may be small, swappable parts with internal seams — they're just not part of the interface.
  • The deletion test: imagine deleting the module. Complexity vanishes → it was a pass-through. Complexity reappears across N callers → it earned its keep.
  • The interface is the test surface. Wanting to test past the interface means the module is the wrong shape.
  • One adapter = hypothetical seam. Two adapters = real seam. Don't introduce a seam unless something actually varies across it.

Simplicity ladder — stop at the first rung that holds

  1. Does this need to exist at all? 2. Already in this codebase? 3. Standard library does it? 4. Native platform feature covers it? 5. An already-installed dependency solves it? 6. Can it be one line? 7. Only then: the minimum code that works. Two stdlib options of the same size → take the one correct on edge cases. Bug fix = root cause, not symptom: grep every caller before editing; one guard in the shared function beats a guard in every caller.

Mark deliberate shortcuts with a ceiling. A simplification that cuts a real corner (global lock, O(n²) scan, naive heuristic) gets a ceiling: comment naming the ceiling and the upgrade trigger. A ceiling comment with no trigger is the kind that rots; grep -rn "ceiling:" is the debt ledger. (Ladder and marker distilled from DietrichGebert/ponytail, MIT.)

Designing for testability

  1. Accept dependencies, don't create them (inject the gateway; don't new StripeGateway() inside).
  2. Return results, don't produce side effects.
  3. Small surface area: fewer methods = fewer tests; fewer params = simpler setup.

When designing an interface ask: fewer methods? simpler params? more complexity hidden inside?

Periodic architecture review

Scope before you scan — YAGNI. Deepening pays off by making future changes easier, so weight the parts of the codebase that change often. If the user named a direction (module, subsystem, pain point), take it. Otherwise walk back the commit history (git log --oneline) for hot spots — files that keep coming up — and let those pull your attention first; scattered changes with no hot spot → widen the net.

Then scan the scoped area for deepening opportunities: shallow modules, concept-understanding that bounces across many files, pure functions extracted "for testability" while bugs hide in how they're called, untestable-through-interface areas. Apply the deletion test to suspects. Present candidates (files, problem, solution, benefits in locality/leverage terms, recommendation strength), let the user pick one, then run grilling on the chosen design. Record rejections with load-bearing reasons as ADRs so future reviews don't re-suggest them.


Distilled from mattpocock/skills (MIT © Matt Pocock), snapshot 9603c1c (2026-07-20). Based on Ousterhout, "A Philosophy of Software Design".

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.