agentleFS
MarkTripoliMarkTripoli/skills/skills/engineering/codebase-design/SKILL.md

codebase-design

Skill2 starsChanged 2 months agoMITView on GitHub

Designs deep modules with a fixed vocabulary (module, interface, depth, seam, adapter, leverage, locality), either shaping one module's interface or surveying a codebase for deepening opportunities and ranking them in a report. Use when the user runs /codebase-design, asks to "design this module's interface", "where should the seam go", "improve the codebase architecture" or "find refactoring opportunities"; not for implementing a chosen refactor (use /deliver) or reviewing a diff (use two-axis-review).

193 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use decision-mapping, setup-ts-deep-modules 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.
  • 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

  • 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 53 projects that use this

  • RoentekSkill

    loop-me

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

    Also in 66 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 71 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 72 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 109 projects that use this

  • +1 more from Lesani

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 183 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the writing guide and the collection conventions before drafting, revising, or replying.

    line 6
  2. Distinctive:

    Use these terms exactly in every reply and report.

    line 17
  3. Distinctive:

    One adapter is a hypothetical seam; two make a real one: Add a seam only where something varies across it, usually production and test.

    line 37
  4. Very specific:

    Read the module, its callers and tests.

    line 42
  5. Distinctive:

    Write the interface: entry points, parameters, invariants, error modes, and a two-line caller example.

    line 44
  6. Distinctive:

    When the shape is contested or the user wants options, follow design_it_twice.md, which holds the parallel-worker pattern for drafting …

    line 45
  7. Very specific:

    Stop: Ask which candidate to explore.

    line 64

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

Read the writing guide and the collection conventions before drafting, revising, or replying; a checkout of the collection has both under shared/.

Codebase design

Aim for deep modules: much behavior behind a small interface, at a seam where something really varies, tested through that interface. Pick the job from the request:

  • Design one module's interface or seam: follow Design a module.
  • Survey a codebase or area for deepening opportunities: follow Survey for deepening.

Vocabulary

Use these terms exactly in every reply and report. Do not substitute component, service, unit, API, signature, boundary, layer or wrapper.

TermMeaning
ModuleAnything with an interface and an implementation, at any scale: function, class, package, slice across tiers
InterfaceEverything a caller must know to use the module: types, plus invariants, ordering, error modes, required config, performance
ImplementationThe code inside the module
DepthBehavior a caller or test can exercise per unit of interface learned. Deep: small interface, much behavior. Shallow: interface nearly as complex as the implementation
SeamThe place where behavior can change without editing there; where an interface lives. Placing it is its own decision
AdapterA concrete thing filling a seam; names a role, not a size
LeverageWhat callers gain from depth: one implementation pays back across every call site and test
LocalityWhat maintainers gain from depth: change, bugs and verification concentrate in one place

Depth is measured as leverage, not as a ratio of implementation lines to interface lines, which rewards padding.

Principles

  • Depth lives in the interface. A deep module may be built from small swappable parts; they are internal seams, used by its own tests and never exposed.
  • Deletion test. Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across callers, it earns its place.
  • The interface is the test surface. Callers and tests cross the same seam. A test that has to reach past the interface means the module has the wrong shape.
  • One adapter is a hypothetical seam; two make a real one. Add a seam only where something varies across it, usually production and test.
  • Accept dependencies, return results. Pass collaborators in rather than constructing them inside; return values rather than mutating arguments. Both keep the module testable through its interface.

Design a module

  1. Read the module, its callers and tests. Read GLOSSARY.md and ADRs in docs/adr/ when they exist; use their domain names for modules and do not reopen a recorded decision without new friction.
  2. Classify each dependency with deepening.md, which holds the four dependency categories, seam rules and the replace-don't-layer test strategy. Load it whenever a dependency crosses I/O or a network.
  3. Write the interface: entry points, parameters, invariants, error modes, and a two-line caller example. Ask of each draft: can it have fewer entry points, simpler parameters, more hidden inside?
  4. When the shape is contested or the user wants options, follow design_it_twice.md, which holds the parallel-worker pattern for drafting three or four radically different interfaces and comparing them.
  5. Reply with the chosen interface, what it hides, the seam and its adapters, and which existing tests it replaces.

Survey for deepening

The survey changes no file in the repository. It ends with a ranked list.

  1. Scope. Take the area the user named. Otherwise run git log --oneline -200 --name-only and start from the files that change most; widen only when changes are scattered.
  2. Explore. Read GLOSSARY.md and ADRs when present, then walk the area, in a fresh child worker when the runtime has one. Note friction: one concept spread over many small modules, interfaces as wide as their implementations, logic extracted for testing whose bugs live in the callers, coupling that leaks across seams, code untestable through its current interface. Apply the deletion test to each suspect.
  3. Rank. For each candidate record files, problem, proposed deepening, dependency category from deepening.md, wins in vocabulary terms, and strength Strong, Worth exploring or Speculative. Flag a candidate that contradicts an ADR only when the friction justifies reopening it.
  4. Report. Reply with the ranked list, top candidate first, in this shape:

    1. Fold `src/orders/OrderFacade.mjs` into the order intake module (Strong, in-process)
       Problem: OrderFacade forwards every call unchanged; deleting it moves no complexity.
       Wins: interface shrinks by one module; tests hit one seam.

    When the user asks for a visual report, or there are more than five candidates, also write the HTML page described in html_report.md, which holds the page scaffold, before-and-after diagram patterns and style rules. Write it to the OS temp directory, never the repository, and give its absolute path.

  5. Stop. Ask which candidate to explore. Designing its interface is the Design job above; implementing it is a normal change through /deliver.

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.