improve-codebase-architecture

improve-codebase-architecture is a skill for Claude Code, Codex from yugasun/aiops. It costs 57 tokens per session (1,419 once invoked), scanned A, original, Apache-2.0.

A codebase architecture review that looks for places where modules are too shallow or tangled, then presents possible improvements in a visual HTML report.

In plain words
What is it for?
Use it to inspect architectural friction, identify refactoring opportunities, and investigate one selected improvement in depth.
Why use it?
It helps reveal structural problems that make code harder to test, understand, and navigate. It also keeps suggestions aligned with the project's existing terminology and recorded design decisions.

Skill for Claude CodeCodex

Part of the aiops plugin — 23 skills, 9 agents shipped together

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

Made for: Claude Code, Codex.

Or install aiops, the plugin that ships this one along with the rest of its 23 skills, 9 agents.

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/yugasun/aiops/improve-codebase-architecture.svg)](https://agentmods.dev/skills/yugasun/aiops/improve-codebase-architecture)
Your own site
<a href="https://agentmods.dev/skills/yugasun/aiops/improve-codebase-architecture"><img src="https://agentmods.dev/badge/skills/yugasun/aiops/improve-codebase-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,419 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.00057 $0.01419
Opus 5 $0.00028 $0.00709
Sonnet 5 $0.00011 $0.00284
Haiku 4.5 $0.00006 $0.00142

Measured 3d ago against content hash 13e02cd122c8, 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 3d 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/improve-codebase-architecture/SKILL.md · 90 lines

How it starts

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

Improve Codebase Architecture

Surface architectural friction and propose deepening opportunities — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.

This command is informed by the project's domain model and design-vocabulary.md — use those terms exactly in every suggestion.

The domain language in CONTEXT.md gives names to good seams; ADRs in docs/adr/ record decisions this command should not re-litigate.

Process

1. Graph check (optional)

architecture_health flows run a graph_build phase first (phases.py). If you arrive here without a graph, check for graphify-out/graph.json:

  • If graphify-out/graph.json exists, tell the user: "代码图谱已就绪(N 个模块),将基于图谱做增强分析。" Then query /code-graph query god-nodes and /code-graph query communities to get the global view. Query specific modules as needed via /code-graph query.
  • If no graph exists, tell the user: "未检测到代码图谱,使用有机探索模式。如需更精确的分析,可先运行 /code-graph build(需要先安装 graphify)。" Then fall back to organic exploration.

2. Multi-modal sweep

Run 6 perspective agents in parallel using the Agent tool. Each agent queries the code graph from a different angle. See sweep-patterns.md for agent prompt templates.

Structure agent — Identify shallow modules (god-nodes where interface ≈ implementation)

Data-flow agent — Trace cross-module data flow and seam leakage

Change agent — Identify friction from hotspots: high-coupling + high-churn modules

Test agent — Map untested critical seams (high in-degree, zero test coverage)

Security agent — Identify trust boundary violations and auth/business logic mixing

Performance agent — Structural performance risks: broad-state queries, missing cache seams, deep sync chains

3. Cross-validate

Spawn a synthesis agent that receives all 6 perspectives:

  • De-duplicate findings (same module flagged by multiple agents = higher confidence)
  • Rank by convergence: findings confirmed by 2+ agents rank highest
  • Apply the deletion test to the top findings
  • Produce a final candidate list (5-10 items)

Read the full file on GitHub · 90 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. 3d ago First seen · 90 lines · 57 tokens per session scan A 13e02cd122c8

Subscribe to this mod's changes

improve-codebase-architecture is a skill published in the GitHub repository yugasun/aiops (4 stars, last pushed 15d ago), licensed Apache-2.0. It adds 57 tokens to every session and 1,419 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.