codebase-design

Designs deep modules with small interfaces placed at clean, testable seams.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/mikalv/pi-extensions --skill codebase-design-mikalv
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: codebase-design
Source: https://github.com/mikalv/pi-extensions/tree/main/packages/pi-atelier/.agents/skills/codebase-design
Command: npx skills add https://github.com/mikalv/pi-extensions --skill codebase-design-mikalv

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate shallow modules whose interfaces are nearly as complex as their implementations, making code hard to test, navigate, and change. This Skill provides a shared vocabulary and decision framework for designing deep modules so interfaces stay small while behaviour concentrates behind clean seams. ## Core Features & Use Cases - Deep-module vocabulary: Precise definitions of module, interface, seam, adapter, depth, leverage, and locality, with rejected framings explicitly called out so teams use consistent language. - Dependency-aware deepening: Classifies dependencies as in-process, local-substitutable, remote-but-owned, or true external, and prescribes ports-and-adapters or mock strategies per category. - Design It Twice workflow: Spawns parallel sub-agents that each produce a radically different interface for a candidate module, then compares them on depth, locality, and seam placement with an opinionated recommendation. - Use Case: When refactoring a cluster of shallow service classes, use this Skill to decide where the seam goes, define a port with production and in-memory adapters, and rewrite tests against the new deep interface. ## Quick Start Ask the agent to review a module or package in your repository and propose a deeper interface using the codebase-design vocabulary.

Frequently Asked Questions about codebase-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a deep module interface?▼

A deep module hides a large amount of behaviour behind a small interface. Reduce the number of methods, simplify parameters, and hide complexity inside. The interface includes invariants, ordering constraints, and error modes, not just type signatures.

What is the difference between a seam and an interface?▼

A seam is the location where a module's interface lives, a place where behaviour can be altered without editing in place. The interface is everything a caller must know to use the module. Seam placement and interface content are separate design decisions.

When should I introduce a port and adapter?▼

Introduce a port only when at least two adapters are justified, typically a production adapter and a test adapter. One adapter means a hypothetical seam that adds indirection without value. Two adapters make the seam real.

How do I test a deepened module?▼

Write tests at the deepened module's interface, treating the interface as the test surface. Delete old unit tests on the shallow modules it replaced, and assert on observable outcomes so tests survive internal refactors.

How do I handle third-party dependencies when deepening modules?▼

True external dependencies like Stripe or Twilio become injected ports on the deepened module, with tests providing mock adapters. Remote services you own get a port with an HTTP adapter for production and an in-memory adapter for tests.