codebase-design

Design deep modules with small, stable caller-facing contracts and justified seams.

Updated May 18, 2024
One-click install
npx skills add https://github.com/joshhornby/dotfiles --skill codebase-design-joshhornby
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codebase-design
Source: https://github.com/joshhornby/dotfiles/tree/main/.claude/skills/codebase-design
Command: npx skills add https://github.com/joshhornby/dotfiles --skill codebase-design-joshhornby

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? It helps engineers decide how to structure in-process modules and packages so that callers learn less, policy changes stay local, and shallow pass-through abstractions are identified and consolidated. ## Core Features & Use Cases - Deep module design: Define a cohesive responsibility, inventory the full caller-facing contract burden, and hide decisions behind a small stable interface. - Deepening and migration guidance: Use the deepening reference to classify dependencies, justify seams, and migrate existing modules safely with behavior tests. - Design It Twice comparison: Generate and compare genuinely different contract shapes against the same scenarios before committing to a consequential design. - Use Case: When several callers duplicate the same orchestration and provider knowledge, use this Skill to propose a consolidated module contract, its seams, and the behavior tests that should survive refactoring. ## Quick Start Ask the assistant to use codebase-design to evaluate whether a set of modules should be combined or split and to propose the resulting public contract.

Frequently Asked Questions about codebase-design

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

FAQPage Schema
How do I decide whether to combine or split modules in a codebase?

Apply the behavior-preserving inlining test: imagine inlining the module into every caller. If policy, sequencing, or error-handling knowledge spreads across callers, keep the module; if callers get simpler with no duplicated knowledge, the module is shallow and can be merged.

What is a deep module in software design?

A deep module hides substantial coherent behavior and design decisions behind a small, stable caller-facing contract. Depth is measured by caller leverage and maintainer locality, not by lines of code, and the contract includes errors, ordering, effects, and performance obligations.

When should I create a seam or adapter around a dependency?

Create a seam only with concrete evidence: substitution needs, independent testing, volatility isolation, ownership, trust, runtime failure, or deployment boundaries. A production adapter plus a faithful test interactor can justify a seam; accidental wrappers do not.

Does this approach apply to public HTTP APIs?

No. Public HTTP contracts published or versioned across an ownership boundary are routed to the api-design skill. This Skill covers in-process module and package contracts, including ordinary component props.

How do I safely consolidate existing shallow modules?

Follow the deepening reference: fix the review target, establish behavior tests first, define the target contract, move one decision at a time, use temporary compatibility facades only when required, and retire old modules only after equivalent behavior coverage exists.

What are the limitations of the deep module approach?

Depth without cohesion creates a god module. Do not consolidate code that evolves, fails, deploys, or is authorized independently, and do not diagnose intentionally thin edges like route leaves, adapters, or composition roots as shallow.