refactoring — Claude Code skill: what it does, how to install
This Claude Code skill applies Martin Fowler-inspired rules to refactoring. It activates for code-structure changes that preserve observable behavior.
MIT 670 installs ★ 3,328 updated 2026-09-10
npx skills add ciembor/agent-rules-books --skill refactoring -a claude-codeWhat refactoring does
The skill guides changes to existing code while keeping its observable behavior intact. It covers refactoring tasks, code smells, and test-backed cleanup. Feature work stays separate from structural changes.
Before choosing an approach, the agent reads refactoring.mini.md and follows its rules. It consults refactoring.md as a deeper reference when the shorter rules do not resolve a particular refactoring tradeoff. Both files support the skill’s guidance.
What it helps with
- improve code structure without changing behavior
- identify and address code smells
- clean up code with tests as a safety net
- keep refactoring separate from feature changes
Example prompts for the agent
- Refactor this code while preserving its observable behavior and using the tests as a guide.
- Address the code smells in small steps without adding features.
How to install refactoring
1Skills CLI (Vercel)
npx skills add ciembor/agent-rules-books --skill refactoring -a claude-code2Manually: put the files in place
~/.claude/skills/refactoring/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/refactoring/
1Skills CLI (Vercel)
npx skills add ciembor/agent-rules-books --skill refactoring -a codex2Manually: put the files in place
.agents/skills/refactoring/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ciembor/agent-rules-books --skill refactoring -a cursor2Manually: put the files in place
.cursor/skills/refactoring/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ciembor/agent-rules-books refactoring2Manually: put the files in place
.github/skills/refactoring/SKILL.md1Skills CLI (Vercel)
npx skills add ciembor/agent-rules-books --skill refactoring -a gemini-cli2Platform CLI
gemini skills install https://github.com/ciembor/agent-rules-books --path refactoringManually: put the files in place
.devin/skills/refactoring/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ciembor/agent-rules-books --skill refactoring -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about refactoring
How do I install refactoring in Claude Code?
Run npx skills add ciembor/agent-rules-books --skill refactoring -a claude-code. The skill file is at ~/.claude/skills/refactoring/SKILL.md.
What does refactoring do?
It provides rules for improving existing code structure while preserving observable behavior. The guidance separates refactoring from feature changes.
Which rule files does refactoring use?
The agent reads refactoring.mini.md before making design or code decisions. It uses refactoring.md as a deeper reference when the shorter rules do not cover the tradeoff.
Source text
SKILL.md · MIT
--- name: refactoring description: Apply Martin Fowler-inspired refactoring rules when improving existing code structure while preserving observable behavior. license: MIT --- # Refactoring Skill Use this skill when a task involves behavior-preserving code improvement, code smells, small refactoring steps, test-backed cleanup, or separating refactoring from feature changes. Before making design or code decisions, read and apply [refactoring.mini.md](refactoring.mini.md). Use [refactoring.md](refactoring.md) only as a deeper reference when the mini rules are not enough for the current refactoring tradeoff.
© ciembor · MIT · ciembor/agent-rules-books