/max:improve-codebasefrom max
Architectural review that identifies structural weaknesses (shallow modules, leaky abstractions) and produces improvement proposals with tradeoffs. Uses four personas to stress-test ideas. Not a refactoring bot.
Ships in max. 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.
None: SKILL.md is the whole skill.
Architectural review that produces proposals, not commits. Read the codebase, identify structural improvement opportunities, and present them with tradeoffs for the user to decide. The output is a decision document.
Inspired by Matt Pocock's improve-codebase-architecture, John Ousterhout's A Philosophy of Software Design, and Ouroboros's "Nine Minds" persona system. Synthesizes shallow-module detection with multi-perspective review.
Input: a codebase (or a directory the user points at) + optional focus area.
Output: a markdown proposal document with 2-5 specific architectural improvements, each with rationale, tradeoffs, and rough effort estimate. Default destination: docs/architecture-reviews/<date>-<focus>.md.
What this skill does NOT do: refactor code, open PRs, make commits, or "just clean things up". It produces a proposal document. The user decides which proposals to act on and by what mechanism.
From John Ousterhout's A Philosophy of Software Design. This is the single most load-bearing concept in this skill.
Deep module: small public interface, large internal implementation. A class that exposes 3 methods but internally handles 500 lines of complexity. Users of the module don't need to understand the internals. The interface is stable even as the implementation evolves.
Shallow module: wide public interface, thin internal implementation. A class that exposes 20 methods, each of which is a 2-line wrapper around something else. Callers have to understand the module's internals to use it correctly. Changes propagate to every caller.
The goal of good architecture is to maximize depth. improve-codebase looks for shallow modules and proposes ways to deepen them, either by (a) absorbing caller logic into the module, (b) narrowing the interface, or (c) merging the module into a bigger one.
Example 1 — A shallow wrapper that should be deepened
// BEFORE (shallow): 8 public methods, each a pass-through
class UserRepository {
findById(id: string) { return db.users.where({id}).first() }
findByEmail(email: string) { return db.users.where({email}).first() }
findAll() { return db.users.toArray() }
create(user: User) { return db.users.insert(user) }
update(id: string, patch: Partial<User>) { return db.users.where({id}).update(patch) }
delete(id: string) { return db.users.where({id}).delete() }
count() { return db.users.count() }
exists(id: string) { return db.users.where({id}).count() > 0 }
}
The interface is as wide as the query capabilities of the underlying database. Every caller has to decide which method to use, and adding a new query means adding a new method. This is shallow — the repository isn't adding anything beyond routing to the database.
// AFTER (deep): 2 methods that capture the actual business concerns
class UserRepository {
find(criteria: UserCriteria): Promise<User[]>
save(user: User): Promise<User>
// Behind the scenes: caching, denormalization, event emission, soft-delete handling
}
The interface is narrower, but the implementation can now do more — cache results, emit events on save, handle soft-deletes uniformly. Callers don't know or care.
Example 2 — A leaky abstraction
// BEFORE: the public interface exposes internal representation
struct MarkdownDocument {
var tokens: [Token]
var parseState: ParseState
var sourcePositions: [SourcePosition]
func render() -> String { ... }
}
Callers can poke at tokens and parseState directly. Anyone who does becomes coupled to the internal representation. When you want to change how parsing works, you can't — callers depend on the tokens.
// AFTER: public interface is just what callers actually need
struct MarkdownDocument {
func render() -> String
func plainText() -> String
func outline() -> [Heading]
private var representation: Representation // implementation detail
}
Leaky abstractions — interfaces that require callers to know implementation details. Watch for:
Misplaced complexity — business logic in the wrong layer. Watch for:
Duplication patterns — the same concept implemented multiple ways. Watch for:
Before looking for problems, understand what the codebase does.
Orientation checklist (adapt to codebase type):
Web app:
package.json / pyproject.toml / equivalent — what framework? what version?src/index.* or equivalent entry pointREADME.md if it existsroutes/ or pages/ to understand user-facing surfacemacOS/iOS app:
Package.swift or *.xcodeproj structureApp.swift / AppDelegate.swift entry pointSources/ or [AppName]/ top-level — feature folders, MVVM, VIPER?Views/ vs Models/ vs Services/ — is the separation clean?CLI tool / library:
lib/)Ask the user: "What area should I focus on?" Options they might pick:
git log --format= --name-only | sort | uniq -c | sort -rn | head)Time budget: 10-15 minutes. Don't read every file. Build a mental model sufficient to identify candidates.
Walk the codebase looking for structural weaknesses. For each candidate, capture: file:line, category, what's wrong, why it matters, estimated effort to fix.
Detection heuristics per category:
Shallow module detection:
Leaky abstraction detection:
startLoading() / finishLoading() instead of load())getInternalState(), setTestMode())Misplaced complexity detection:
Duplication detection:
For each candidate, resist the urge to describe the fix yet. Just catalog the weakness.
Before writing the proposal, run each candidate past four mental perspectives. Each persona asks a different question. Run them in parallel mentally — don't let one persona anchor the others.
Contrarian — "What if the opposite were true?"
If the Contrarian's question lands, DROP the candidate. Not every "shallow" module is wrong; some are boundaries.
Simplifier — "What's the simplest thing that could work?"
If the Simplifier offers a smaller alternative, REPLACE the candidate with the smaller version.
Architect — "If we started over, would we build it this way?"
If the Architect identifies a bigger fix that subsumes the candidate, promote the bigger fix.
Hacker — "What constraints are actually real?"
If the Hacker proposes "just delete it", that's often the best answer.
Run all four per candidate. A candidate that survives all four personas with its original shape is a strong proposal. A candidate that gets rewritten by one persona and dropped by another is probably not ready.
For each surviving candidate, write a proposal section:
### Proposal N: <Short action-oriented title>
**What:** <1-sentence description of the change>
**Where:** <Files and directories affected. Be specific — file:line ranges if possible.>
**Why:** <What problem this solves. Include concrete pain points — "this class has been touched in 12 bug fixes over 6 months" is more compelling than "this class is shallow". Cite git history, bug reports, or specific code smells.>
**How:** <Sketch of the change. Not code — direction. "Merge FooWrapper into Foo and narrow the public interface to three methods: X, Y, Z.">
**Tradeoffs:**
- Pro: <specific benefit — be concrete, not "cleaner code">
- Con: <specific cost — churn, risk, learning curve for other contributors>
- Risk: <what could go wrong, what's the worst case>
**Effort:** <Small (< 1 day) | Medium (1-3 days) | Large (> 3 days)>
**Persona notes:**
- Contrarian: <what the contrarian asked and how the proposal survives it>
- Simplifier: <what the simplifier offered, whether the proposal adopted it>
- Architect: <what the architect saw>
- Hacker: <what the hacker would do instead, if anything>
Present 2-5 proposals. If you can't find that many strong candidates, present fewer. Don't pad. A proposal document with 2 strong proposals is better than one with 5 mediocre ones.
Invoke max:grill-me in spec mode against the proposal document. The grill will push on:
Iterate until below the 0.2 threshold or the user overrides.
Write the proposal to docs/architecture-reviews/<date>-<focus>.md. Print the path and the number of proposals.
Do not create tickets, open PRs, or make commits. That's the user's call after reading.
improve-codebase-architecture skill — the starting framingWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub max4c/skills --plugin max11 skills in this plugin
/cookoffAuto-grill a plan, spec, or ticket by running Claude and Codex as interrogator/answerer pairs instead of interviewing the user. Two modes — relay (iterative back-and-forth between Claude and Codex) and parallel (two swapped streams merged into one spec). Produces a pre-chewed artifact where the user only reviews the result, not sits through the interview. Use this skill whenever the user says "cookoff", "pre-grill this", "have codex grill it", "dual grill", "grill this without me", "run grill-me with codex", "cross-examine this plan", or wants the ambiguity-resolution work done autonomously before they review. Also use when the user has a plan/spec/PRD that would normally go through max:grill-me but explicitly wants to skip being interviewed themselves. Supports `--to-tickets` to emit the grilled spec as Dahso Agent Tickets ready for `/go`, and `--to-tickets --go` to chain straight to `dahso:go` without a review pause./design-interfaceExplore multiple radically different interface designs for a feature in parallel before committing to one. Uses parallel sub-agents to generate distinct approaches so you can compare tradeoffs rather than anchoring on the first idea. For UI/UX interface work specifically — not API interface design. Use when the user says "design-interface", "let's explore some designs for X", "what are the options for this screen", or before building any non-trivial UI./grill-meInterview the user relentlessly about a plan, spec, or ticket until every branch of the decision tree is resolved. Produces a per-dimension ambiguity report (Goals / Acceptance / Boundaries / Alternatives / Assumptions) and an aggregate gate. Use this skill whenever the user is drafting a spec, proposing a design, debating an approach, or describing work to hand off — even if they don't say "grill me". Explicit triggers include "grill me", "stress-test this", "am I missing anything", "what are the risks", or any time a non-trivial plan is being finalized. Also invoked as a subroutine by max:write-prd Phase 5, max:tech-spec Phase 6, max:improve-codebase Phase 5, bugbook:flow Phase 2d, bugbook:prep Phase 3, and bugbook:ticket Phase 2d./grill-with-docsA grilling session that stress-tests a plan against the project's documented domain model — sharpens fuzzy terminology, challenges it against the existing glossary, cross-references it with the code, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallize. The domain-aware variant of grill-me — use this instead when the repo has (or should have) a CONTEXT.md glossary or docs/adr/ decision records. Triggers include "grill with docs", "stress-test this against our domain model", "does this match our language", "check this against our glossary", "grill this and update the docs", or any time a non-trivial plan needs to be reconciled with the project's documented decisions./handoffCompact the current conversation into a handoff document so a fresh agent can pick up the work without re-deriving context. Writes a self-contained brief to the OS temp directory — what's been done, what's left, key decisions, gotchas, and which skills to invoke next. Use when the user says "handoff", "write a handoff", "hand this off", "compact this for a new session", "summarize this for another agent", "I'm running low on context", or is about to start a fresh session on the same work. Takes an optional argument describing what the next session will focus on./release-pluginShip a Claude Code plugin update — detect the plugin, determine the version bump, update plugin.json and CHANGELOG, stage surgically, commit, push, and (for multi-branch repos) merge to the default branch via a worktree. Prints the /plugin update and /reload-plugins commands for the user to run in Claude Code. Use this skill whenever the user has finished editing a plugin's skills and wants to publish the changes, or says "release the plugin", "ship the skill update", "publish this", "bump and push", "push the new version", or any phrase about getting plugin changes live. Also use this preemptively whenever you're about to commit changes inside a `.claude-plugin/` or `plugins/*/` directory — the version-bump step is the most-forgotten part of the workflow and silently leaves changes unshipped.Other plugins' skills for the same job