codebase-design

A code-design guide for building modules with small, clear interfaces and substantial internal implementation. It also explains how to place replaceable seams and test behavior through the public interface.

In plain words
What is it for?
Use it when designing functions, classes, packages, or larger code slices. It helps you choose module interfaces, seams, adapters, and tests that make future changes more local.
Why use it?
It helps keep implementation details from spreading through the codebase. Changes and debugging can stay inside one module instead of requiring updates in many callers.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/voidtechnology/voidtech-claude-plugins/codebase-design
Any agent
npx skills add VoidTechnology/voidtech-claude-plugins --skill codebase-design
Clone the repo
git clone --depth 1 https://github.com/VoidTechnology/voidtech-claude-plugins

Made for: Claude Code, Codex.

Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,539 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00050 $0.01539
Opus 5 $0.00025 $0.00770
Sonnet 5 $0.00010 $0.00308
Haiku 4.5 $0.00005 $0.00154

Measured yesterday against content hash bc930c526b16, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codebase-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/voidtech-engineering/skills/codebase-design/SKILL.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Vendored from mattpocock/skills · MIT © 2026 Matt Pocock · upstream 6eeb81b · 已汉化并完成 VoidTech 插件内自包含适配。LICENSE 见 ../_vendor-licenses/mattpocock-LICENSE

代码库设计

设计 deep module(深模块):用简单接口提供完整能力,把实现细节留在清晰的 seam(可替换接缝)之后,并通过公开接口测试行为。目标是让调用方用更少的接口获得更多能力,让修改和排错集中在模块内部。

术语表

统一使用以下术语,不要用含义不完全相同的 "component"、"service"、"API" 或 "boundary" 替换。

Module(模块) — 任何同时具有接口和实现的代码单元,可以是函数、类、包或跨层切片。避免:unit、component、service。

Interface(接口) — 调用方为了正确使用模块而必须知道的一切,包括类型签名、不变式、调用顺序、错误方式、必要配置和性能特征。避免:API、signature(只表达了类型层面的表面)。

Implementation(实现) — 模块内部代码。它与 Adapter 不同:adapter 描述代码在 seam 处承担的角色,implementation 描述模块内部如何工作。讨论 seam 时使用 "adapter",其他情况使用 "implementation"。

Depth(深度) — 简单接口背后包含的有效能力。接口小、内部能力完整的是 deep(深) 模块;接口与实现同样复杂的是 shallow(浅) 模块。

Seam(可替换接缝) (Michael Feathers) — 无需修改调用方,就能替换实现或改变行为的位置。seam 通常位于模块接口处;放在哪里与背后采用什么实现是两个不同决策。避免:boundary(容易与 DDD 的 bounded context 混淆)。

Adapter(适配器) — 在某个 seam 处实现接口的对象或模块。这个词描述它承担的角色,而不是内部实现方式。

Leverage(接口收益) — 调用方只需理解少量接口,就能使用较多能力。同一份实现可以服务多个调用点和测试。

Locality(修改集中度) — 变更、缺陷、业务知识和验证逻辑集中在模块内部,而不是散落到多个调用方。一处修复即可覆盖所有调用点。

深模块与浅模块

Deep module = 小接口 + 大量实现:

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

Shallow module = 大接口 + 少量实现(避免):

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

设计接口时,问自己:

  • 我能减少方法数量吗?
  • 我能简化参数吗?
  • 我能在内部藏更多复杂度吗?

原则

  • Depth 是接口的属性,不是实现的属性。 深模块内部可以由小型、可 mock、可替换的部件组成,但这些部件不需要暴露为公开接口。模块可以有私有的 internal seams(内部 seam),也可以在公开接口处有 external seam(外部 seam)
  • 移除模块检验。 设想删掉该模块。如果复杂度也随之消失,它可能只是简单转发;如果复杂度会在多个调用方重复出现,这个模块就在承担有效职责。
  • 接口就是测试面。 调用方和测试都应通过同一个 seam 使用模块。如果测试必须绕过接口,模块边界可能设计得不合适。
  • 只有一个适配器时,seam 可能只是过度设计;出现两个适配器时,seam 才有明确价值。 只有确实需要替换实现时才引入 seam。

Read the full file on GitHub · 116 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 116 lines · 50 tokens per session scan A bc930c526b16

Subscribe to this mod's changes

codebase-design is a skill published in the GitHub repository VoidTechnology/voidtech-claude-plugins (2 stars, last pushed 28d ago), licensed Apache-2.0. It adds 50 tokens to every session and 1,539 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens