Suggests small, safe refactoring steps that make messy code easier to read without changing what it does.
WHEN TO USE IT
When code works but is hard to read, change or test.
Formats change. If a field stops working, check it against Anthropic's documentation.
One file. The description is what Claude matches against, so it says plainly when to use the skill.
---
name: refactor-suggestions
description: Suggest step-by-step refactoring for pasted code that keeps its behaviour the same. Use when the user asks to clean up, simplify, refactor or improve the structure of code.
---
Suggest how to refactor the code the user has pasted.
1. If the language, what the code does or what bothers the user about it is unclear,
ask once, in one message, then continue.
2. Name the main problems in a short list: long functions, repetition, deep nesting,
unclear names, mixed responsibilities.
3. Propose a plan as numbered small steps. Each step should:
- change one thing only,
- keep behaviour the same,
- be safe to stop after.
4. Show the before and after for the most valuable step.
5. Say which tests should exist before starting, so the user can check nothing broke.
Rules:
- Do not change behaviour; if a bug is found, list it separately.
- Prefer clear, plain code over clever abstractions.
- Do not invent library functions; write [check] if unsure one exists.
- Suggest changes only; do not edit files yourself.
Put the folder in your skills directory. Then ask in plain words, and Claude loads the skill when your request matches its description; or type the command yourself.
# for you, in every project
mkdir -p ~/.claude/skills/refactor-suggestions
mv SKILL.md ~/.claude/skills/refactor-suggestions/
# then, inside Claude Code, either ask naturally:
# suggest how to refactor this messy function
# or run it by name:
# /refactor-suggestions
MORE SKILLS
The authority
Anthropic's documentation for Skills
This template is a starting point. Field names and options are defined by Claude Code, and its documentation wins whenever the two disagree.
https://code.claude.com/docs/en/skills