codebase-design

codebase-design is a skill for Claude Code, Codex from asherzj/ashers-agent-skills. It costs 68 tokens per session (1,589 once invoked), scanned A, original, MIT.

A design vocabulary and set of principles for building deep modules: small interfaces that hide substantial behavior behind them. It explains concepts such as interfaces, implementations, seams, adapters, leverage, and locality.

In plain words
What is it for?
Use it when designing or refactoring modules, choosing where behavior should be replaceable, improving testability, or reviewing whether an interface hides enough implementation detail.
Why use it?
It gives developers consistent terms for deciding where code should change and how much behavior an interface should expose. This can make code easier to test, navigate, and maintain, but the input does not describe a specific automated tool.

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/asherzj/ashers-agent-skills/codebase-design
Any agent
npx skills add asherzj/ashers-agent-skills --skill codebase-design
Clone the repo
git clone --depth 1 https://github.com/asherzj/ashers-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for codebase-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/asherzj/ashers-agent-skills/codebase-design.svg)](https://agentmods.dev/skills/asherzj/ashers-agent-skills/codebase-design)
Your own site
<a href="https://agentmods.dev/skills/asherzj/ashers-agent-skills/codebase-design"><img src="https://agentmods.dev/badge/skills/asherzj/ashers-agent-skills/codebase-design.svg" alt="Measured on agentmods" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,589 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.00068 $0.01589
Opus 5 $0.00034 $0.00794
Sonnet 5 $0.00014 $0.00318
Haiku 4.5 $0.00007 $0.00159

Measured 3d ago against content hash 1ac671e7b4a6, 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 3d ago.

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.

coding/codebase-design/SKILL.md · 115 lines

How it starts

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

代码库设计

设计深模块(deep module):小接口背后藏大量行为,安放在干净的接缝(seam)处,可通过该接口测试。凡是在设计或重构代码之处,都使用这套语言和这些原则。目标是给调用方杠杆(leverage),给维护者局部性(locality),给所有人可测试性。

术语表

精确使用这些术语:不要换成"component""service""API"或"boundary"。语言保持一致正是全部意义所在。

模块(Module):任何拥有接口和实现的东西。刻意不区分规模:函数、类、包,或跨层的垂直切片(vertical slice)。避免:unit、component、service。

接口(Interface):调用方要正确使用该模块必须知道的一切:类型签名,以及不变量、顺序约束、错误模式、必需的配置和性能特征。避免:API、signature(太窄,它们只指类型层面的表面)。

实现(Implementation):模块内部的东西,它的代码本体。与**适配器(adapter)**相区别:一个东西可以是带大实现的小适配器(Postgres 仓储),也可以是带小实现的大适配器(内存 fake)。话题是接缝时用"adapter",否则用"implementation"。

深度(Depth):接口处的杠杆。调用方(或测试)每学习一单位接口所能调用的行为量。大量行为位于小接口之后时,模块是深的(deep);接口几乎与实现一样复杂时,是浅的(shallow)。

接缝(Seam)(Michael Feathers):无需在原地编辑即可改变行为的地方;模块接口所处的位置。接缝放在哪里,本身就是一个独立的设计决策,与它背后放什么无关。避免:boundary(与 DDD 的 bounded context 含义过载)。

适配器(Adapter):在接缝处满足某个接口的具体事物。描述的是角色(填补哪个槽位),而非实体(内部是什么)。

杠杆(Leverage):调用方从深度中获得的东西。每学习一单位接口,换来更多能力。一个实现可在 N 个调用点和 M 个测试中获得回报。

局部性(Locality):维护者从深度中获得的东西。变更、bug、知识和验证集中在一处,而不是散布到各调用方。修一次,处处修好。

深与浅

深模块 = 小接口 + 大量实现:

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

浅模块 = 大接口 + 少量实现(应避免):

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

设计接口时,问自己:

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

原则

  • 深度是接口的属性,不是实现的属性。 深模块内部可以由小的、可 mock、可替换的部件组成;只是它们不属于接口。模块除了接口处的外部接缝,还可以有内部接缝(私有于其实现,供它自己的测试使用)。
  • 删除测试(deletion test)。 想象删掉这个模块。如果复杂度随之消失,它就只是个直通层。如果复杂度在 N 个调用方身上重现,说明它物有所值。
  • 接口就是测试面。 调用方和测试穿越的是同一道接缝。如果你想越过接口去测,这个模块的形状多半不对。
  • 一个适配器意味着假想接缝。两个适配器才意味着真接缝。 除非真有东西跨接缝变化,否则不要引入接缝。

为可测试性设计

好的接口让测试自然而然:

  1. 接受依赖,不要创建依赖。

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

Read the full file on GitHub · 115 lines

Files

What ships with it

3 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. 3d ago First seen · 115 lines · 68 tokens per session scan A 1ac671e7b4a6

Subscribe to this mod's changes

codebase-design is a skill published in the GitHub repository asherzj/ashers-agent-skills (2 stars, last pushed 6d ago), licensed MIT. It adds 68 tokens to every session and 1,589 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

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 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