AI agent skills for refactoring
A refactoring skill's job is to keep behaviour fixed while structure changes, and to keep the diff small enough to review. The better ones require a green test run before and after, and refuse to bundle a behaviour change into the same commit. Be wary of anything that promises to modernise a whole codebase in one pass: the review burden of a 4,000-line diff is the reason that work never lands.
People land here searching for “claude code refactoring skill”, “agent skill to clean up code”, “legacy code refactor skill”.
56 refactoring skills Refine in search →
-
curiositech Bundle Refactoring SurgeonExpert code refactoring specialist for improving code quality without changing behavior. Activate on: refactor, code smell, technical debt, legacy code, cleanup, simplify, extract method, extract class, DRY, SOLID principles. NOT for: new feature development (use feature skills), bug fixing (use debugging skills), performance optimization (use performance skills).
10 -
majiayu000 Bundle Refactoring SurgeonExpert code refactoring specialist for improving code quality without changing behavior. Activate on: refactor, code smell, technical debt, legacy code, cleanup, simplify, extract method, extract class, DRY, SOLID principles. NOT for: new feature development (use feature skills), bug fixing (use debugging skills), performance optimization (use performance skills).
567 -
majiayu000 Bundle Cleanup RefactorSimplify code and remove legacy/backcompat shims while preserving behavior. Use when asked to clean up or simplify code.
567 -
majiayu000 Bundle Refactor Legacy CodeModernize and improve legacy codebases while maintaining functionality. Use when you need to refactor old code, reduce technical debt, modernize deprecated patterns, or improve code maintainability without breaking existing behavior.
567 -
cskwork Skill Clean CodeRefactor legacy code for readability and maintainability while preserving observable behavior and externally consumed contracts.
-
bitsocialnet Skill Refactor PassSimplify code while preserving behavior when the user requests a refactor or cleanup pass.
Audited -
cskwork Skill Clean Code 2Refactor legacy code for readability and maintainability while preserving observable behavior and externally consumed contracts.
-
mkanat Skill CleanupClean up the design of a large change, or a whole codebase.
-
iabhisekbosepm Skill CleanupRefactoring sprint: remove dead code, eliminate duplicates, simplify complex code.
-
s-hiraoku Skill SimplifyReview changed code on the current branch for reuse, clarity, and dead complexity, then propose or apply minimal cleanup without changing behavior.
-
luc4n3x Skill Thalarch RefactorBehavior-preserving refactoring protocol for simplifying, restructuring, modularizing, or modernizing existing code without silently changing externally observable behavior. Use for non-trivial cleanup, decomposition, abstraction changes, package/module moves, or legacy modernization where regression risk matters.
-
herdiansah Skill Code RefactoringRefactor legacy codebases, migrate outdated frameworks, and implement gradual modernization. Handles technical debt, dependency updates, and backward compatibility. Use PROACTIVELY for legacy system updates, framework migrations, or technical debt reduction.
Audited 23 -
eroslifestyle Skill Refactor CleanClean up dead code, unused imports, and improve code organization. Use /refactor for automated cleanup.
-
majiayu000 Bundle Elon MuskDelete-first refactoring for legacy systems: remove low-value code early, then re-add only what data proves necessary. Use when: (1) legacy code has obvious bloat/duplication, (2) complexity is blocking delivery, (3) the team can run tests, feature flags, and rollback.
567 -
majiayu000 Bundle Code Cleanup 2Refactor and clean up code following best practices for readability and maintainability
567 -
henryhawke Bundle Code RefactoringUse when the user wants to refactor code, modernize legacy codebases, migrate frameworks, reduce technical debt, or update dependencies. Handles backward compatibility and gradual modernization strategies.
-
zpankz Skill Code RefactoringThe practice of restructuring and simplifying code continuously – reducing complexity, improving design, and keeping codebases clean.
-
julianromli Bundle Refactor CleanSafely identify and remove dead code with test verification at every step. Use when Codex needs to clean unused exports, files, dependencies, helpers, wrappers, re-exports, or duplicate code without risking regressions. Trigger for dead-code cleanup, unused dependency audits, stale utility removal, cleanup refactors, or requests to reduce code safely before or alongside maintenance work.
-
aj-geddes-useful-ai-prompts Bundle Refactor Legacy CodeModernize and improve legacy codebases while maintaining functionality. Use when you need to refactor old code, reduce technical debt, modernize deprecated patterns, or improve code maintainability without breaking existing behavior.
-
tomevault-io Bundle Refactor Pass 3Perform a refactor pass focused on simplicity after recent changes. Use when the user asks for a refactor/cleanup pass, simplification, or dead-code removal and expects build/tests to verify behavior. Use when this capability is needed.
-
eroslifestyle Skill Refactor Clean 2Clean up dead code, unused imports, and improve code organization. Use /refactor for automated cleanup.
-
sylphxai Skill Source Command CleanupClean technical debt, refactor, optimize, and simplify codebase
-
j03fr0st Bundle SimplifySimplify working code for clarity and maintainability while preserving observable behavior. Use for requested cleanup of recent changes or a named area, reducing unnecessary nesting, duplication, or indirection. Architecture decisions belong to codebase-design; unknown failures belong to diagnosing-bugs.
-
mahdtech Skill Refactor CodebaseRemove engineering debt, untangle large modules, collapse duplicated logic, and modernize legacy patterns without changing behavior. Use when refactoring a codebase, removing dead code, or cleaning up stale abstractions.
How to install a refactoring skill
- Compare the skills. Read the refactoring skills below — each page shows the full SKILL.md, its safety verdict, and the capabilities it declares.
- Install it. Run npx skillmds@latest add <owner>/<name>. The CLI writes the skill into every agent directory it detects, or use --agent to pin one.
- Use it. Restart your agent. It loads the skill on demand the next time you ask for something that matches — you do not have to name the skill.
What makes a good refactoring skill?
A refactoring skill's job is to keep behaviour fixed while structure changes, and to keep the diff small enough to review. The better ones require a green test run before and after, and refuse to bundle a behaviour change into the same commit. Be wary of anything that promises to modernise a whole codebase in one pass: the review burden of a 4,000-line diff is the reason that work never lands.
Every skill listed here is a plain SKILL.md file in the format Anthropic documents for Agent Skills, read unchanged by Cursor, OpenAI Codex and 60+ agents. Each passes a safety review before it is publicly listed; the verdict and declared capabilities are on every skill's page.
Frequently asked questions
What is an agent skill for refactoring?
A refactoring skill's job is to keep behaviour fixed while structure changes, and to keep the diff small enough to review. The better ones require a green test run before and after, and refuse to bundle a behaviour change into the same commit. Be wary of anything that promises to modernise a whole codebase in one pass: the review burden of a 4,000-line diff is the reason that work never lands.
Is it safe to let an agent refactor without tests?
No, and good refactoring skills say so explicitly — several will stop and ask you to add characterization tests first. Without a test, neither you nor the agent can tell a refactor from a rewrite.
Which agents can use these refactoring skills?
Any agent that reads SKILL.md files: Claude Code, Claude.ai, Cursor, OpenAI Codex, Windsurf, OpenCode and 60+ others. The format is not vendor-specific, so the same file works everywhere — each agent just keeps its skills in a different directory, listed at /agents.
Are these refactoring skills free?
Yes. Searching, reading and installing skills on SkillMD is free and needs no account. Individual skills carry their own licence, shown on each skill's page.