Designs deep modules with small interfaces, runs architecture reviews to find deepening opportunities, performs MIT axiomatic design analysis, and extracts repeated code into shared artifacts.
Ships in improve-codebase. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Design deep modules: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. The aim is leverage for callers, locality for maintainers, and testability for everyone.
Pick the work:
/improve-codebase.{FR} = [A]{DP}) to find hidden coupling and excess complexity. Run standalone or as a lens inside Review.Use these terms exactly — don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
processOrder(order, paymentGateway), not new StripeGateway() inside. Return results, don't produce side effects — calculateDiscount(cart): Discount, not mutate-and-return-void.Rejected framings: depth as implementation-lines ÷ interface-lines (rewards padding); "interface" as the interface keyword or public methods (too narrow); "boundary" (overloaded — say seam or interface).
Name domain concepts in the project's domain language: the glossary its AGENTS.md points to, else CONTEXT.md. Decisions the project has recorded (architecture docs, ADRs) are not re-litigated.
Read the domain glossary and any recorded decisions in the area first. Then walk the codebase yourself — no subagents unless the user asks — and note where you experience friction:
Apply the deletion test to anything you suspect is shallow. A "yes, complexity concentrates" is the signal you want.
Publish the report the way the workspace's instructions say to share HTML (for example an html-home root such as ~/.agent/diagrams). With no such rule, write $TMPDIR/architecture-review-<timestamp>.html and open it.
The report uses Tailwind via CDN for layout and Mermaid via CDN where a graph, flow, or sequence communicates the structure; hand-built divs and SVG carry the more editorial visuals (mass diagrams, cross-sections, collapses). Each candidate is a card with:
Strong, Worth exploring, or Speculative, as a badgeEnd with a Top recommendation: which candidate to tackle first and why.
Use the domain glossary for the domain and this glossary for the architecture: if the domain defines "Order," say "the Order intake module" — not "the FooBarHandler," and not "the Order service."
If a candidate contradicts a recorded decision, surface it only when the friction is real enough to reopen the decision, and mark it in the card: "contradicts ADR-0007 — but worth reopening because…".
See HTML-REPORT.md for the scaffold, diagram patterns, and style.
Do NOT propose interfaces yet. After the report is up, ask: "Which of these would you like to explore?"
Interview the user one question at a time down each branch of the design tree — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive. Resolve dependencies between decisions one by one, give your recommended answer with each question, and explore the codebase instead of asking when the code can answer.
Keep the domain language current as decisions crystallize:
Nam Pyo Suh's framework tests whether a design's seams separate independent requirements. Run it standalone on a subsystem or as a lens during Review to check that deepening a module doesn't couple unrelated concerns.
Two axioms:
List the FRs — the minimum independent set of what the subsystem must achieve, in the project's domain language (not implementation steps).
List the DPs — the actual modules, interfaces, data structures, or config knobs in code that satisfy them.
Build the design matrix ({FR} = [A]{DP}) — rows = FRs, columns = DPs. Mark X where changing DP_j affects FR_i, 0 otherwise, then reorder rows and columns to see which shape you have:
| Matrix shape | Meaning | Action |
|---|---|---|
| Uncoupled (diagonal) | 1-to-1 FR↔DP; changes stay local | Keep the seam |
| Decoupled (triangular) | Off-diagonal effects exist, but a strict order resolves them | Make the sequence explicit in the interface or pipeline |
Coupled (non-triangular, cyclic, or #DP < #FR) | Changing one DP breaks another FR and vice versa | Split the conflated DP or move the seam so FRs decouple |
Redundant (#DP > #FR) | Extra knobs or shallow pass-through modules | Apply the deletion test; freeze or remove extras |
Zigzag when needed — decompose a chosen DP into child FRs one level down, pick child DPs, and recheck the child matrix. If child coupling bubbles up, revisit the parent DP.
How it pairs with deep modules: deepening consolidates shallow pass-throughs, while Axiom 1 marks where not to merge — two independent FRs forced through one shared DP create a coupled design. Axiom 2 reinforces depth by cutting what callers must know to use the interface correctly.
If you solved it twice, you'll solve it again. Extract once — copy-paste spreads bugs.
Find instances:
colgrep "<what the code does>" <repo-a> <repo-b>rg -l "<signature>" <projects-dir>/*/srcrg --no-filename "^import .* from" <projects-dir>/*/src | sort | uniq -c | sort -rn | head -20cass search "<technique>" --robot --limit 30, or --aggregate workspace to see which projects did| Signal | Package as | Done when |
|---|---|---|
| Same function or type copy-pasted | Library | Interface is small and stable; README shows minimal use |
Same CLI flags (--json, --verbose) | Shared CLI module | Every source CLI uses it |
| Same "run X, then Y, then Z" workflow | Skill | Description names the triggers; examples come from real runs |
| Same project layout | Template | Variables documented; defaults build out of the box |
| Same lint, format, or CI config | Shared config | Composable; override path documented |
Align like this:
PROJECT A PROJECT B PROJECT C
─────────────────────────────────────────────────────────────────────
fn retry<T>( fn with_retry<T>( fn retry_call<T>(
f: impl Fn() -> T, op: impl Fn() -> T, func: impl Fn() -> T,
max: usize, attempts: u32, max_attempts: usize,
delay: Duration wait: Duration backoff: Duration
) -> Result<T, Error> ) -> Result<T, E> ) -> Result<T, Error>
─────────────────────────────────────────────────────────────────────
COMMON: retry logic with max attempts and delay
VARIES: naming, integer types, error types
Done when every source project uses the artifact and passes its checks, the artifact is smaller than the average instance it replaced, and why the pattern exists is written next to it. Report:
## Extracted Pattern: <name>
Sources: <repo/path:line>, <repo/path:line>, <repo/path:line>
Invariant core: <what never changes>
Variance: <what differs> → <how it is parameterized>
Packaged as: <library | skill | template | config> at <path>
Applied back: <repo> ✓, <repo> ✓, <repo> ✓
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/improve-codebase:improve-codebasefrom improve-codebase
npx claudepluginhub ratacat/ratacats-skills --plugin improve-codebase