code-arch-optimizer

code-arch-optimizer is a skill for Claude Code, Codex from serejaris/kimi-skills. It costs 85 tokens per session (1,008 once invoked), scanned A, original, MIT.

A skill for examining a codebase and finding architecture problems, such as tightly connected modules or code that is difficult to test. It then develops several possible interface designs for a chosen restructuring.

In plain words
What is it for?
It is for exploring refactoring opportunities, combining closely related modules, improving testability, and preparing a GitHub Issue-style request for architectural changes.
Why use it?
It helps locate boundaries that make code harder to understand, test, or change, and turns those findings into a detailed refactoring proposal.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for exploring refactoring opportunities, combining closely related modules, improving testability…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/serejaris/kimi-skills/code-arch-optimizer
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 serejaris/kimi-skills --skill code-arch-optimizer
Clone the repo
git clone --depth 1 https://github.com/serejaris/kimi-skills

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 code-arch-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/serejaris/kimi-skills/code-arch-optimizer.svg)](https://agentmods.dev/skills/serejaris/kimi-skills/code-arch-optimizer)
Your own site
<a href="https://agentmods.dev/skills/serejaris/kimi-skills/code-arch-optimizer"><img src="https://agentmods.dev/badge/skills/serejaris/kimi-skills/code-arch-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,008 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.
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.00085 $0.01008
Opus 5 $0.00043 $0.00504
Sonnet 5 $0.00017 $0.00202
Haiku 4.5 $0.00009 $0.00101

Measured 6d ago against content hash 02c57fcba3b2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

code-arch-optimizer 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 6d 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/code-arch-optimizer/SKILL.md · 77 lines

What it actually says

代码库架构深度重构

像 AI 一样探索代码库,发现架构摩擦点,挖掘可测试性改进机会,并以 GitHub Issue RFC 的形式提出模块深化重构方案。

深模块(John Ousterhout 著《软件设计哲学》)指接口简洁但隐藏了大量实现细节的模块。深模块更易测试、更便于 AI 导航,并且可以在边界处测试,而无需深入内部。

流程

1. 探索代码库

使用 Agent 工具(subagent_type=Explore)自然地浏览代码库。不要机械地套用规则——以有机的方式探索,留意你遇到摩擦的地方:

  • 哪里理解一个概念需要在许多小文件之间来回跳转?
  • 哪些模块过于浅薄,接口几乎和实现一样复杂?
  • 哪些纯函数只是为了可测试性而被提取出来,但真正的 bug 却藏在调用方式中?
  • 哪些紧耦合的模块在它们之间的接缝处产生了集成风险?
  • 代码库中哪些部分缺少测试,或者难以测试?

你遇到的摩擦本身就是信号。

2. 展示候选项

以编号列表的形式展示深化机会。每个候选项需说明:

  • 聚类:涉及哪些模块/概念
  • 耦合原因:共享类型、调用模式、概念共同归属
  • 依赖类别:参见 REFERENCE.md 中的四种分类
  • 测试影响:哪些现有测试将被边界测试替代

此时不要提出接口设计。问用户:"你想深入探索哪一个?"

3. 用户选择候选项

4. 描述问题空间

在启动子代理之前,为用户编写所选候选项的问题空间说明:

  • 任何新接口需要满足的约束条件
  • 需要依赖的外部依赖
  • 一个粗略的示意代码草图,使约束条件更加具体——这不是正式方案,只是用来让约束可感知

向用户展示后,立即进入第 5 步。用户可以在阅读和思考问题的同时,让子代理并行工作。

5. 设计多种接口方案

使用 Agent 工具并行启动 3 个以上子代理。每个子代理必须为深化后的模块产出一个截然不同的接口方案。

为每个子代理提供独立的技术简报(文件路径、耦合细节、依赖类别、需要隐藏的内容)。该简报独立于第 4 步的用户说明。给每个代理设定不同的设计约束:

  • 代理 1:"最小化接口——目标是最多 1-3 个入口点"
  • 代理 2:"最大化灵活性——支持多种用例和扩展"
  • 代理 3:"针对最常见的调用方优化——让默认场景极简"
  • 代理 4(如适用):"围绕端口与适配器模式设计跨边界依赖"

每个子代理输出:

  1. 接口签名(类型、方法、参数)
  2. 使用示例,展示调用方如何使用
  3. 内部隐藏了哪些复杂度
  4. 依赖策略(如何处理依赖——参见 REFERENCE.md
  5. 权衡取舍

依次展示各方案,然后用文字进行对比分析。

对比完成后,给出你自己的推荐:你认为哪个方案最优,理由是什么。如果不同方案中的元素可以很好地组合,提出一个混合方案。要有立场——用户需要的是有力的判断,而不仅仅是一份菜单。

6. 用户选择接口方案(或接受推荐)

7. 创建 GitHub Issue

使用 gh issue create 创建重构 RFC 的 GitHub Issue。使用 REFERENCE.md 中的模板。不要让用户在创建前审阅——直接创建并分享链接。

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. 6d ago First seen · 77 lines · 85 tokens per session scan A 02c57fcba3b2

Subscribe to this mod's changes

code-arch-optimizer is a skill published in the GitHub repository serejaris/kimi-skills (6 stars, last pushed 1mo ago), licensed MIT. It adds 85 tokens to every session and 1,008 once invoked, about $0.0004 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

best-practices

Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities".

addyosmani/web-quality-skills · 49 tokens

resolve-pr-comments

Evaluate, fix, answer, and reply to GitHub pull request review comments and conversation comments. Handles both change requests (fix or skip) and reviewer questions (explain using reasoning recalled from past Claude Code transcripts). Use when the user asks to "resolve PR comments", "fix review comments", "address PR…

tobihagemann/turbo · 95 tokens

review-code

Review code for bugs, security vulnerabilities, API misuse, consistency issues, simplicity problems, or test coverage gaps by running internal reviews and a peer review in parallel and returning combined findings. Single-concern with a type argument, or full review with no argument. Use when the user asks to "review…

tobihagemann/turbo · 144 tokens

assess-technical-debt

Assess project-wide structural technical debt: complexity hotspots, deprecated API usage, duplication clusters, and architecture rot. Ranks findings by impact and refactor effort into a report at .turbo/technical-debt.md. Use when the user asks to "assess technical debt", "find technical debt", "review technical…

tobihagemann/turbo · 108 tokens

map-codebase

Deep architecture report that fans out parallel inspections across different aspects of the codebase (structure, tech stack, APIs, patterns, data flow, dependencies, testing) and synthesizes findings into a comprehensive document at .turbo/codebase-map.md and .turbo/codebase-map.html. Use when the user asks to "map…

tobihagemann/turbo · 106 tokens

peer-review

Run an independent peer review via Codex. Use when the user asks to "peer review", "peer review my code", "peer review my plan", "get a second opinion", or "independent review".

tobihagemann/turbo · 46 tokens