Improve Codebase Architecture logo

Improve Codebase Architecture

Community
WenWuZhiDao
improve-codebase-architecture

扫描代码库寻找深化机会,以可视化 HTML 报告呈现,然后就你挑选的那个进行拷问。

Overview

PublisherWenWuZhiDao
Repositorymattpocock-skills-zh
Skill nameimprove-codebase-architecture
Stars
30
Forks
5
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by WenWuZhiDao on GitHub. Read the source before you install it.

Installation

Install the Improve Codebase Architecture AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/WenWuZhiDao/mattpocock-skills-zh/tree/main/skills/engineering/improve-codebase-architecture
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/WenWuZhiDao/mattpocock-skills-zh.git /tmp/mattpocock-skills-zh
mkdir -p .claude/skills
cp -r /tmp/mattpocock-skills-zh/skills/engineering/improve-codebase-architecture .claude/skills/improve-codebase-architecture
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Improve Codebase Architecture in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Improve Codebase Architecture on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Improve Codebase Architecture is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

改进代码库架构

浮现架构摩擦,并提出深化机会——把浅模块变成深模块的重构。目标是可测试性和 AI 可导航性。

这条命令受项目领域模型的启发,并建立在一套共享的设计词汇之上:

  • 运行 /codebase-design 技能获取架构词汇(模块、接口、深度、接缝、适配器、杠杆、局部性)及其原则(删除测试、「接口就是测试面」、「一个适配器 = 假想的接缝,两个 = 真实的接缝」)。在每条建议里都精确使用这些术语——不要漂移到「组件」、「服务」、「API」或「边界」。
  • CONTEXT.md 里的领域语言给好接缝命名;docs/adr/ 里的 ADR 记录了这条命令不应重新翻案的决策。

流程

1. 探索

扫描之前先界定范围——YAGNI。 深化一个模块的回报,来自让它未来的改动更容易,所以对代码库中近期改动过的部分给予额外权重。在看之前先决定往哪看:

  • 如果用户指定了一个方向——一个模块、一个子系统、一个痛点——就采用它,跳过下面的推断。
  • 否则,往回走一大段 commit 历史(git log --oneline),找出代码库的热点——那些反复出现的文件和区域——让这些路径先吸引你的注意力。如果改动零散、没有明显热点,就把网撒得更宽。

先读项目的领域词汇表(CONTEXT.md)以及你正在触碰的区域里的任何 ADR。

然后派发一个子 agent 走一遍代码库。不要遵循僵硬的启发式——有机地探索,并记下你在哪里感到摩擦:

  • 在哪里理解一个概念需要在许多小模块之间来回跳?
  • 在哪里模块是浅的——接口几乎和实现一样复杂?
  • 在哪里纯函数只是为了可测试性而被提取出来,但真正的 bug 藏在它们如何被调用之中(没有局部性)?
  • 在哪里紧耦合的模块跨越它们的接缝泄漏?
  • 代码库的哪些部分未经测试,或难以通过其当前接口测试?

对任何你怀疑是浅的东西施加删除测试:删掉它会让复杂度集中,还是只是把它挪走?「会,会集中」就是你想要的信号。

2. 以 HTML 报告呈现候选项

把一个自包含的 HTML 文件写到操作系统临时目录,这样什么都不会落进仓库。从 $TMPDIR 解析临时目录,回退到 /tmp(或 Windows 上的 %TEMP%),并写入 <tmpdir>/architecture-review-<timestamp>.html,这样每次运行都得到一个新文件。为用户打开它——Linux 上 xdg-open <path>、macOS 上 open <path>、Windows 上 start <path>——并告诉他们绝对路径。

报告用 Tailwind via CDN 做布局和样式,用 Mermaid via CDN 在图/流程/时序能可靠传达结构的地方画图。把 Mermaid 与手工打造的 CSS/SVG 视觉元素混用——当关系是图状的(调用图、依赖、时序)时用 Mermaid,当你想要更有编辑意味的东西(体量图、剖面图、坍缩动画)时用手工搭的 div/SVG。每个候选项都配一张前后对比可视化。要有视觉表现力。

为每个候选项渲染一张卡片,包含:

  • 文件 — 涉及哪些文件/模块
  • 问题 — 为什么当前架构在造成摩擦
  • 方案 — 用平实的英语描述会改变什么
  • 收益 — 用局部性和杠杆来解释,以及测试会如何改善
  • 前 / 后 图 — 并排、自定义绘制,说明浅处和深化
  • 推荐强度 — Strong、Worth exploring、Speculative 三者之一,渲染成一个徽章

以一个 Top recommendation 段落收尾报告:你会先着手哪个候选项以及为什么。

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

ADR 冲突:如果一个候选项与现有 ADR 相抵触,只在摩擦真实到值得重新审视该 ADR 时才浮现它。在卡片里清楚标出(例如一个警告标注:「与 ADR-0007 相抵触——但值得重开,因为……」)。不要罗列一条 ADR 所禁止的每一个理论上的重构。

参见 HTML-REPORT.md 了解完整的 HTML 脚手架、图表模式和样式指南。

现在还不要提出接口。文件写好后,问用户:「这些里面你想探索哪一个?」

3. 拷问循环

一旦用户挑好一个候选项,运行 /grilling 技能与他们一起走一遍决策树——约束、依赖、深化后模块的形状、接缝背后是什么、哪些测试能存活。

副作用随着决策结晶而就地发生——运行 /domain-modeling 技能,让领域模型随进展保持最新:

  • 要用一个不在 CONTEXT.md 里的概念给深化后的模块命名? 把这个术语加进 CONTEXT.md。文件不存在就懒创建。
  • 在对话中磨锐了一个模糊的术语? 当场更新 CONTEXT.md。
  • 用户以一个起承重作用的理由拒绝了该候选项? 提出记一条 ADR,措辞为:「要我把这个记成一条 ADR,好让未来的架构审查不再重新提议它吗?」 只在这个理由确实会被未来的探索者用来避免重新提议同一件事时才提出——跳过一次性的理由(「现在不值得」)和不言自明的理由。
  • 想为深化后的模块探索备选接口? 运行 /codebase-design 技能,使用它的「设计两遍」并行子 agent 模式。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Improve Codebase Architecture AI skill do?

扫描代码库寻找深化机会,以可视化 HTML 报告呈现,然后就你挑选的那个进行拷问。

Why use Improve Codebase Architecture on TypingMind?

Because you install it once and use it with any model. Improve Codebase Architecture is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Improve Codebase Architecture in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/WenWuZhiDao/mattpocock-skills-zh/tree/main/skills/engineering/improve-codebase-architecture. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Improve Codebase Architecture?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Improve Codebase Architecture?

As many as you like. As long as a model supports skills, you can use Improve Codebase Architecture with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Improve Codebase Architecture AI skill free?

Yes. It is published on GitHub by WenWuZhiDao under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