agentleFS
kriscardkriscard/Skills/skills/dev/codebase-design/SKILL.md

codebase-design

Skill15 starsChanged 15 days agoMITView on GitHub

Design and evaluate module interfaces, depth, seams, adapters, locality, and testability. Use when deciding what a module should hide, what callers should know, where dependencies should vary, whether an abstraction earns its cost, or how to make one subsystem easier to test and modify. Use for split/join decisions about pipeline stages, shared knowledge, oversized modules, or representation-driven special cases. Also use when another skill needs consistent deep-module vocabulary.

194 other projects use a version of this.

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

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

  • 0

    Common

    Most of the 181 edited versions we read keep these.

  • 10

    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:

    When another skill loads this one, apply the vocabulary and analysis below inside that skill's workflow and output format.

    line 19
  2. Distinctive:

    Use the repository's framework terms for concrete artifacts and *module* for their design role.

    line 31
  3. Distinctive:

    Treat the interface as this full burden, not only its type signature or network API.

    line 48
  4. Distinctive:

    Complete when: every demonstrated piece of caller knowledge is accounted for and implementation knowledge leaking through the interface is …

    line 51
  5. Distinctive:

    Look for repeated orchestration, change amplification, duplicated error handling, scattered policy, and tests that bypass the public …

    line 61
  6. Distinctive:

    If evidence is missing, identify the change or caller trace needed before choosing.

    line 89
  7. Distinctive:

    When one representation forces repeated empty, root, or sentinel checks across ordinary operations, compare it with an invariant that lets …

    line 122
  8. Distinctive:

    Keep existing behavior and public APIs unless the user authorizes a contract change.

    line 132
  9. Distinctive:

    Avoid an abstraction when it only renames operations, forwards calls, or anticipates variation without evidence.

    line 133
  10. Distinctive:

    When invoked directly, return:

    line 167

“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

Concentrate complexity behind useful interfaces. A good module gives callers substantial capability while keeping knowledge, change, bugs, and verification local.

When another skill loads this one, apply the vocabulary and analysis below inside that skill's workflow and output format. When invoked directly, complete the full workflow and return the module-design report.

Workflow

1. Frame the module

Identify the module under review, its responsibility, callers, dependencies, public entry points, observable behavior, and constraints. A module may be a function, class, component, package, service, feature, or tier-spanning slice.

Use the repository's framework terms for concrete artifacts and module for their design role.

Complete when: the module, its callers, its current contract, and the desired outcome are explicit.

2. Map interface burden

List everything a caller must know to use the module correctly:

  • operations and data shapes;
  • invariants and valid ordering;
  • errors and recovery responsibilities;
  • configuration and lifecycle;
  • performance or concurrency characteristics;
  • implementation details repeated or coordinated by callers.

Treat the interface as this full burden, not only its type signature or network API. Trace each claim to callers, exports, tests, or runtime behavior.

Complete when: every demonstrated piece of caller knowledge is accounted for and implementation knowledge leaking through the interface is identified.

3. Assess depth and locality

Judge the behavior centralized by the module against the interface callers must learn. Apply the deletion test: if the module disappeared, would its complexity spread into callers or vanish? Spreading complexity indicates useful leverage; vanishing complexity suggests a shallow pass-through.

Look for repeated orchestration, change amplification, duplicated error handling, scattered policy, and tests that bypass the public interface. Measure depth through caller knowledge and centralized behavior rather than implementation size.

Complete when: the module's depth, leverage, and locality are supported by specific caller and change evidence.

4. Decide what belongs together

For a proposed split or join, inventory the nonobvious knowledge each phase or module needs: format rules, invariants, policy decisions, and reasons to change. Trace duplicated knowledge, including back-door assumptions absent from signatures, to concrete code or contracts. Walk a representative format, invariant, or policy change: which implementations and callers must change together?

Compare keeping, joining, and splitting the relevant responsibilities by total caller and implementation burden: interfaces and coordination added, knowledge hidden or duplicated, change amplification, locality, and demonstrated independent variability. Prefer one owner for knowledge that must change together; preserve meaningful responsibilities that can vary independently and necessary caller policy. Execution order, LOC, or short methods alone do not justify a split; shared input or execution proximity alone do not justify a join.

For example, reading and parsing stages that both encode the same wire grammar may belong behind one protocol interface. Parsing and authorization sharing request data still need distinct trust responsibilities and a narrow validated contract. Preserve ownership, trust/security, deployment, and generated/framework-required boundaries through explicit contracts rather than collapsing them to remove overlap. If evidence is missing, identify the change or caller trace needed before choosing.

Complete when: each proposed grouping has a knowledge/change trace and a join-versus-split rationale, including what remains independently owned. When composed by another workflow, keep this analysis in its existing output format.

5. Inspect seams and adapters

A seam is a place where behavior can vary without editing the caller. An adapter is a concrete implementation occupying a role at that seam. Reserve boundary for domain, ownership, process, deployment, or trust boundaries.

Find where dependencies are accepted versus constructed, where tests and production use different paths, and where callers select or coordinate implementations. Treat a seam as earned when variation is demonstrated by multiple adapters, a test double, a platform difference, or a known source of change.

Complete when: each proposed or existing seam has a demonstrated source of variation and its placement is justified independently from its interface design.

6. Design a deeper alternative

Move stable policy and repeated knowledge behind the interface while preserving necessary caller control. Prefer the smallest coherent interface that owns the full responsibility. Compare the current design with the proposed design through:

  • caller knowledge removed or added;
  • behavior and policy centralized;
  • changes localized;
  • errors and invariants owned;
  • testing through the same interface callers use;
  • migration cost and compatibility.

When one representation forces repeated empty, root, or sentinel checks across ordinary operations, compare it with an invariant that lets the normal operation handle those cases. For example, an empty range can represent no visible selection when copying or deleting that range already preserves the required behavior. Trace the branches and caller obligations removed, not just the reduced if count. Retain meaningful business, authorization, failure, and protocol distinctions; absence and an empty value are interchangeable only when the contract makes them so. A surprising sentinel, a more complicated common path, or one cheap local guard does not justify a representation change. Keep error-contract decisions with their owner and language-specific state modeling with typescript; use refactor for authorized behavior-preserving implementation.

Keep existing behavior and public APIs unless the user authorizes a contract change. Avoid an abstraction when it only renames operations, forwards calls, or anticipates variation without evidence.

Complete when: the recommendation states what moves behind the interface, what remains caller-owned, and why the resulting module provides more leverage.

7. Define verification

Specify how to prove the design improvement. Prefer observable checks such as fewer caller responsibilities, removal of repeated coordination, tests crossing the public interface, localized future changes, or elimination of implementation-aware call sites. For a representation change, check normal, empty/root, and transition cases through the public interface, including preserved distinctions and any caller knowledge actually removed.

Route a cross-system or hard-to-reverse decision to architect. Route authorized behavior-preserving implementation work to refactor.

Complete when: the proposed interface, migration boundary, and checks for behavior and design improvement are concrete enough to implement or review.

Vocabulary

  • Module: an interface plus an implementation.
  • Interface: everything callers must know to use the module correctly.
  • Implementation: behavior hidden behind the interface.
  • Depth: useful behavior provided per unit of interface burden.
  • Seam: a place where behavior can vary without editing the caller.
  • Adapter: a concrete implementation filling a role at a seam.
  • Leverage: capability callers receive per unit of interface they must learn.
  • Locality: concentration of knowledge, change, bugs, and verification.
  • Boundary: a domain, ownership, process, deployment, or trust division.

Report

When invoked directly, return:

  1. Module and callers — scope, responsibility, dependencies, and evidence.
  2. Interface burden — what callers currently must know.
  3. Diagnosis — depth, locality, leaks, seams, adapters, and any grouping decision.
  4. Recommended interface — responsibilities moved, retained, or removed.
  5. Migration and verification — compatibility, sequence, tests, and success checks.

Describe observations before judgments. Tie every recommendation to leverage, locality, testability, or a demonstrated architectural constraint.

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.