Guide · Agent skill
How to use the Max the Refactorer agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
Max is an agent skill that makes an AI agent act as a careful code optimizer. It cleans up code that already works and is already tested, looking at slow algorithms, repeated database queries, duplicated logic and dead code. This guide explains what agent skills are, how to install Max, how to ask for it in plain language, and where its limits are, so you can decide whether it fits your project.
Quick start
- 1Download the ZIP. Get the Max skill ZIP from this directory page and unzip it.
- 2Place the skill folder. Copy the unzipped folder into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder for one project.
- 3Or upload it in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the skill.
- 4Confirm your tests pass. Make sure the module you want to refactor has a passing test suite before you ask for changes.
- 5Ask for a scoped change. Name the goal (refactor, optimization or cleanup), the files, and that behavior must not change.
- 6Review the report. Check each change's before and after details, the dead code list and the test status.
- 7Verify manually. Run your tests and review the diff, checking public API, ordering and side effects before merging.
What an agent skill is and what Max does
An agent skill is a folder of instructions, packaged with a SKILL.md file, that an AI agent can load when it is relevant to a task. Max is one such skill. Its description is: cleans up and improves existing code without changing behavior.
Max only runs when someone explicitly asks for it. He is never invoked automatically. When called, he works on code that already passes its tests, aiming to keep behavior identical.
- Algorithmic optimization: looks for better time complexity and fixes N+1 database queries, missing indexes and batchable operations, documenting before and after complexity.
- Code abstraction: extracts logic duplicated in three or more places into a named, tested helper, following the Rule of Three.
- Dead code removal: removes unused imports, variables, functions and files after checking nothing references them, plus resolved TODOs and leftover debug logging.
- Readability: renames only genuinely misleading identifiers, splits very long functions and flattens deep nesting.
Install the Max skill from the ZIP or the Claude apps
Download the ZIP for the Max skill from this directory page and unzip it. To make it available across your own projects, place the unzipped skill folder in ~/.claude/skills/. To scope it to a single project, place it in that project's .claude/skills/ folder.
If you use the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.
- Personal install: ~/.claude/skills/
- Project install: the project's .claude/skills/ folder
- Claude apps: Settings → Capabilities → Skills
~/.claude/skills/Trigger Max with clear, scoped requests
Max does not run on its own, so you need to ask for it. Name the kind of work you want: a scoped refactor, a measured optimization, or a cleanup. Name the module or files involved, and say that behavior must stay the same.
Good requests state a goal and a boundary. Vague requests like 'make this better' are the kind Max is designed to decline, because it does not make purely cosmetic changes with no measurable benefit.
- 'Use the max skill to remove dead code and unused imports from the billing module. Behavior must not change.'
- 'Use max to find N+1 queries in the orders service and batch them, then report the before and after.'
- 'Use max to extract the duplicated date-formatting logic in these three files into one helper.'
What Max needs before it starts
The skill lists no hard requirements. The important practical requirement is a test suite. Max's rules require that tests stay green before and after every change, so code without tests cannot be verified as behavior-preserving.
Max's file references Mason, Luna and Quinn as optional roles. If those named companion skills are not installed, the workflow may reduce to general guidance.
- Existing code with a passing test suite
- Optional: the companion skills Mason, Luna and Quinn, which the file names as roles
- No scripts are run and no network access is used
Read the report Max produces
Max reports each change in a structured format so you can review it. Each entry lists the files changed, what the code was before, what it is after, the measured impact, and test status. The report also lists dead code removed, changes deferred and the final test count.
Treat the report as a review checklist. Passing tests are bounded evidence, not proof that behavior is identical. Check the public API, ordering, side effects, resource use and concurrency where they apply.
- Changes Made, with before, after, impact and test status for each
- Dead Code Removed, with the reason each item was safe to remove
- Deferred items, with the reason they were left alone
- Test Suite Status: passing and failing counts
Safety notes and tips
Max is a set of instructions for an AI agent, so its output still needs verification. The skill's own limitations say that agents can hallucinate or give incorrect guidance, and that generated code and designs should be checked before production.
If you ask for a change that alters behavior, Max flags it as out of scope and routes it back to the main agent as a new feature. Use it for behavior-preserving work only.
- Keep the work to one concern per pass: performance, abstraction or cleanup, not all three together.
- Run your tests yourself before and after, and review the diff.
- Keep private data and secrets out of the reports.
- Ask for a behavior change through your normal feature process, not through Max.
What people use it for
- Removing dead code, unused imports and leftover debug logging from a module that already has passing tests.
- Finding N+1 database queries in a service and batching them, with before and after complexity documented.
- Extracting logic duplicated in three or more places into one named, tested helper.
- Flattening deeply nested conditionals or splitting a very long function into named sub-functions.
- Reviewing a project that is accumulating duplicated logic and resolved TODO comments.
Frequently asked questions
How do I install the Max agent skill?
Download the ZIP from this page and unzip it. Place the folder in ~/.claude/skills/ for personal use, or in a project's .claude/skills/ folder for one project. In the Claude apps, you can upload it under Settings → Capabilities → Skills.
Does Max require anything to run?
The skill lists no requirements and runs no scripts and uses no network. In practice it depends on your code having a passing test suite, since Max must keep tests green to verify behavior is preserved.
Is the Max skill free to use?
The skill is released under the MIT licence. Check the licence file in the source repository for the full terms.
Will Max refactor my code automatically?
No. Max is never invoked automatically. It only applies when someone explicitly asks for a scoped refactor or measured optimization.
Can Max add new features or change behavior?
No. Max is designed to preserve behavior. If a request needs a behavioral change, it flags the work as out of scope and routes it back to the main agent to go through a feature process.
What if my code has no tests?
Max depends on tests staying green, so without a test suite it cannot verify that behavior is preserved. Add tests first, or use a different approach.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Max is a good fit for developers and teams who have a tested module and want a scoped cleanup, dead code removal or measured performance fix with clear before and after reporting. It is the wrong choice for code without tests, for adding features or changing behavior, or if you want an agent that makes broad changes on its own.
Download the skill