improve-codebase-architecture

A codebase review that looks for opportunities to reshape modules so their complexity is concentrated behind clear interfaces. A module is a focused part of a program, and an interface is the boundary other code uses to interact with it.

In plain words
What is it for?
Use it to inspect recently changed or frequently edited parts of a codebase, identify architecture friction, propose focused refactoring opportunities, and investigate one selected opportunity in depth.
Why use it?
It helps find code that is difficult to understand, test, or change because responsibilities are spread across many small pieces or tightly coupled areas. The findings are presented in an HTML report for discussion.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/astordu/qoderharness/improve-codebase-architecture
Any agent
npx skills add astordu/qoderharness --skill improve-codebase-architecture
Clone the repo
git clone --depth 1 https://github.com/astordu/qoderharness

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,755 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00056 $0.01755
Opus 5 $0.00028 $0.00877
Sonnet 5 $0.00011 $0.00351
Haiku 4.5 $0.00006 $0.00176

Measured 2d ago against content hash 375f10e40bfa, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 2d 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.

.qoder/skills/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)

暴露架构上的摩擦,并提出 加深机会(deepening opportunities)——把浅模块变为深模块的重构。目标是可测试性与对 AI 友好的可导航性。

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

  • 运行 /codebase-design 技能,获取架构词汇(module 模块、interface 接口、depth 深度、seam 接缝、adapter 适配器、leverage 杠杆、locality 局部性)及其原则(删除测试、"接口即测试面"、"一个适配器 = 假想的接缝,两个 = 真实的接缝")。在每一条建议中都精确地使用这些术语——不要漂移成 "component"、"service"、"API" 或 "boundary"。
  • CONTEXT.md 中的领域语言为好的接缝命名;docs/adr/ 中的 ADR 记录了这条命令不应重新翻案的决策。

流程

1. 探索

在扫描之前先划定范围——YAGNI。 加深一个模块的回报,来自让它未来更易于改动,所以要对代码库中近期变动过的部分格外看重。在动手看之前先决定 看哪里

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

先阅读项目的领域词汇表(CONTEXT.md)以及你所触及区域内的所有 ADR。

然后用 Agent 工具(subagent_type=Search)来遍历代码库。不要遵循僵化的启发式规则——有机地探索,并记下你感到摩擦的地方:

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

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

2. 把候选项呈现为一份 HTML 报告

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

报告使用 通过 CDN 引入的 Tailwind 进行布局和样式设计,并在图/流程/时序能可靠传达结构的地方使用 通过 CDN 引入的 Mermaid 绘制图表。把 Mermaid 与手工打造的 CSS/SVG 视觉元素混用——当关系呈图状(调用图、依赖、时序)时用 Mermaid,当你想要更有编排感的东西(体量图、剖面图、坍缩动画)时用手工构建的 div/SVG。每个候选项都配一张 前/后对比可视化图。要富有视觉表现力。

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

  • Files(文件)——涉及哪些文件/模块
  • Problem(问题)——为什么当前架构在制造摩擦
  • Solution(方案)——用平实的语言描述会改变什么
  • Benefits(收益)——用局部性与杠杆的角度来解释,以及测试会如何改善
  • Before / After diagram(前/后对比图)——并排、手工绘制,展现浅与加深
  • Recommendation strength(推荐强度)——StrongWorth exploringSpeculative 之一,以徽章形式呈现

在报告末尾放一个 Top recommendation(首推)小节:你会最先着手哪个候选项,以及为什么。

领域方面使用 CONTEXT.md 的词汇,架构方面使用 /codebase-design 的词汇。 如果 CONTEXT.md 定义了 "Order",就谈 "the Order intake module(订单接收模块)"——而不是 "the FooBarHandler",也不是 "the Order service"。

Read the full file on GitHub · 72 lines

Files

What ships with it

1 file 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. 2d ago First seen · 72 lines · 56 tokens per session scan A 375f10e40bfa

Subscribe to this mod's changes

improve-codebase-architecture is a skill published in the GitHub repository astordu/qoderharness (21 stars, last pushed 7d ago), licensed MIT. It adds 56 tokens to every session and 1,755 once invoked, about $0.0003 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.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens