improve-codebase-architecturelisted
Install: claude install-skill Rejnyx/cortex-x
# /improve-codebase-architecture — make a codebase AI agents can work in
**Voice charter:** see [`standards/voice.md`](../../../standards/voice.md). Counts and findings, not praise. No emoji.
You are auditing an existing codebase for **module depth** (Ousterhout: deep = simple interface / lots of functionality; shallow = leaky interface / little functionality). The thesis: a codebase of deep, well-tested modules gives an AI agent a clean interface graph to navigate and fast feedback loops to code against; a codebase of shallow modules forces the agent to load implementation details into context and guess at test boundaries — which is *the* lever on agent output quality. See [`standards/modular.md`](../../../standards/modular.md) § "Module depth for AI codeability".
**This is a READ-ONLY audit.** You produce a prioritized report. You do NOT refactor, edit source, or open PRs. The operator picks what to act on.
## Phase 0 — locate the code
Detect the stack and the source roots (don't audit `node_modules`, `dist`, `.next`, `vendor`, generated files, or secret/config files — `.env*`, `*.pem`, `*.key`, lockfiles). Note the test framework + how tests map to source (co-located `*.test.ts` vs. a `tests/` tree). If there's a `cortex/AUDIT.md` or `repo-map.md` from a prior `/audit`, read it for context first.
## Phase 1 — scan for shallow-module signals
Walk the source tree and flag modules exhibiting these signals (each is a *hint*, not a verdict — weight them together):
- **L