Improve Codebase Architecture logo

Improve Codebase Architecture

CommunityPopular
vinvcn
improve-codebase-architecture

扫描代码库中的深化机会,生成可视化 HTML 报告,然后围绕你选中的候选项继续追问。

Overview

Publishervinvcn
Repositorymattpocock-skills-zh-CN
Skill nameimprove-codebase-architecture
Stars
4.3K
Forks
347
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 vinvcn 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.
  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/vinvcn/mattpocock-skills-zh-CN.git /tmp/mattpocock-skills-zh-CN
mkdir -p .claude/skills
cp -r /tmp/mattpocock-skills-zh-CN/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.

Improve Codebase Architecture

暴露 architectural friction,并提出 deepening opportunities:把 shallow modules 变成 deep modules 的 refactors。目标是 testability 和 AI-navigability。

这个命令由项目的 domain model 提供信息,并建立在共享 design vocabulary 上:

  • 运行 /codebase-design skill,获取 architecture vocabulary(moduleinterfacedepthseamadapterleveragelocality)及其 principles(deletion test、"the interface is the test surface"、"one adapter = hypothetical seam, two = real")。每条建议都准确使用这些术语,不要漂移到 "component"、"service"、"API" 或 "boundary"。
  • CONTEXT.md 中的 domain language 会为好的 seams 命名;docs/adr/ 中的 ADRs 记录这个命令不应重新争论的 decisions。

Process

1. Explore

先划定扫描范围——YAGNI。 深化 module 的收益在于让未来修改更容易,因此要更关注最近仍在变化的 codebase 区域。开始探索前先决定去哪里看:

  • 如果用户点名了方向——module、subsystem 或 pain point——就按该方向探索,跳过下面的推断。
  • 否则,向前回看一段足够长的 commit history(git log --oneline),找出反复出现的 files 和 areas,让这些 hot spots 成为首要关注点。如果变更分散、没有明显 hot spot,再扩大范围。

先读取项目 domain glossary(CONTEXT.md)以及你将触碰区域的 ADRs。

然后 spawn 一个 sub-agent 来遍历 codebase。不要套死板 heuristics;自然探索,并记录你感到 friction 的地方:

  • 理解一个概念是否需要在许多小 modules 之间来回跳?
  • 哪些 modules 是 shallow 的,即 interface 几乎和 implementation 一样复杂?
  • 是否存在为了 testability 抽出的 pure functions,但真正 bugs 藏在它们如何被调用之处(没有 locality)?
  • 哪些 tightly-coupled modules 泄漏到了 seams 之外?
  • Codebase 的哪些部分未测试,或很难通过当前 interface 测试?

对任何你怀疑 shallow 的东西应用 deletion test:删除它会让复杂度集中,还是只把复杂度移动到别处?"yes, concentrates" 才是你要的 signal。

2. Present candidates as an HTML report

把 self-contained HTML file 写到 OS temp directory,避免任何内容落进 repo。Temp dir 从 $TMPDIR 解析,fallback 到 /tmp(Windows 用 %TEMP%),写到 <tmpdir>/architecture-review-<timestamp>.html,让每次运行都有新文件。为用户打开它:Linux 用 xdg-open <path>,macOS 用 open <path>,Windows 用 start <path>,并告诉用户 absolute path。

Report 使用 Tailwind via CDN 做 layout/styling,用 Mermaid via CDN 做能可靠传达结构的 diagrams。Mermaid 和手写 CSS/SVG visuals 可以混用:关系是 graph-shaped(call graphs、dependencies、sequences)时用 Mermaid;需要 editorial 表达(mass diagrams、cross-sections、collapse animations)时用手写 divs/SVG。每个 candidate 都要有 before/after visualisation。要视觉化。

每个 candidate 渲染一张 card,包含:

  • Files - 涉及哪些 files/modules
  • Problem - 当前 architecture 为什么造成 friction
  • Solution - 会改变什么,用 plain English 描述
  • Benefits - 用 locality 与 leverage 解释收益,以及 tests 如何改善
  • Before / After diagram - side-by-side,自绘,说明 shallowness 与 deepening
  • Recommendation strength - StrongWorth exploringSpeculative 之一,渲染为 badge

Report 末尾包含 Top recommendation section:你会先处理哪个 candidate,以及为什么。

CONTEXT.md vocabulary 表达 domain,用 /codebase-design vocabulary 表达 architecture。 如果 CONTEXT.md 定义了 "Order",就说 "Order intake module",不要说 "FooBarHandler",也不要说 "Order service"。

ADR conflicts:如果 candidate 与现有 ADR 冲突,只有在 friction 真实到值得重新打开 ADR 时才提出。Card 中明确标记(例如 warning callout:"contradicts ADR-0007 - but worth reopening because...")。不要列出 ADR 理论上禁止的每个 refactor。

完整 HTML scaffold、diagram patterns 和 styling guidance 见 HTML-REPORT.md

现在不要提出 interfaces。写完文件后问用户:"Which of these would you like to explore?"

3. Grilling loop

用户选中 candidate 后,运行 /grilling skill,与用户走完 decision tree:constraints、dependencies、deepened module 的形状、seam 后面放什么、哪些 tests 能保留。

Side effects 随 decisions 成形而内联发生;运行 /domain-modeling skill,让 domain model 保持最新:

  • 要用 CONTEXT.md 中不存在的概念命名 deepened module? 把 term 加入 CONTEXT.md。若文件不存在,按需创建。
  • 对话中打磨了 fuzzy term? 立即更新 CONTEXT.md
  • 用户以 load-bearing reason 拒绝了 candidate? 提议写 ADR,表述为:"Want me to record this as an ADR so future architecture reviews don't re-suggest it?" 只有当未来 explorer 确实需要该 reason 以避免再次提出同样建议时才提议;跳过临时原因("not worth it right now")和显而易见原因。
  • 想探索 deepened module 的 alternative interfaces? 运行 /codebase-design skill,并使用其中的 design-it-twice parallel sub-agent pattern。

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/vinvcn/mattpocock-skills-zh-CN/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 vinvcn 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 👇