Dev.to AI ๐Ÿค– Ai ๐Ÿ‘ 0 ๐Ÿ“– 6 min read

improve-codebase-architecture in Claude Code: what "deepening shallow modules" means before any code moves

Disclosure: we run Skillselion, an independent directory of Claude Code, Codex and Cursor extensions ranked by real installs. We have no tie to Matt Pocock. Quotes come from the skill's SKILL.md at commit abeeaf9, the he

Disclosure: we run Skillselion, an independent directory of Claude Code, Codex and Cursor extensions ranked by real installs. We have no tie to Matt Pocock. Quotes come from the skill's SKILL.md at commit abeeaf9, the head of main on 22 November 2026.

Short answer: improve-codebase-architecture is a survey you run on purpose. You type /improve-codebase-architecture, it reads your git history and domain docs, looks for modules whose interface is nearly as complex as their code, and writes the candidates to an HTML report in your temp directory. Then it stops and asks which one to explore. Refactoring comes later, in a session you start.

On 22 November 2026 Skillselion's catalog API recorded 1,294,711 installs for the improve-codebase-architecture skill listing (skills.sh registry data). The mattpocock/skills repo had 329,909 GitHub stars that day and is MIT licensed.

What does "deepening a shallow module" mean?

A deep module hides a lot of behaviour behind a small interface. A shallow one makes you learn almost as much to call it as you would to write it. The skill states its goal in those terms:

Surface architectural friction and propose deepening opportunities: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.

Source: mattpocock/skills, skills/engineering/improve-codebase-architecture/SKILL.md

"AI-navigability" is the part that matters for a repo you share with an agent. If understanding one concept means opening five tiny files, the agent burns context bouncing between them, and so do you. The skill asks the agent to look for that friction directly: concepts spread over many small modules, pure functions extracted for testability while the bugs live in the callers, and modules that leak across their seams.

To keep "shallow" from becoming a matter of taste, it gives the agent one test:

Apply the deletion test to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.

Source: mattpocock/skills, skills/engineering/improve-codebase-architecture/SKILL.md

A wrapper that only forwards arguments is the classic hit: delete it and the complexity lands in one place. That is a candidate. A module whose deletion would spray logic across ten callers is doing its job.

How does the skill decide what to touch?

It reads context before it reads code. The first rule under "Explore" is a scoping rule:

Scope before you scan: YAGNI. Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed.

Source: mattpocock/skills, skills/engineering/improve-codebase-architecture/SKILL.md

In practice that means three inputs, in this order:

  1. Your direction, if you give one. Name a module, a subsystem or a pain point and it skips the inference.
  2. Commit history. Without a direction it walks back through git log --oneline to find hot spots, the files that keep coming up. If changes are scattered, it widens the net.
  3. Your domain docs. It reads GLOSSARY.md and any ADRs in docs/adr/ for the area first, so candidates use your nouns ("the Order intake module") and stay away from decisions you already recorded.

Only then does it spawn "a sub-agent with a fresh context window" to walk the code. The architecture terms are fixed too: module, interface, depth, seam, adapter, leverage and locality, pulled from a sibling skill called codebase-design. The SKILL.md tells the agent not to "drift into 'component,' 'service,' 'API,' or 'boundary.'" In our reading that is the most useful line in the file: those four words let a review sound thorough while committing to nothing.

How do you install and run it on a real repo?

The README lists one command for Claude Code:

claude plugin install mattpocock-skills@claude-plugins-official

Then run /setup-matt-pocock-skills once per repo. It asks which issue tracker you use, your triage labels, and where to save docs. For other agents, or if you want editable files in the project, the README gives npx skills@latest add mattpocock/skills -a <agent>. Pick one route per agent; installing both gives you every skill twice.

The skill sets disable-model-invocation: true in its frontmatter, so Claude will not start it on its own. You invoke it:

/improve-codebase-architecture

A few habits make the run worth the tokens:

  • Give it a direction. "We are about to add multi-currency to checkout, how can we make that change easy?" produces a narrower, more actionable report than a bare run. The repo's own docs page for the skill calls pointing it at the spec "the most effective prompt for it."
  • Start from a clean working tree. The skill writes one file outside the repo, but the grilling loop can edit GLOSSARY.md and, if you say yes, add an ADR. A clean tree makes those diffs easy to review.
  • Open the report with network access. It loads Tailwind and Mermaid from CDNs. Offline or behind a strict proxy you get raw HTML with no diagrams. If that is your setup, ask for inline CSS and hand-drawn SVG instead.

What does it refuse to do, and what does it ask first?

This is where the skill earns its place in a work repo. The report goes to <tmpdir>/architecture-review-<timestamp>.html, "so nothing lands in the repo." Each candidate gets a card with the files, the problem, a plain-English solution, the benefit in terms of locality and leverage, a before/after diagram, and a badge: Strong, Worth exploring or Speculative. The report ends with one top recommendation.

Then comes the line that keeps the agent from running ahead:

Do NOT propose interfaces yet. After the file is written, ask the user: "Which of these would you like to explore?"

Source: mattpocock/skills, skills/engineering/improve-codebase-architecture/SKILL.md

ADRs get the same respect. A candidate that contradicts one only shows up if the friction is real enough to reopen the decision, and the card has to say so. If you reject a candidate for a lasting reason, the skill offers to write an ADR "so future architecture reviews don't re-suggest it."

After you pick, it hands off to a grilling skill that walks constraints, what sits behind the seam and which tests survive. The repo's docs page is blunt about the scope of the whole run:

It never changes the code. The whole run produces a conversation and one HTML file in your OS temp directory.

Source: mattpocock/skills, docs/engineering/improve-codebase-architecture.md

In the repo it writes GLOSSARY.md, which it creates or sharpens as terms get decided during grilling, plus an ADR in docs/adr/ only if you accept its offer to record one. The implementation happens later, through the normal spec and tickets flow.

When does it not help?

Two limits are worth knowing before you budget a session. The skill exists to produce findings, so it rarely tells you the codebase is fine. Read the badges: a report where every card is Speculative means it found nothing worth your week. And the grilling loop can run long. If you want only the report, say "don't grill me, just show the report" when you invoke it. The docs list this as the most common complaint and note there is no documented no-grill mode yet.

On a large, tangled legacy repo, expect candidates, not a rescue. The README says it plainly: it "won't untangle the mud for you." Take one candidate per session, turn the rest into tickets, and keep the context window for the refactor you chose.

Our Matt Pocock skills hub lists the sibling skills this one calls, including codebase-design and grilling.

How do you decide when a module in your codebase is too shallow: a rule like the deletion test, or gut feel during code review?

๐Ÿ“ฐ Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.