Agent skill

Improve Codebase Architecture

by devcxl in devcxl/mattpocock-skills-zh

扫描代码库寻找深化机会,以可视化的 HTML 报告呈现,然后对你选中的方案进行盘问. An agent skill from devcxl/mattpocock-skills-zh.

MITAuto-check passedDevelopment

Install Improve Codebase Architecture

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

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

GitHub CLI
$ gh skill install devcxl/mattpocock-skills-zh improve-codebase-architecture --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/improve-codebase-architecture .claude/skills/improve-codebase-architecture && 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
improve-codebase-architecture
GitHub stars
437
Token cost
~747 tokens
SKILL.md length
199 words
Files
3
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

扫描代码库寻找深化机会,以可视化的 HTML 报告呈现,然后对你选中的方案进行盘问. An agent skill from devcxl/mattpocock-skills-zh.

  • Works in 3 steps: 探索 → 将候选方案呈现为 HTML 报告 → 盘问循环
  • Development work in your project
  • Calls git

What it does

Improve Codebase Architecture is an agent skill from devcxl/mattpocock-skills-zh. 扫描代码库寻找深化机会,以可视化的 HTML 报告呈现,然后对你选中的方案进行盘问。

Its SKILL.md is about 750 tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files (for example `HTML-REPORT.md` and `agents/openai.yaml`).

It sits in Development. It works with Mermaid. 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

  • “/improve-codebase-architecture”

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. 探索
  2. 将候选方案呈现为 HTML 报告
  3. 盘问循环

What it can do on your machine

Read from SKILL.md and the folder at commit 15ac33e. 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

    Shell commands in SKILL.md call:

    • git

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

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    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

Improve Codebase Architecture loads about 747 tokens when it runs. Until then it costs about 18 tokens; SKILL.md has 199 words of instructions outside code blocks.

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

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 15ac33e, republished under its MIT licence (© devcxl). 199 words, ~747 tokens.

Download SKILL.mdSave it as .claude/skills/improve-codebase-architecture/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
improve-codebase-architecture
description
扫描代码库寻找深化机会,以可视化的 HTML 报告呈现,然后对你选中的方案进行盘问。
disable-model-invocation
true

改进代码库架构

揭示架构摩擦点并提出深化机会——将浅层 module 转变为深层 module 的重构。目标是可测试性和 AI 可导航性。

本命令参考项目的领域模型,并基于共享的设计词汇:

  • 调用 Skill 工具并传入 "codebase-design" 获取架构词汇(module、interface、depth、seam、adapter、leverage、locality)及其原则(deletion test、"interface 就是 test surface"、"一个 adapter = 假设性 seam,两个 = 真实的")。在每个建议中严格使用这些术语——不要偏离到 "component"、"service"、"API" 或 "boundary"。
  • GLOSSARY.md 中的领域语言为好的 seam 提供了命名;docs/adr/ 中的 ADR 记录了本命令不应重新讨论的决策。

流程

1. 探索

先确定范围再扫描——YAGNI。 加深一个模块的回报在于使未来对该模块的修改更容易,因此对最近变更的代码区域给予额外权重。在查看之前先决定看哪里:

  • 如果用户指定了方向——一个模块、一个子系统、一个痛点——就采用它,并跳过下面的推断步骤。
  • 否则,回顾一段较长的提交历史(git log --oneline)来找到代码库的热点——那些反复出现的文件和区域——让这些路径首先吸引你的注意力。如果变更分散,没有明确的热点,就扩大范围。

首先阅读项目的领域术语表(GLOSSARY.md)以及你将要接触的区域内任何 ADR。

然后生成一个子代理来遍历代码库。不要遵循僵化的启发式规则——有机地探索,并记录你在哪里遇到了摩擦:

  • 在哪些地方,理解一个概念需要在多个小模块之间来回跳转?
  • 哪些 module 是shallow的——interface 几乎和 implementation 一样复杂?
  • 哪些地方纯粹为了可测试性而提取了纯函数,但真正的 bug 却隐藏在它们的调用方式中(缺乏 locality)?
  • 哪些紧密耦合的 module 跨越了它们的 seam?
  • 代码库的哪些部分未经测试,或难以通过当前 interface 进行测试?

对你怀疑是 shallow 的任何内容应用deletion test:删除它会集中复杂性,还是仅仅移动它?"集中了"就是你想要的信号。

2. 将候选方案呈现为 HTML 报告

