Agent skill

Codebase Design

by devcxl in devcxl/mattpocock-skills-zh

设计深度模块的共享词汇。当用户想要设计或改进模块的接口、寻找深化机会、决定 seam 的位置、让代码更可测试或更易被 AI 导航,或者其他 skill 需要深度模块词汇时使用。

MITAuto-check passedDevelopment

Install Codebase Design

skills CLI
$ npx skills add devcxl/mattpocock-skills-zh --skill codebase-design -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install devcxl/mattpocock-skills-zh codebase-design --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/devcxl/mattpocock-skills-zh.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/engineering/codebase-design .claude/skills/codebase-design && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
codebase-design
GitHub stars
433
Token cost
~809 tokens
SKILL.md length
151 words
Files
4
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

设计深度模块的共享词汇。当用户想要设计或改进模块的接口、寻找深化机会、决定 seam 的位置、让代码更可测试或更易被 AI 导航,或者其他 skill 需要深度模块词汇时使用。

  • Works in 3 steps: 接受依赖,不要创建依赖。 → 返回结果,不要产生副作用。 → 小表面积。 方法越少 = 需要的测试越少。参数越少 = 测试设置越简单。
  • Development work in your project
  • SKILL.md covers 词汇表, 深 vs 浅, 原则 and 设计可测试性, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Codebase Design is an agent skill from devcxl/mattpocock-skills-zh. 设计深度模块的共享词汇。当用户想要设计或改进模块的接口、寻找深化机会、决定 seam 的位置、让代码更可测试或更易被 AI 导航,或者其他 skill 需要深度模块词汇时使用。

Its SKILL.md is about 810 tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files (for example `DEEPENING.md`, `DESIGN-IT-TWICE.md` and `agents/openai.yaml`).

It sits in Development. The repository describes itself as: Matt Pocock 技能集的中文翻译版 — 地道中文,原汁原味的技术术语。基于 mattpocock/skills 复刻。每日中午12点钟同步. The licence is MIT.

When your agent uses it

  • Development work in your project

Example prompts

  • “/codebase-design”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. 接受依赖,不要创建依赖。
  2. 返回结果,不要产生副作用。
  3. 小表面积。 方法越少 = 需要的测试越少。参数越少 = 测试设置越简单。

What it can do on your machine

Read from SKILL.md and the folder at commit b72cc5b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Codebase Design loads about 809 tokens when it runs. Until then it costs about 26 tokens; SKILL.md has 151 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~26
When it runs · the whole SKILL.md, loaded when a task matches
~809

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from devcxl/mattpocock-skills-zh at commit b72cc5b, republished under its MIT licence (© devcxl). 151 words, ~809 tokens.

Download SKILL.mdSave it as .claude/skills/codebase-design/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
codebase-design
description
设计深度模块的共享词汇。当用户想要设计或改进模块的接口、寻找深化机会、决定 seam 的位置、让代码更可测试或更易被 AI 导航,或者其他 skill 需要深度模块词汇时使用。

Codebase Design

设计 深度模块(deep modules):一个小接口背后承载大量行为,放置在干净的 seam 处,通过该接口可测试。在设计和重构代码的任何地方,都使用这套语言和原则。目标是:对调用者而言是杠杆效应(leverage),对维护者而言是局部性(locality),对所有人而言是可测试性。

词汇表

精确使用以下术语 —— 不要替换为"组件"、"服务"、"API"或"边界"。使用一致的语言正是关键所在。

Module(模块) —— 任何具有接口和实现的东西。特意与规模无关:一个函数、类、包或跨层级切片。避免使用:单元、组件、服务。

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

Implementation(实现) —— 模块内部的内容,它的代码主体。与 Adapter(适配器) 不同:某个东西可以是一个小型适配器配大型实现(如 Postgres 仓库),也可以是一个大型适配器配小型实现(如内存中的假实现)。当讨论重点是 seam 时使用"adapter";否则使用"implementation"。

Depth(深度) —— 接口处的杠杆效应:调用者(或测试)每学习一个单位的接口就能调用的行为量。当一个模块在小型接口背后承载了大量行为时,它是 深的(deep);当接口几乎和实现一样复杂时,它是 浅的(shallow)。

Seam(接缝) (Michael Feathers) —— 可以在不修改某处的情况下改变行为的位置;模块接口所在的位置。seam 放在哪里本身就是一个设计决策,与它背后放什么不同。避免使用:边界(与 DDD 的限界上下文 overloaded)。

