Guides · Updated December 1, 2026

Best agent skills for refactoring code, tested

By Tineessa Nelson, Use This Skill

For restructuring a tangled module, start with improve-codebase-architecture (mattpocock/skills). Run three times without it and three times with it on Claude Opus 5.5, it labelled each change by strength and closed with one top recommendation in 3 of 3 runs (0 of 3 without), in fewer words and about 12% less time. Both sides found the same bugs.

Which refactoring skills have been run side by side?

Two skills for restructuring existing code have published proofs. In each, Claude Opus 5.5 did one fixed brief three times without the skill and three times with it, and all six pages of each proof are on the skill's page. Neither was commissioned.

Skill Brief What changed with the skill (3 runs each side) Median time per run Scan (Nov 30)
improve-codebase-architecture Review a 25-line Express checkout handler that breaks when coupon or stock rules change Strength labels and a top recommendation in 3 of 3 (0 of 3 without); first step "deepen the Checkout module" instead of "extract a pure pricing core" 265.2 s → 232.4 s Clear, 3 files
vercel-composition-patterns Refactor a React Modal that takes fourteen props Context written as a contract of state, actions and meta in 3 of 3 (0 of 3 without) See the React and Next.js guide Clear, 14 files

The improve-codebase-architecture proof ran on October 24, 2026, at commit 5beb35b; the composition proof ran on October 21, 2026, and is covered in full in the React guide, so this page looks at the first.

What did improve-codebase-architecture change?

The brief gave Claude one createOrder function that reads prices and stock, applies a coupon, charges the card with Stripe, writes the order, lowers stock and sends an email, all inside the request handler. It asked for the problems, the changes in order of value, and the code after the most important change, as one HTML report.

What was measured (3 runs each) Without With
First recommendation "Extract a pure pricing (or checkout) core", 3 of 3 "Deepen the Checkout module behind one interface", 3 of 3
The word "pure" on the page 6 to 7 times each 0 of 3
"Service" or "boundary" used for the parts 3 of 3 0 of 3
"Locality" and "deepening" used 0 of 3 3 of 3
Each change labelled Strong, Worth exploring or Speculative 0 of 3 3 of 3
A closing "top recommendation" 0 of 3 3 of 3
Ends by asking which candidate to explore 0 of 3 2 of 3
Changes recommended 5, 6 and 8 4, 4 and 5
Median words of visible text 2,490 1,778
Median output tokens 32,503 28,181
Median time per run 265.2 s 232.4 s
Input tokens per run 850 5,594

The shift in the first recommendation is the skill doing what it says. Its SKILL.md tells Claude to look for places where "pure functions have been extracted just for testability, but the real bugs hide in how they're called," and to use one vocabulary (module, interface, depth, seam, adapter, leverage, locality) without drifting into "component," "service," "API," or "boundary." Without the skill, every report pulled the price and coupon rules into a pure function and left the handler to call Stripe, the database and the mailer in order. With it, every report put the whole checkout, including the order of the charge, the insert and the stock change, behind one interface, with Stripe and the mailer passed in as adapters so tests can use fakes.

The skill also asks for a strength badge on each candidate and a "Top recommendation" at the end, which is where the labelled, shorter lists came from. It made each run shorter, not longer: about 4,300 fewer output tokens and 33 seconds less, for about 4,700 more input tokens to read the skill.

Did the skill find more problems?

No. Both sides found the problems that cost money, in every run.

Problem in the handler Without With
The card is charged before the order is saved 3 of 3 3 of 3
The payment status is stored but never checked 3 of 3 3 of 3
Stock is checked, then lowered later, so two buyers can pass the check 3 of 3 3 of 3
Money is computed in floating point 3 of 3 3 of 3
No idempotency key on the charge 3 of 3 3 of 3
No validation of the request body 3 of 3 3 of 3
An email failure turns a paid order into an error 3 of 3 3 of 3
One database query per line item 3 of 3 1 of 3

If you want a list of everything wrong, Claude gives you that without a skill. What the skill adds is a narrower answer: which structural change to make first and why, in terms you can reuse on the next review.

Counts from a script run on December 1, 2026 over the six published pages of the proof, checked by reading the matching passages. Token and time figures are medians from data/proofs.json. The skill's history was read from its repository the same day: since the proven commit, one line changed on October 29, 2026 (the sub-agent that explores the code now starts with a fresh context window).

What could the proof not show?

The proof sent the brief as one message, with the skill's files loaded and no tools. Much of the skill's process needs a real session: reading git log to find the parts of the code that change most, starting a sub-agent to explore, writing the report to your temporary folder and opening it, then calling the grilling skill to work through the candidate you pick and domain-modeling to update a GLOSSARY.md. None of that happened here. The skill also asks for Tailwind and Mermaid from a CDN; none of the six pages loaded any script from a CDN, and all drew their diagrams in inline SVG. The brief asked for code after the main change, so the "with" pages showed code even though the skill says not to propose interfaces until you choose a candidate.

