improve-codebase-architecture

A local review of a codebase’s structure, looking for parts that are hard to change, test, or understand.

In plain words
What is it for?
It is for finding tangled dependencies, overly broad interfaces, unclear module ownership, weak test coverage, and a safe order for improvements.
Why use it?
It helps identify architectural problems before you start refactoring, which means changing code structure without changing its intended behavior.

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/setrathexx/codex-engineering-workflow-pack/improve-codebase-architecture
Any agent
npx skills add SetraTheXX/Codex-Engineering-Workflow-Pack --skill improve-codebase-architecture
Clone the repo
git clone --depth 1 https://github.com/SetraTheXX/Codex-Engineering-Workflow-Pack

Made for: Claude Code, Codex.

Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,030 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.00059 $0.01030
Opus 5 $0.00030 $0.00515
Sonnet 5 $0.00012 $0.00206
Haiku 4.5 $0.00006 $0.00103

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

.agents/skills/improve-codebase-architecture/SKILL.md · 195 lines

How it starts

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

Improve Codebase Architecture

Find architectural friction and propose small, verifiable refactor opportunities.

This skill is analysis-first. Do not edit code, create reports, or start refactors until the user approves the report path and next action.

Read First

Inspect repo context:

  • CONTEXT.md
  • docs/agents/domain.md
  • docs/adr/
  • docs/agents/test-commands.md
  • relevant source files,
  • relevant test files.

If setup docs are missing, infer from the repo and state what is unknown.

Use fast search when possible:

rg --files
rg "<domain-term-or-module-name>"

Keep Windows paths with spaces quoted when showing commands or report paths.

Output Location

Default local report directory:

docs/agents/architecture/

Suggested file:

docs/agents/architecture/YYYY-MM-DD-architecture-audit.md

Before writing a report:

  • propose the target path,
  • summarize what the report will contain,
  • ask for approval.

Scope

Use this skill for hard-to-change code, tangled module relationships, unclear ownership, shallow pass-through modules, broad interfaces, weak test surfaces, domain naming mismatch, and risky refactor sequencing.

Do not recommend a big rewrite. Prefer small changes that can be verified.

Workflow

1. Define Audit Focus

Identify the area to inspect:

  • folder,
  • module group,
  • feature path,
  • bug-prone area,
  • domain concept,
  • PRD or issue scope.

If the focus is too broad, propose a narrower audit slice.

2. Map Current Structure

Read code and tests enough to understand:

  • main modules,
  • callers and callees,
  • dependency direction,
  • public interfaces,
  • test entry points.

Use zoom-out first if the area is unfamiliar and the user only needs orientation.

3. Check Domain And Decisions

Compare code structure with:

  • domain terms in CONTEXT.md or docs/agents/domain.md,
  • ADR constraints,
  • existing test command docs,
  • related PRDs or issues.

Report mismatches:

  • code uses different names than domain docs,
  • module boundaries cut across domain concepts,
  • ADR assumptions no longer match current implementation,
  • tests verify internals instead of behavior.

Read the full file on GitHub · 195 lines

Files

What ships with it

4 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 · 195 lines · 59 tokens per session scan A de5ab072cd6f

Subscribe to this mod's changes

improve-codebase-architecture is a skill published in the GitHub repository SetraTheXX/Codex-Engineering-Workflow-Pack (1 stars, last pushed 2d ago), licensed MIT. It adds 59 tokens to every session and 1,030 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

todos

This chat has a shared, live TODO plan — your tasks for the conversation, which the user also edits. Read this skill and reach for the todo tools whenever a request takes more than a couple of steps. It covers the plan model (group = task, items = its steps; loose items are the user's lane), how to work it: propose…

JetBrains/thinkrail · 127 tokens

writing-workflow-skills

Use when adding a new workflow skill to pi-thinkrail-workflow, changing an existing workflow skill's role, trigger, handoff, or structure, or checking a workflow skill against the workflow system's rules. Not for authoring general-purpose skills outside this package.

JetBrains/thinkrail · 60 tokens

brainstorming

Use this BEFORE any creative or feature work: building a new feature, adding functionality, changing behavior, or making a nontrivial design decision. Turns the user's request into a validated design — recorded as a spec-graph task-spec — before any implementation. Do not skip this because a change looks small.

JetBrains/thinkrail · 65 tokens

shipping-a-pr

Use when finished work needs to ship as a pull request, or when the ask is about a PR — creating one, bringing it up to date, adding screenshots, watching its checks, or addressing its review comments. Not for reviewing a PR you are not shipping.

JetBrains/thinkrail · 57 tokens

setting-up-a-project

Use whenever asked to set up, onboard, initialize, or spec a project — the front door when the workspace has no spec graph yet (brand-new or an existing codebase); also seeded by the app's Set-up-project card (/skill:setting-up-a-project). Not for feature work in an already-specced project — use the brainstorming…

JetBrains/thinkrail · 76 tokens

writing-specs

Use when a workflow step drafts or revises a spec artifact — a goal-and-requirements, an architecture, or a module SPEC — or when a workflow skill names it at such a step. The shared quality bar for specs — not a workflow, nothing to execute.

JetBrains/thinkrail · 59 tokens