Adapter(适配器) —— 在 seam 处满足接口的具体实现。描述的是角色(它填充什么槽位),而非实质(内部是什么)。

Leverage(杠杆效应) —— 调用者从深度中获得的好处:每学习一个单位的接口就能获得更多能力。一次实现在 N 个调用点和 M 个测试中回报。

Locality(局部性) —— 维护者从深度中获得的好处:变更、缺陷、知识和验证集中在一个地方,而不是分散在调用者之间。一次修复,处处生效。

深 vs 浅

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

┌─────────────────────┐
│   小型接口           │  ← 少量方法,简单参数
├─────────────────────┤
│                     │
│  深度实现            │  ← 隐藏的复杂逻辑
│                     │
└─────────────────────┘

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

┌─────────────────────────────────┐
│       大型接口                   │  ← 大量方法,复杂参数
├─────────────────────────────────┤
│  薄实现                         │  ← 仅透传
└─────────────────────────────────┘

设计接口时,问自己:

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

原则

  • 深度是接口的属性,而不是实现的属性。 一个深度模块内部可以由小的、可 mock、可替换的部分组成 —— 它们只是不属于接口而已。一个模块可以有 内部 seam(对其实施私有的,由其自身测试使用)以及其接口处的 外部 seam。
  • 删除测试。 想象删除这个模块。如果复杂性消失了,它就是一个透传。如果复杂性在 N 个调用者之间重新出现,那么它是有价值的。
  • 接口就是测试面。 调用者和测试穿过同一个 seam。如果你想测试越过接口,那模块的形状可能有问题。
  • 一个适配器意味着一个假设的 seam。两个适配器意味着一个真实的 seam。 除非有东西实际在 seam 处变化,否则不要引入 seam。

设计可测试性

好的接口让测试变得自然:

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

    typescript
    // 可测试
    function processOrder(order, paymentGateway) {}
    
    // 难以测试
    function processOrder(order) {
      const gateway = new StripeGateway();
    }
  2. 返回结果,不要产生副作用。

    typescript
    // 可测试
    function calculateDiscount(cart): Discount {}
    
    // 难以测试
    function applyDiscount(cart): void {
      cart.total -= discount;
    }
  3. 小表面积。 方法越少 = 需要的测试越少。参数越少 = 测试设置越简单。

关系

  • Module 有且只有一个 Interface(它呈现给调用者和测试的表面)。
  • Depth 是 Module 的一个属性,相对于其 Interface 衡量。
  • Seam 是 Module 的 Interface 所在的位置。
  • Adapter 位于 Seam 处,满足 Interface。
  • Depth 为调用者产生 Leverage,为维护者产生 Locality。

被否定的框架

  • 深度作为实现行数与接口行数的比率(Ousterhout):奖励填充实现。我们使用深度即杠杆效应(depth-as-leverage)来代替。
  • "Interface" 作为 TypeScript 的 interface 关键字或类的 public 方法:过于狭隘 —— 这里的 interface 包含调用者必须知道的每一个事实。
  • "Boundary":与 DDD 的限界上下文 overloaded。请说 seam 或 interface。

深入阅读

  • 给定依赖关系深化一个集群 —— 见 DEEPENING.md:依赖分类、seam 纪律和替换而非分层测试。
  • 探索备选接口 —— 见 DESIGN-IT-TWICE.md:启动并行的子 agent 以多种截然不同的方式设计接口,然后在深度、局部性和 seam 放置方面进行比较。

© devcxl, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files in skills/engineering/codebase-design of devcxl/mattpocock-skills-zh.

  • SKILL.md
  • DEEPENING.md
  • DESIGN-IT-TWICE.md
  • agents/openai.yaml

Open the folder on GitHubat commit b72cc5b

Compare with similar skills

Codebase Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Codebase Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Codebase Design this skilldevcxl/mattpocock-skills-zh433—~809Automated safety check: PassMIT
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Typescript Advanced Typesrolling-scopes/rsschool-app10k24 repos~4.2kAutomated safety check: PassMPL-2.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT
Greplooponyx-dot-app/onyx32k4 repos~3.3kAutomated safety check: PassMIT

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 24 repos~4.2k tokens
    DevelopmentAuto-check passed
  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Greploop

    onyx-dot-app/onyx

    Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.

    32k GitHub starsUsed in 4 repos~3.3k tokens
    DevelopmentAuto-check passed
  • Guidelines

    akash-network/node

    Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.

    1.1k GitHub starsUsed in 22 repos~577 tokens
    DevelopmentAuto-check passed