So the proof measures what the skill's instructions change in a single answer. It does not measure its interactive loop. How proofs are run is on how a proof works, and why three runs a side matter is in how to test whether a skill helps.

Which other refactoring skills are in the directory?

In the November 30, 2026 crawl of 1,975 skills from 47 repositories, 12 skills from 8 repositories mention refactoring in their name or description, and all 12 were Clear in that day's scan. improve-codebase-architecture is not one of the 12, because its description talks about "deepening opportunities" instead. The table lists the ones whose main purpose is restructuring code, with the two mattpocock skills added. Apart from the two proven skills, none of them has a proof yet, so this table says what each SKILL.md asks for, not what it does to the output.

Skill Repository What its SKILL.md does Proof
improve-codebase-architecture mattpocock/skills Finds shallow modules, writes a ranked HTML report, then walks through one candidate with you Yes (above)
codebase-design mattpocock/skills The vocabulary and principles for deep modules that the skill above calls No
vercel-composition-patterns vercel-labs/agent-skills Rules for React components with too many boolean props Yes (React guide)
refactor-safely tirth8205/code-review-graph Plans a refactor from a dependency graph and previews renames; needs that project's tools No
architecture-patterns wshobson/agents Clean Architecture, Hexagonal Architecture and Domain-Driven Design for backends No
python-design-patterns wshobson/agents KISS, separation of concerns, single responsibility, composition over inheritance No
karpathy-guidelines multica-ai/andrej-karpathy-skills Guidelines to avoid overcomplicated code when writing, reviewing or refactoring No
refactor sandbaseai/sandbase-skills A general plan, change and verify workflow; can call a paid outside service after asking you No

Which one should I pick?

Your situation Skill What to expect
A module keeps breaking and is hard to test improve-codebase-architecture A short, ranked list and one first step; you start it with /improve-codebase-architecture
React components with a dozen or more props vercel-composition-patterns Compound components and a state contract any provider can implement
A list of every bug in a file No skill needed Both sides of the proof found the same bugs
Tests before you change anything See best skills for writing tests tdd and test-driven-development, both proven

For reviewing a change rather than restructuring code, the code review and debugging guide compares the proven review skills.

How do I install improve-codebase-architecture in Claude Code?

The skill calls two others from the same repository, codebase-design and grilling, so install all three side by side:

npx degit mattpocock/skills/skills/engineering/improve-codebase-architecture .claude/skills/improve-codebase-architecture
npx degit mattpocock/skills/skills/engineering/codebase-design .claude/skills/codebase-design
npx degit mattpocock/skills/skills/productivity/grilling .claude/skills/grilling

That puts each skill at .claude/skills/<name>/SKILL.md, which Claude Code loads for that repository; ~/.claude/skills/ makes them available in all your projects. Claude uses skills when relevant, or you can invoke one directly with /skill-name, and a skill's body loads only when it is used. Because improve-codebase-architecture sets disable-model-invocation: true, Claude will not start it for you: type /improve-codebase-architecture, optionally with the module you want reviewed. Can an agent skill call another skill? explains how the calls to codebase-design and grilling work, and what disable-model-invocation does covers the field.

Are these skills safe to install?

improve-codebase-architecture (3 files), codebase-design (4 files) and grilling (2 files) were all Clear in the November 30, 2026 scan, which looks in every file of a skill's folder for patterns such as downloading and running code in one step, sending data out, reading credential files, or text that tries to override your instructions. Across the directory that day, 1,913 of 1,975 skills were clear, 49 need a manual look and 13 were flagged. The scan is a static check, not a guarantee; are agent skills safe? explains its limits, and the live skill check runs the same check on any GitHub link. Every proof is on proven skills.

Questions

Will Claude use improve-codebase-architecture on its own when I ask for a refactor?

No. Its SKILL.md sets disable-model-invocation: true, both at the proven commit and today, so Claude does not start it by itself. You run it by typing /improve-codebase-architecture. Our guide to disable-model-invocation explains what that field does.

Does the skill change my code?

Not at first. It reads the code, writes an HTML report to your temporary folder and asks which candidate you want to explore. Its SKILL.md says not to propose interfaces until you pick one, and then to walk through the decision with the grilling skill. It may add terms to a GLOSSARY.md file or offer to record a decision as an ADR.

Did the skill find more bugs than Claude without it?

No. On the Express checkout in the proof, both sides found the same serious problems in 3 of 3 runs, such as charging the card before the order is saved and the stock check race. The skill changed how the advice was framed, ranked and labelled, not what was found.

Did the skill's author pay for this proof?

No. Neither proof on this page was commissioned. Proofs are published whatever they show.