improve-codebase-architecture

improve-codebase-architecture is a skill for Claude Code, Codex from vinvcn/mattpocock-skills-zh-CN. It costs 35 tokens per session (1,385 once invoked), scanned A, original, MIT.

A skill that scans a codebase for places where restructuring could make future changes and testing easier, then produces an HTML report for selected improvements.

In plain words
What is it for?
Use it to investigate architectural friction, find promising refactoring opportunities, and discuss chosen improvements with the coding agent.
Why use it?
It helps identify code areas that are difficult to understand or modify because their responsibilities are spread across too many shallow modules.

Skill for Claude CodeCodex

Written for Claude Code and Codex: disable-model-invocation in frontmatter, but also agents/openai.yaml present. Also seen: mentions subagents.

Part of the mattpocock-skills plugin — 36 skills shipped together

Good fit Use it to investigate architectural friction, find promising refactoring opportunities, and discuss chosen improvements with the coding agent.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vinvcn/mattpocock-skills-zh-cn/improve-codebase-architecture
About the project

mattpocock-skills-zh-CN is a Simplified Chinese localization of a collection of reusable instructions for coding agents. Chinese-speaking developers use the translated skills to support engineering workflows while keeping their original commands, paths, identifiers, and behavior. The catalogue contains the localized skills, instructions, and plugin components.

vinvcn/mattpocock-skills-zh-CN · 4,114 stars · on GitHub

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 vinvcn/mattpocock-skills-zh-CN --skill improve-codebase-architecture
Clone the repo
git clone --depth 1 https://github.com/vinvcn/mattpocock-skills-zh-CN

Made for: Claude Code, Codex.

Or install mattpocock-skills, the plugin that ships this one along with the rest of its 36 skills.

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 improve-codebase-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/vinvcn/mattpocock-skills-zh-cn/improve-codebase-architecture/github.svg)](https://agentmods.dev/skills/vinvcn/mattpocock-skills-zh-cn/improve-codebase-architecture)
Your own site
<a href="https://agentmods.dev/skills/vinvcn/mattpocock-skills-zh-cn/improve-codebase-architecture"><img src="https://agentmods.dev/badge/skills/vinvcn/mattpocock-skills-zh-cn/improve-codebase-architecture/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 improve-codebase-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/vinvcn/mattpocock-skills-zh-cn/improve-codebase-architecture"><img src="https://agentmods.dev/badge/skills/vinvcn/mattpocock-skills-zh-cn/improve-codebase-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,385 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. Third-party audits
  • Socket pass 10 May 2026
  • Snyk pass 10 May 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00035 $0.01385
Opus 5 $0.00017 $0.00692
Sonnet 5 $0.00007 $0.00277
Haiku 4.5 $0.00003 $0.00138

Measured 11d ago against content hash 9399c0d12b34, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

improve-codebase-architecture 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 11d ago.

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/engineering/improve-codebase-architecture/SKILL.md · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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。要视觉化。

Read the full file on GitHub · 72 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 11d ago First seen · 72 lines · 35 tokens per session scan A 9399c0d12b34

Subscribe to this mod's changes

improve-codebase-architecture is a skill published in the GitHub repository vinvcn/mattpocock-skills-zh-CN (4,114 stars, last pushed 3d ago), licensed MIT. It adds 35 tokens to every session and 1,385 once invoked, about $0.0002 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-08-30.