More from devcxl/mattpocock-skills-zh

All 20 skills in this repo
  • Triage

    devcxl/mattpocock-skills-zh

    将 issue 和外部 PR 推过一组分诊角色的状态机——分类、验证、必要时盘问,并写出 agent 就绪的任务简报. An agent skill from devcxl/mattpocock-skills-zh.

    433 GitHub starsUsed in 1 repo~816 tokens
    Auto-check passed
  • Git Guardrails Claude Code

    devcxl/mattpocock-skills-zh

    设置 Claude Code 钩子,在危险 Git 命令(push、reset --hard、clean、branch -D 等)执行前将其拦截。当用户想要防止破坏性 Git 操作、添加 Git 安全钩子或在 Claude Code 中阻止 git push/reset 时使用。

    433 GitHub stars~420 tokensUpdated yesterday
    Auto-check passed
  • Diagnosing Bugs

    devcxl/mattpocock-skills-zh

    针对棘手 bug 和性能回归的诊断循环。当用户说"诊断"/"调试这个",或报告某处崩溃/报错/不正常/缓慢时使用. An agent skill from devcxl/mattpocock-skills-zh.

    433 GitHub stars~958 tokensUpdated yesterday
    Auto-check passed
  • Domain Modeling

    devcxl/mattpocock-skills-zh

    构建和完善项目的领域模型。当讨论代码库术语、编写或编辑 GLOSSARY.md,或记录或编辑 ADR 时使用. An agent skill from devcxl/mattpocock-skills-zh.

    433 GitHub stars~412 tokensUpdated yesterday
    Auto-check passed
  • Migrate To Shoehorn

    devcxl/mattpocock-skills-zh

    将测试文件从 as 类型断言迁移到 @total-typescript/shoehorn。当用户提到 shoehorn、想要在测试中替换 as、或需要部分测试数据时使用。

    433 GitHub stars~522 tokensUpdated yesterday
    Auto-check passed
  • Scaffold Exercises

    devcxl/mattpocock-skills-zh

    创建包含 section、problem、solution 和 explainer 的练习目录结构,且能通过 lint 检查。当用户想要搭建练习框架、创建练习模板或设置新的课程章节时使用。

    433 GitHub stars~659 tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Codebase Design

What does Codebase Design do?

设计深度模块的共享词汇。当用户想要设计或改进模块的接口、寻找深化机会、决定 seam 的位置、让代码更可测试或更易被 AI 导航,或者其他 skill 需要深度模块词汇时使用。. Codebase Design is an agent skill from devcxl/mattpocock-skills-zh.

When should I use Codebase Design?

Codebase Design fits situations like: development work in your project.

How do I install Codebase Design in Claude Code?

Run `npx skills add devcxl/mattpocock-skills-zh --skill codebase-design -a claude-code`. Or copy the skill folder (skills/engineering/codebase-design in devcxl/mattpocock-skills-zh) into .claude/skills/codebase-design in your project. Claude Code loads it when a task matches its description.

How do I install Codebase Design in Codex?

Run `npx skills add devcxl/mattpocock-skills-zh --skill codebase-design -a codex`. Or copy the skill folder (skills/engineering/codebase-design in devcxl/mattpocock-skills-zh) into .agents/skills/codebase-design in your project. Codex loads it when a task matches its description.

Can I use Codebase Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add devcxl/mattpocock-skills-zh --skill codebase-design -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/codebase-design, .gemini/skills/codebase-design, .github/skills/codebase-design and .opencode/skills/codebase-design in your project.

What does Codebase Design need to run?

SKILL.md names no scripts, command-line tools or credentials: Codebase Design is instructions for the agent only.

Does Codebase Design access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Codebase Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Codebase Design use?

Codebase Design is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Codebase Design use?

About 809 tokens (SKILL.md is roughly 3.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Codebase Design?

Skills that share tags, products or a category with Codebase Design: Finishing a Development Branch (obra/superpowers, 296k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars), PR Babysitter (openinterpreter/openinterpreter, 69k stars) and Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Codebase Design?

devcxl (a GitHub user) maintains it in devcxl/mattpocock-skills-zh, which has 433 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 5, 2026.

Source: devcxl/mattpocock-skills-zh on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.