c31-improve-codebase-architecture

c31-improve-codebase-architecture is a skill for Claude Code, Codex from ChianW/C31. It costs 64 tokens per session (1,092 once invoked), scanned A, original, MIT.

A codebase architecture review that scans a project and produces a self-contained visual HTML report in plain language. It looks for code areas that have caused rework or collisions and checks whether a proposed improvement would actually address the problem.

In plain words
What is it for?
It is for inspecting a codebase, identifying evidence-backed architecture improvement opportunities, explaining each one with everyday comparisons, and presenting the findings in an HTML report.
Why use it?
It helps project owners understand structural code issues without relying on unexplained engineering terms. It also separates evidence of real pain from guesses and rejects improvements whose proposed mechanism does not fit the code.

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/chianw/c31/c31-improve-codebase-architecture
Any agent
npx skills add ChianW/C31 --skill c31-improve-codebase-architecture
Clone the repo
git clone --depth 1 https://github.com/ChianW/C31

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/chianw/c31/c31-improve-codebase-architecture.svg)](https://agentmods.dev/skills/chianw/c31/c31-improve-codebase-architecture)
Your own site
<a href="https://agentmods.dev/skills/chianw/c31/c31-improve-codebase-architecture"><img src="https://agentmods.dev/badge/skills/chianw/c31/c31-improve-codebase-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,092 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.00064 $0.01092
Opus 5 $0.00032 $0.00546
Sonnet 5 $0.00013 $0.00218
Haiku 4.5 $0.00006 $0.00109

Measured 5d ago against content hash e2f49cfebc4a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

c31-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 5d 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/review/c31-improve-codebase-architecture/SKILL.md · 41 lines

What it actually says

Improve Codebase Architecture(C31 改良版)

基于 mattpocock/skills 的 improve-codebase-architecture 微调,两处改动:

改动一:报告必须"说人话"(最高优先级,覆盖 HTML-REPORT.md 的文风规则)

原版的受众是工程师,术语表(module/interface/seam/adapter/locality/leverage)直接使用不解释。本版的受众是项目主人(不一定是工程师)。规则:

  1. 每个候选必须回答三个大白话问题,顺序固定:
    • 这份代码是干嘛的?(一句话,用产品语言而非代码语言——坏例子:"provider 层的派生指标聚合";好例子:"回答'这家公司现在贵不贵'")
    • 出过什么事 / 有什么隐患?(有返工实证给返工实证;没有就直说"目前只是看着累,没出过 bug"——不许把推测写成事故)
    • 做了之后什么变好?(具体到"以后做 X 只需要 Y",禁止"更易维护"这类空话)
  2. 每个候选配一个生活类比(酱汁岗位、四科目活页夹这种)。类比是正文,不是点缀。
  3. 术语表词汇允许出现,但首次出现必须当场解释(如"seam(两块代码的分界线)")。能不用就不用。
  4. 推荐强度徽章照常(Strong / Worth exploring / Speculative),但结论部分必须说清排序依据是"已付过学费"还是"只是摩擦"——前者优先于后者。
  5. 不凑数:只有有实证(返工史/碰撞史/复杂度数据)的候选才进报告,宁缺毋滥。
  6. 机制验证门(2026-08-19 教训,最高优先级):痛点证据只证明"这里疼过",不证明"这个药治这个疼"。每个候选的解法进报告前,必须写出一句话——"这个好处通过什么机制生效?"——并对着实际代码核实该机制(grep 关键函数/读关键路径/必要时跑一下)。机制不成立的候选当场杀死,不得进报告,哪怕痛点证据再硬。判例:masters.ts 分层("数据改动省重录"在 llmCacheKey=全文 hash 机制下不成立)与 page.tsx 拆分(4 起事故与文件大小无因果)——两个候选的痛点证据都是真的,药方都是假的。

改动二:报告语言跟随调用语言

  • 用户用中文调用 → HTML 报告全文中文(含标题、图注、徽章)
  • 用户用英文调用 → 全文英文
  • 图表内的模块名/函数名保持代码原文(不翻译标识符)

其余流程不变(照原版执行)

  1. Explore:先定扫描范围(用户指定方向 > git log 热点),有机探索找摩擦点(浅模块、跨接缝泄漏、locality 缺失、难测试处),对疑似浅模块做删除测试
  2. HTML 报告:自包含单文件,写 OS 临时目录(architecture-review-<date>-<scope>.html),Tailwind + Mermaid CDN,每候选 before/after 可视化,写完帮用户打开并给出绝对路径。视觉规范照 HTML-REPORT.md(scaffold/图表模式/样式不变——只有文风被上面的"说人话"规则覆盖)
  3. Grilling 环节:用户挑了候选后进入 /grilling,拷问约束、依赖、深化后形状、哪些测试存活;side effects 用 /domain-modeling 就地沉淀

C31 项目惯例补充

  • 机械拆分类候选(纯搬运重构)的验收铁律写进报告:测试套件一行不改、全绿;夹带语义修改 = 该票失败
  • 报告结论若建议立项,直接附一句"这是 DS 的机械活,可写票据下发"(我们的执行分层:票据 → DeepSeek 施工 → 审计终审)
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. 5d ago First seen · 41 lines · 64 tokens per session scan A e2f49cfebc4a

Subscribe to this mod's changes

c31-improve-codebase-architecture is a skill published in the GitHub repository ChianW/C31 (1 stars, last pushed 10d ago), licensed MIT. It adds 64 tokens to every session and 1,092 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-31.

Related

Other skills, from other repositories

compare-harnesses

Diff two scaffolded harnesses (ADR-031). Reports manifest meta drift + host list + per-file fingerprint changes (added/removed/changed). Exits 0 IDENTICAL, 1 DRIFT, 2 missing manifest. Use --bundle for the ADR-031 schema-1 JSON envelope.

ruvnet/metaharness · 66 tokens

oia-manifest

Emit .harness/oia-manifest.json declaring layer alignment with the OIA v0.1 9-layer reference architecture. Self-describes the harness's MCP wiring, witness signing, audit log, identity posture (always 'none' at v0.1). --check verifies an existing manifest, --dry-run prints without writing, --json emits to stdout.

ruvnet/metaharness · 79 tokens

create-harness

Scaffold your own focused AI agent harness — pick host (Claude Code, Codex, pi.dev, Hermes), template, agents, skills, and ship a npm-publishable harness with its own npx CLI. Use when a user asks to "create my own agent harness", "scaffold a harness", "make a custom Claude Code plugin like ruflo", or "build a…

ruvnet/metaharness · 89 tokens

diag-harness

Kernel-version skew check (ADR-027). Reports manifest surface + manifest kernel + installed kernel + verdict (match/patch-diff/minor-diff/major-diff). Exits 1 on minor/major skew with a copy-pasteable npm install @metaharness/[email protected] next step. Exits 2 if no .harness/manifest.json at path.

ruvnet/metaharness · 85 tokens

example-harness

Scaffold a ready-made AI agent harness in one command from the 19 published @metaharness/ example packages — 9 host integrations (Claude Code, Codex, Hermes, pi.dev, OpenClaw, RVM, Copilot, OpenCode, GitHub Actions) + 10 vertical pods (devops, research, trading, support, legal, coding, education, sales, gaming…

ruvnet/metaharness · 90 tokens

repo-genome

7-section readiness scorecard for a LOCAL repo. Reports repo type + agent topology + MCP risk + test confidence + release readiness + recommended harness plan + scorecard. Exit 0 ready, 1 needs-work, 2 blocked. --json for the 6-field scorecard, --bundle for the ADR-031 schema-1 envelope.

ruvnet/metaharness · 73 tokens