improve-codebase-architecture

A codebase-architecture review guide for finding places where software modules can become easier to change and test. It uses terms such as interfaces, seams, adapters, depth, leverage, and locality to describe how code is organised.

In plain words
What is it for?
Use it to identify refactoring opportunities, consolidate related modules, create clearer boundaries, improve testability, and make maintenance more local.
Why use it?
It helps reveal pass-through code, scattered complexity, and tight coupling that make changes and bug fixes harder.

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

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 951 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.00951
Opus 5 $0.00028 $0.00476
Sonnet 5 $0.00011 $0.00190
Haiku 4.5 $0.00006 $0.00095

Measured 2d ago against content hash dd5188e7a30b, 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.

.claude/skills/improve-codebase-architecture/SKILL.md · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 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 long-term locality.

Glossary

Use these terms exactly in every suggestion. Consistent language is the point. Full definitions in LANGUAGE.md.

  • Module — anything with an interface and an implementation (function, class, package, slice).
  • Interface — everything a caller must know to use the module: types, invariants, error modes, ordering, config.
  • Depth — leverage at the interface: a lot of behaviour behind a small interface.
  • Seam — where an interface lives; a place behaviour can be altered without editing in place.
  • Adapter — a concrete thing satisfying an interface at a seam.
  • Leverage — what callers get from depth.
  • Locality — what maintainers get from depth: change, bugs, knowledge concentrated in one place.

Key principles:

  • Deletion test: imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
  • The interface is the test surface.
  • One adapter = hypothetical seam. Two adapters = real seam.

When the repo has its own domain vocabulary (in CONTEXT.md), that vocabulary takes precedence over LANGUAGE.md terms for domain concepts. Use LANGUAGE.md terms only for architectural structure (module, seam, depth, etc.).

Process

1. Explore

Read CONTEXT.md first if it exists. Then use the Agent tool with subagent_type=Explore to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction:

  • Where does understanding one concept require bouncing between many small modules?
  • Where are modules shallow — interface nearly as complex as the implementation?
  • Where do pure functions get extracted just for testability, but the real bugs hide in how they're called?
  • Where do tightly-coupled modules leak across their seams?
  • Which parts of the codebase are untested or hard to test through their current interface?

Read the full file on GitHub · 85 lines

Files

What ships with it

3 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. 2d ago First seen · 85 lines · 56 tokens per session scan A dd5188e7a30b

Subscribe to this mod's changes

improve-codebase-architecture is a skill published in the GitHub repository rhi-zone/normalize (5 stars, last pushed 3d ago), licensed Apache-2.0. It adds 56 tokens to every session and 951 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

repomix

Pack and analyze codebases into AI-friendly single files using Repomix. Use when the user wants to explore repositories, analyze code structure, find patterns, check token counts, or prepare codebase context for AI analysis. Supports both local directories and remote GitHub repositories.

yamadashy/repomix · 58 tokens

blast-radius-review

Review a change by its blast radius, using Kin's graph to find what downstream code the change can reach. Use when reviewing a diff or pull request, deciding whether an edit is safe, or answering "what else breaks if I change this" in a repository admitted to Kin.

firelock-ai/kin · 60 tokens

kin-retrieval

Read a codebase through Kin's semantic graph instead of grep and whole-file reads. Use when finding where something lives, what a symbol does, who calls it, or which code implements a described behavior, and when a repo has been admitted to Kin (a .kin/ directory exists).

firelock-ai/kin · 63 tokens

documentation-sync

Use for any code change, specification change, architecture change, or agent-rule change; do not use as a replacement for the canonical spec.

SioYooo/RepoGrammar · 31 tokens

implement-change

Use for every code change in RepoGrammar; do not use for documentation-only edits that do not touch behavior or repository automation.

SioYooo/RepoGrammar · 28 tokens

major-feature-workflow

Use when a change adds user-visible capability, changes public API, MCP contract, storage schema, module boundaries, indexing pipeline, or important dependencies.

SioYooo/RepoGrammar · 34 tokens