编写一个自包含的 HTML 文件到 OS 临时目录,这样不会在仓库中留下任何文件。从 $TMPDIR 解析临时目录,回退到 /tmp(在 Windows 上为 %TEMP%),并写入 <tmpdir>/architecture-review-<timestamp>.html,这样每次运行都会得到一个新文件。为用户打开它——Linux 上使用 xdg-open <path>,macOS 上使用 open <path>,Windows 上使用 start <path>——并告知用户绝对路径。

报告使用 Tailwind(通过 CDN) 进行布局和样式,并使用 Mermaid(通过 CDN) 绘制图表,在图形/流程/序列能可靠传达结构的地方使用。将 Mermaid 与手工制作的 CSS/SVG 视觉元素混合使用——当关系是图形形状时(调用图、依赖关系、序列)使用 Mermaid,当你想要更具编辑性的效果时(mass 图、截面图、折叠动画)使用手工构建的 div/SVG。每个候选方案都要有前后对比可视化。要有视觉冲击力。

每个候选方案渲染一张卡片,包含:

  • 文件——涉及哪些文件/module
  • 问题——当前架构为何造成摩擦
  • 方案——用通俗语言描述会发生什么变化
  • 收益——用 locality 和 leverage 的术语解释,以及测试会如何改进
  • 前后对比图——并排展示,自定义绘制,说明 shallowness 和 deepening 效果
  • 推荐强度——Strong(强烈推荐)、Worth exploring(值得探索)、Speculative(推测性),渲染为 badge

报告以最佳推荐部分结尾:你会先处理哪个候选方案以及原因。

对 GLOSSARY.md 使用领域词汇,对架构使用 /codebase-design 词汇。 如果 GLOSSARY.md 定义了 "Order",就说 "Order intake module"——而不是 "FooBarHandler",也不是 "Order service"。

ADR 冲突:如果某个候选方案与现有 ADR 矛盾,仅当摩擦确实严重到值得重新审视 ADR 时才提出来。在卡片中明确标注(例如警告提示:"与 ADR-0007 矛盾——但值得重新讨论,因为……")。不要列出 ADR 禁止的每个理论上的重构。

参见 HTML-REPORT.md 获取完整的 HTML 脚手架、图表模式及样式指导。

在写入文件后,先不要提出 interface。 询问用户:"你想探索哪个方案?"

3. 盘问循环

一旦用户选中一个候选方案,调用 Skill 工具并传入 "grilling" 与他们一起遍历决策树——约束条件、依赖关系、deepened module 的形状、seam 背后是什么、哪些测试能够存活。

副作用在决策明确时即时产生——调用 Skill 工具并传入 "domain-modeling" 以保持领域模型的最新状态:

  • 将一个 deepened module 命名为 GLOSSARY.md 中不存在的概念? 将该术语添加到 GLOSSARY.md。如果文件不存在,延迟创建。
  • 在对话过程中澄清了一个模糊的术语? 立即更新 GLOSSARY.md。
  • 用户因一个重要原因拒绝了候选方案? 提议创建一个 ADR,措辞为:"需要我将此记录为 ADR,以便未来的架构审查不再重新提出此建议吗?" 只有当原因确实对未来探索者避免重复提出相同建议有实际帮助时才提出——跳过临时性原因("现在不值得做")和自明的原因。
  • 想探索 deepened module 的替代 interface? 调用 Skill 工具并传入 "codebase-design" 并使用其 design-it-twice 并行子代理模式。

© 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 2 other files in skills/engineering/improve-codebase-architecture of devcxl/mattpocock-skills-zh.

  • SKILL.md
  • HTML-REPORT.md
  • agents/openai.yaml

Open the folder on GitHubat commit 15ac33e

Compare with similar skills

Improve Codebase Architecture 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.

Improve Codebase Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Improve Codebase Architecture this skilldevcxl/mattpocock-skills-zh437—~747Automated safety check: PassMIT
Archify Diagramstt-a1i/archify79k—~2.9kAutomated safety check: PassMIT
Diagram Designcathrynlavery/diagram-design45k1 repos~7.5kAutomated safety check: PassMIT
Draw.io Diagram StudioAgents365-ai/drawio-skill10k—~2.4kAutomated safety check: NotesMIT
Code Graph Mermaid Diagramstrailofbits/skills7.4k1 repos~1.7kAutomated safety check: PassCC-BY-SA-4.0
Pretty Mermaid Rendererimxv/Pretty-mermaid-skills1.5k—~2kAutomated safety check: PassMIT

