Skip to content
Skills Library
Programming · Planning

codebase-design

/codebase-design

Use when designing deep modules, improving a module's interface, finding deepening opportunities, deciding where a seam goes, making code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

Licence
MIT
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when designing deep modules, improving a module's interface, finding deepening opportunities, deciding where a seam goes, making code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

Original author description

Use when designing deep modules, improving a module's interface, finding deepening opportunities, deciding where a seam goes, making code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

How it works

  1. Glossary
  2. Deep vs shallow
  3. Principles
  4. Designing for testability
  5. Relationships
  6. Rejected framings
  7. Going deeper
Original SKILL.md headings · 111 lines, 677 words
SKILL.md preview
---
name: codebase-design
description: Use when designing deep modules, improving a module's interface, finding deepening opportunities, deciding where a seam goes, making code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
---

# Codebase Design

Design **deep modules**: much behaviour behind small interface, at clean seam, testable through that interface. Use this language + principles wherever code designed or restructured. Aim: leverage for callers, locality for maintainers, testability for all.

## Glossary

Use terms exactly: no "component," "service," "API," "boundary." Consistent language = whole point.

**Module**: anything with interface + implementation. Scale-agnostic on purpose: function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.

**Interface**: everything caller must know to use module correctly: type signature, plus invariants, ordering constraints, error modes, required config, performance characteristics. _Avoid_: API, signature (too narrow, only type-level surface).

**Implementation**: module's inside, its body of code. Distinct from **Adapter**: thing can be small adapter with large implementation (Postgres repo) or large adapter with small implementation (in-memory fake). Say "adapter" when seam is topic; "implementation" otherwise.

**Depth**: leverage at interface. Behaviour caller (or test) can exercise per unit of interface learned. Module **deep** when much behaviour behind small interface, **shallow** when interface nearly as complex as implementation.

**Seam** _(Michael Feathers)_: place where behaviour can change without editing that place; the _location_ where module's interface lives. Seam placement = own design decision, separate from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).

**Adapter**: concrete thing satisfying interface at seam. Describes _role_ (slot filled), not substance (what's inside).

**Leverage**: what callers get from depth. More capability per unit of interface learned. One implementation pays back across N call sites, M tests.

**Locality**: what maintainers get from depth. Change, bugs, knowledge, verification concentrate in one place, not spread across callers. Fix once, fixed everywhere.

## Deep vs shallow

**Deep module** = small interface + lots of implementation:

```
┌─────────────────────┐
│   Small Interface   │  ← Few methods, simple params
├─────────────────────┤
│                     │
│  Deep Implementation│  ← Complex logic hidden
│                     │
└─────────────────────┘
```

**Shallow module** = large interface + little implementation (avoid):

```
┌─────────────────────────────────┐
│       Large Interface           │  ← Many methods, complex params
├─────────────────────────────────┤
│  Thin Implementation            │  ← Just passes through
└─────────────────────────────────┘
```

When designing interface, ask:

- Fewer methods?
- Simpler params?
- Hide more complexity inside?

## Principles

- **Depth is a property of the interface, not the implementation.** Deep module can be built from small, mockable, swappable parts internally; they're just not in interface. Module can have **internal seams** (private to implementation, used by own tests) plus **external seam** at interface.
- **The deletion test.** Imagine deleting module. Complexity vanishes → was pass-through. Complexity reappears across N callers → earned its keep.
- **The interface is the test surface.** Callers + tests cross same seam. Want to test _past_ interface → module probably wrong shape.
- **One adapter means a hypothetical seam. Two adapters means a real one.** No seam unless something actually varies across it.

## Designing for testability

Good interfaces make testing natural:

1. **Accept dependencies, don't create them.**

   ```typescript
   // Testable
   function processOrder(order, paymentGateway) {}

   // Hard to test
   function processOrder(order) {
     const gateway = new StripeGateway();
   }
   ```

2. **Return results, don't produce side effects.**

   ```typescript
   // Testable
   function calculateDiscount(cart): Discount {}

   // Hard to test
   function applyDiscount(cart): void {
     cart.total -= discount;
   }
   ```

3. **Small surface area.** Fewer methods = fewer tests. Fewer params = simpler test setup.

## Relationships

- **Module** has exactly one **Interface** (surface shown to callers + tests).
- **Depth** = property of **Module**, measured against its **Interface**.
- **Seam** = where **Module**'s **Interface** lives.
- **Adapter** sits at **Seam**, satisfies **Interface**.
- **Depth** yields **Leverage** for callers, **Locality** for maintainers.

## Rejected framings

- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding implementation. Use depth-as-leverage instead.
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here = every fact caller must know.
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.

## Going deeper

- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, replace-don't-layer testing.
- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design interface several radically different ways, compare on depth, locality, seam placement.
Files in this package (3)
  • DEEPENING.md 2 KB
  • DESIGN-IT-TWICE.md 2 KB
  • SKILL.md 6 KB

Versions

RepositoryScoreLicence
This page · j0hanz/j0hanz-marketplace100MIT
mikeleg/skills100MIT
VincenzoImp/pitcrew100MIT
kriscard/kriscard-claude-plugins100MIT
akillness/jeo-skills100MIT
JamalLyons/Agent-Skills100MIT
zenobi-us/dotfiles100MIT
FrancoStino/opencode-skills-collection100MIT
yassimba/loom100Apache-2.0

Database snapshot: 13.11.2026 · package version 6088ee20c701 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95workflow-codebase-design
    Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
  • 100improve-codebase
    Use when designing or reviewing a module's interface, deciding where a seam goes, finding shallow modules or deepening opportunities, running an architecture review, making code more testable or AI-navigable, or extracting code repeated across three or more projects into a…
  • 100module-design
    Foundational deep-module design operator and shared vocabulary. Use when designing or deepening a module's interface, deciding where a seam goes, partitioning orthogonal modules for concurrency, flattening if/else branching, making code, AI skills, or method systems more…
  • 100oracle-codebase-design
    Shared vocabulary and principles for designing deep modules. Use when designing or changing a module's interface, deciding where a seam goes, handling untrusted input at the edges, choosing the level to test at, naming modules, or making code more testable. Also use when another…
  • 100deep-module-design
    Design deep modules with small interfaces and rank shallow, pass-through or leaky code for deepening. Use when designing a module interface, improving codebase architecture, or making code easier to test.
  • 100architecture
    Use when the user asks to improve architecture, find refactoring opportunities, surface deepening opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable. Surfaces shallow modules and hypothetical seams using a precise vocabulary…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.