agentleFS
dafaalzdafaalz/agent-skills/skills/codebase-design/SKILL.md

codebase-design

Skill2 starsChanged 2 months agoMITView on GitHub

Use when designing module interfaces, evaluating abstraction depth, identifying code seams, or turning shallow pass-through wrappers into deep modules. Don't use for syntax styling, single-line bug fixes, or minor formatting changes.

139 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use writing-beats, writing-shape 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.
  • RoentekSkill

    writing-beats

    Writing, exploit — assemble raw material into a journey of beats, grounding each term before a beat leans on it.

    Also in 23 projects that use this

  • RoentekSkill

    writing-shape

    Writing, exploit — shape raw material into an article, paragraph by paragraph.

    Also in 23 projects that use this

  • loulanyueSkill

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

  • risadamsSkill

    which-skill

    Router over this pack's skills and flows. Ask it "which skill fits X" when you don't remember what's available.

    Also in 5 projects that use this

  • pahwarangerSkill

    setup-skills

    Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's ticket tracker (GitHub or local markdown), triage label vocabulary, and domain doc layout. Run before first use of `to-tickets`, `to-prd`, `triage`, `diagnose`, `tdd`, `improve-codebase-architecture`, or `zoom-out` — or if those skills appear to be missing context about the ticket tracker, triage labels, or domain docs.

    Also in 7 projects that use this

  • qhuang20Skill

    migrate-to-shoehorn

    Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.

    Also in 24 projects that use this

  • +2 more from Roentek

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 128 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
  1. Distinctive:

    Follow these five steps in sequence.

    line 12
  2. Distinctive:

    Read the project context and verify actual data schemas before modifying or creating modules.

    line 16
  3. Very specific:

    If the user accepts, consult references/design-it-twice.md and dispatch sub-agents using invoke_subagent.

    line 35
  4. Distinctive:

    If the user declines, proceed directly to Step 3.

    line 36
  5. Distinctive:

    Wait for explicit user approval.

    line 63
  6. Distinctive:

    Use these architectural terms consistently:

    line 75
  7. Distinctive:

    Run this check before finishing the skill execution:

    line 90

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

Design deep modules with substantial behavior behind small interfaces, placed at clean seams, and testable directly through those interfaces.

Workflow

Follow these five steps in sequence.

Step 1. Domain context and schema ingestion

Read the project context and verify actual data schemas before modifying or creating modules.

  1. Inspect AGENTS.md, CODEBASE.md, or CLAUDE.md in the project root if present. Use the domain nouns, bounded contexts, and naming conventions defined there.
  2. Audit database schemas and migration files:
    • For projects with existing databases, inspect migration directories (such as database/migrations/, prisma/schema.prisma, or src/db/).
    • Ground all entity attributes, foreign keys, and relations in verified schema files on disk. Never invent columns or assume database fields based on general model training.
    • For greenfield repositories without existing migrations, mark the status as greenfield initialization and draft the initial schema explicitly without unverified assumptions.
  3. Infer domain boundaries and seams directly from verified migrations, route declarations, and existing data models.

Completion criterion. The agent names modules, methods, and attributes using verified project domain terms and disk-backed database schemas.

Step 2. Design It Twice offer

Offer the user an exploratory multi-agent design pass before committing to a single interface.

Ask the user:

"Do you want to run a Design It Twice pass with parallel sub-agents to explore 2 to 3 contrasting interface designs, or proceed directly with a single design?"

  • If the user accepts, consult references/design-it-twice.md and dispatch sub-agents using invoke_subagent.
  • If the user declines, proceed directly to Step 3.

Completion criterion. User preference recorded and the matching design branch initiated.

Step 3. Deep module and seam formulation

Formulate the interface and identify module boundaries using deep module principles.

  1. Apply the deletion test. Imagine deleting the module. If complexity vanishes, the module is a shallow pass-through wrapper and should be merged or deleted. If complexity reappears across multiple callers, the module earns its keep. Consult references/codebase-health-and-hotspots.md for git churn hotspot detection, deletion test execution, and architecture diagrams.
  2. Minimize interface surface. Reduce public methods, simplify parameters, and hide implementation details internally.
  3. Classify dependencies across seams. Consult references/deepening.md to classify external touchpoints into in-process, local-substitutable, remote owned, or true external.
  4. Enforce seam discipline. Follow the rule that one adapter represents a hypothetical seam, while two adapters represent a real seam. Do not introduce interface ports unless at least two concrete adapters exist.
  5. Simplicity first and YAGNI discipline. Never introduce abstractions, generics, or configurability layers for single-use code. Build the minimum interface that solves the confirmed problem. If an interface introduces more boilerplate than the implementation logic it wraps, inline or simplify it.
  6. Align interface with test surface. Ensure callers and automated tests cross the same external seam. Do not leak internal test hooks into the public interface.

Completion criterion. A written interface specification defining inputs, outputs, error states, and concrete seam placement.

Step 4. User review gate

Present the proposed interface design to the user before writing implementation code.

Cover these technical details:

  • Module responsibility and what implementation logic sits behind it.
  • Public interface signature and parameter types.
  • Seam placement and adapter classifications.
  • Automated testing strategy through the public interface.

Wait for explicit user approval. If the user requests adjustments, update the interface and repeat the review.

Completion criterion. Explicit user confirmation approving the interface design.

Step 5. Transition to implementation planning

Invoke the writing-plans skill to generate a phased implementation plan.

Completion criterion. The writing-plans skill is invoked with the approved interface design.

Core vocabulary

Use these architectural terms consistently:

TermDefinitionAvoid substituting
ModuleA discrete unit with an interface and an implementationComponent, service, unit
InterfaceEverything a caller must know to use the module correctly, including types, invariants, and errorsAPI, signature
ImplementationInternal code body hidden behind the interfaceAdapter
DepthAbstraction power at the interface, maximizing behavior while minimizing surface areaLines of code ratio
SeamThe location where behavior can be altered without editing the callerBoundary
AdapterA concrete implementation that satisfies an interface at a seamInfrastructure, driver
MultiplierTotal capability gained by callers per unit of interface learnedAbstraction power
LocalityConcentration of change, knowledge, and bugs in one placeCohesion

Quick audit checklist

Run this check before finishing the skill execution:

CheckPassing condition
Depth checkModule hides internal complexity behind a minimal parameter surface
Deletion testDeleting module causes complexity to reappear across callers
Seam disciplineNo interface port created for single-adapter dependencies
Test surfaceTests exercise the module through the same seam used by callers
Progressive disclosureDeepening and multi-agent rules loaded from references/
Pipeline handoffTransition offered to writing-plans upon design approval

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.