Similar skills

  • Archify Diagrams

    tt-a1i/archify

    Creates interactive architecture, workflow, sequence, data-flow and lifecycle diagrams as standalone HTML with inline SVG, themes and image or video export.

    79k GitHub stars~2.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Diagram Design

    cathrynlavery/diagram-design

    Creates branded diagrams, from architecture, flowchart and sequence to charts and maps, as self-contained HTML with inline SVG, with import from draw.io, Mermaid and Excalidraw.

    45k GitHub starsUsed in 1 repo~7.5k tokens
    DevelopmentAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated 6 days ago
    DevelopmentAuto-check: notes
  • Code Graph Mermaid Diagrams

    trailofbits/skills

    Official

    Generates Mermaid diagrams from Trailmark code graphs, including call graphs, class hierarchies, module dependency maps, complexity heatmaps and attack surface data flows.

    7.4k GitHub starsUsed in 1 repo~1.7k tokens
    DevelopmentAuto-check passed
  • Pretty Mermaid Renderer

    imxv/Pretty-mermaid-skills

    Writes and renders Mermaid diagrams as themed SVG, PNG or terminal ASCII and Unicode art with a bundled Node.js CLI that needs no browser.

    1.5k GitHub stars~2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Archify Diagram Builder

    Unclecheng-li/AI_Animation

    Builds validated architecture, workflow, sequence, data-flow and lifecycle diagrams as standalone interactive HTML from a small JSON spec, with optional motion and image export.

    1.5k GitHub starsUsed in 2 repos~4.1k tokens
    DevelopmentAuto-check passed

More from devcxl/mattpocock-skills-zh

All 19 skills in this repo
  • Git Guardrails Claude Code

    devcxl/mattpocock-skills-zh

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

    437 GitHub starsUsed in 1 repo~420 tokens
    Auto-check passed
  • Triage

    devcxl/mattpocock-skills-zh

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

    437 GitHub starsUsed in 1 repo~816 tokens
    Auto-check passed
  • Codebase Design

    devcxl/mattpocock-skills-zh

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

    437 GitHub stars~809 tokensUpdated today
    Auto-check passed
  • Diagnosing Bugs

    devcxl/mattpocock-skills-zh

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

    437 GitHub stars~973 tokensUpdated today
    Auto-check passed
  • Domain Modeling

    devcxl/mattpocock-skills-zh

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

    437 GitHub stars~412 tokensUpdated today
    Auto-check passed
  • Migrate To Shoehorn

    devcxl/mattpocock-skills-zh

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

    437 GitHub stars~522 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Improve Codebase Architecture

What does Improve Codebase Architecture do?

扫描代码库寻找深化机会,以可视化的 HTML 报告呈现,然后对你选中的方案进行盘问. An agent skill from devcxl/mattpocock-skills-zh. Improve Codebase Architecture is an agent skill from devcxl/mattpocock-skills-zh.

When should I use Improve Codebase Architecture?

Improve Codebase Architecture fits situations like: development work in your project.

How do I install Improve Codebase Architecture in Claude Code?

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

How do I install Improve Codebase Architecture in Codex?

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

Can I use Improve Codebase Architecture 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 improve-codebase-architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/improve-codebase-architecture, .gemini/skills/improve-codebase-architecture, .github/skills/improve-codebase-architecture and .opencode/skills/improve-codebase-architecture in your project.

What does Improve Codebase Architecture need to run?

Going by SKILL.md and its folder, Improve Codebase Architecture needs the command-line tools its instructions call (git).

Does Improve Codebase Architecture access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Improve Codebase Architecture 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 Improve Codebase Architecture use?

Improve Codebase Architecture 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 Improve Codebase Architecture use?

About 747 tokens (SKILL.md is roughly 3k 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 Improve Codebase Architecture?

Skills that share tags, products or a category with Improve Codebase Architecture: Archify Diagrams (tt-a1i/archify, 79k stars), Diagram Design (cathrynlavery/diagram-design, 45k stars), Draw.io Diagram Studio (Agents365-ai/drawio-skill, 10k stars) and Code Graph Mermaid Diagrams (trailofbits/skills, 7.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Improve Codebase Architecture?

devcxl (a GitHub user) maintains it in devcxl/mattpocock-skills-zh, which has 437 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 7, 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.