codebase-design-zh

codebase-design-zh is a skill for Claude Code, Codex from gongyijie85/mattpocock-skills-dsh-zh. It costs 70 tokens per session (1,624 once invoked), scanned A, original, MIT.

A set of design principles for creating modules with small interfaces and substantial behaviour behind them. It explains terms such as interface, implementation, adapter, and seam in plain terms for this design approach.

In plain words
What is it for?
Use it when designing or refactoring modules, choosing seams, improving testability, or making code easier for people and coding agents to understand.
Why use it?
It gives a shared vocabulary for making code easier to test, change, and navigate. It helps developers decide where a change can be made without editing the code behind it.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it when designing or refactoring modules, choosing seams, improving testability, or making code easier for people and coding agents to understand.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/gongyijie85/mattpocock-skills-dsh-zh/codebase-design-zh
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.

Any agent
npx skills add gongyijie85/mattpocock-skills-dsh-zh --skill codebase-design-zh
Clone the repo
git clone --depth 1 https://github.com/gongyijie85/mattpocock-skills-dsh-zh

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-zh

README.md
[![agentmods](https://agentmods.dev/badge/skills/gongyijie85/mattpocock-skills-dsh-zh/codebase-design-zh/github.svg)](https://agentmods.dev/skills/gongyijie85/mattpocock-skills-dsh-zh/codebase-design-zh)
Your own site
<a href="https://agentmods.dev/skills/gongyijie85/mattpocock-skills-dsh-zh/codebase-design-zh"><img src="https://agentmods.dev/badge/skills/gongyijie85/mattpocock-skills-dsh-zh/codebase-design-zh/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for codebase-design-zh

Your own site · 80×15
<a href="https://agentmods.dev/skills/gongyijie85/mattpocock-skills-dsh-zh/codebase-design-zh"><img src="https://agentmods.dev/badge/skills/gongyijie85/mattpocock-skills-dsh-zh/codebase-design-zh.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,624 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00070 $0.01624
Opus 5 $0.00035 $0.00812
Sonnet 5 $0.00014 $0.00325
Haiku 4.5 $0.00007 $0.00162

Measured yesterday against content hash 843170349e75, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

codebase-design-zh 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.

skills/codebase-design-zh/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.

Codebase Design

设计 deep modules(深模块):在干净的 seam 上,用一个小 interface 承载大量行为,并且可以通过这个 interface 进行测试。在任何设计或重构代码的地方,使用这套语言和这些原则。目标是让调用者获得 leverage(杠杆效应)、维护者获得 locality(局部性),所有人都获得可测试性。

Glossary(词汇表)

精确使用这些术语 — 不要用 "component"、"service"、"API" 或 "boundary" 来替代。一致的语言正是全部意义所在。

Module(模块) — 任何拥有 interface 和 implementation 的东西。刻意与规模无关:一个函数、类、包,或跨层级的切片。避免使用:unit、component、service。

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

Implementation(实现) — 模块内部的东西,它的代码主体。与 Adapter(适配器) 不同:一个东西可以是小的 adapter 配大的 implementation(一个 Postgres repo),也可以是大的 adapter 配小的 implementation(一个内存中的 fake)。当讨论的主题是 seam 时用 "adapter";否则用 "implementation"。

Depth(深度) — interface 处的 leverage:调用者(或测试)每学习一单位 interface 所能驱动的行为量。当大量行为位于小 interface 之后时,模块是 deep(深的);当 interface 几乎和 implementation 一样复杂时,它是 shallow(浅的)

Seam(接缝) (Michael Feathers) — 一个无需在该处编辑就能改变行为的地方;模块 interface 所在的位置。把 seam 放在哪里本身就是一个设计决策,与放在它后面的是什么不同。避免使用:boundary(与 DDD 的 bounded context 一词多义)。

Adapter(适配器) — 在 seam 处满足 interface 的具体东西。描述的是角色(它填补哪个槽位),而不是实质(里面是什么)。

Leverage(杠杆效应) — 调用者从 depth 中得到的东西:每学习一单位 interface 获得更多能力。一份 implementation 在 N 个调用点和 M 个测试中回报。

Locality(局部性) — 维护者从 depth 中得到的东西:变更、bug、知识和验证集中在一个地方,而不是分散在调用者之间。修复一次,处处修复。

深 vs 浅

Deep module(深模块) = 小 interface + 大量 implementation:

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

Shallow module(浅模块) = 大 interface + 少量 implementation(避免):

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

设计 interface 时,问自己:

  • 我能减少方法的数量吗?
  • 我能简化参数吗?
  • 我能把更多复杂性藏到里面吗?

原则

  • Depth 是 interface 的属性,而不是 implementation 的属性。 一个 deep module 内部可以由小的、可 mock 的、可替换的部件组成 — 它们只是不属于 interface。模块既可以有 internal seams(内部接缝)(implementation 私有,由其自身测试使用),也可以有位于 interface 处的 external seam(外部接缝)
  • 删除测试(Deletion test)。 想象删除这个模块。如果复杂性随之消失,它只是一个 pass-through(传声筒)。如果复杂性在 N 个调用者那里重新出现,它就是在自食其力。
  • Interface 就是测试面。 调用者和测试穿过同一个 seam。如果你想越过 interface 测试,这个模块的形状很可能不对。
  • 一个 adapter 意味着假想的 seam;两个 adapter 意味着真实的 seam。 除非有东西真的跨 seam 变化,否则不要引入 seam。

Read the full file on GitHub · 115 lines

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 · 115 lines · 70 tokens per session scan A 843170349e75

Subscribe to this mod's changes

codebase-design-zh is a skill published in the GitHub repository gongyijie85/mattpocock-skills-dsh-zh (5 stars, last pushed yesterday), licensed MIT. It adds 70 tokens to every session and 1,624 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-09-11.

Related

Other skills, from other repositories

test-first

A test-first development guide, where tests are written before the code they check. TDD, or test-driven development, means first writing a test that fails, then writing the simplest code that makes it pass.

pingfanfan/hello-dsh · 48 tokens

delivery-proof

Delivery proof and the doublecheck report. Use when the work is done and the delivery must be proven — consolidate the spec, test timeline, review verdicts, and verification checks into a doublecheckreport, and only then claim completion.

PerryLink/dsh-doublecheck · 50 tokens

red-green-tdd

Red/green test discipline for implementation work. Use once a doublecheck spec is on record and implementation is about to start — write a test that fails for the missing behavior, run it to see it fail (red), make the change, run again to see it pass (green).

PerryLink/dsh-doublecheck · 62 tokens

code2skill-review-flow

A read-only reviewer for the main user flows in a package generated by Code2Skill. It checks whether representative paths are basically usable, without proving that every source-code detail is included.

leechen298/Code2Skill · 32 tokens

dev-qa

A development and quality process for building software, testing it, and checking it for security problems. It separates implementation, quality assurance, and security review while coordinating their handoffs.

songoao25/dsh-virtual-product-team · 50 tokens

market-pre-push-checks

Use before pushing, merging, or claiming a green tree in dsh-agent-plugins-market, to select the smallest checks that cover the outgoing diff instead of reflexively running the full suite.

Sivan757/dsh-agent-plugins-market · 45 tokens