Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ciembor/agent-rules-books --skill refactoring -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/refactoring/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/refactoring/

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

Similar skills

All skills for Code review and refactoring →
refactoring_specialist AgenticOrgLab refactoring_specialist — a subagent for Claude Code plans code refactoring while preserving observable behavior. It pairs structural changes with regression protection. CX Codex ★ 776repo stars golang-refactoring samber golang-refactoring — a skill for behavior-preserving restructuring of Go code at scale. Uses gopls, gofmt, and tools like gopatch to break down large functions, rename types across a project, and reorganize packages without breakage. CX Codex +1 13,600installs java-refactoring-extract-method official github The java-refactoring-extract-method skill guides Extract Method refactoring for complex Java methods while preserving behaviour. Use it when a method needs smaller, focused units backed by tests. CX Codex +1 9,284installs refactoring-patterns wondelai refactoring-patterns — a skill that improves code structure through named, behavior-preserving transformations. Use it to eliminate duplication, break apart long methods, or realign responsibilities across classes. CX Codex +1 6,900installs refactoring-analysis Pedro Nauck refactoring-analysis audits architectural health and Fowler code smells, writing prioritized refactoring plans to docs/_refacs/. Built for planning refactoring while preserving existing behavior. CX Codex +1 434installs refactoring-code b-mendoza refactoring-code is a Claude Code skill that stages simplification refactors: approve the plan before edits, then check that behaviour stays the same. CX Codex +1 124installs

From the same set14

The whole set →
clean-code This Claude Code skill applies clean-code guidance to readability, naming, and function design. It activates during everyday coding and test-related tasks. CX Codex +1 683installs clean-architecture This Claude Code skill applies clean architecture principles to decisions about separating business policy from implementation details. It activates for work on dependency direction, use cases, and application boundaries. CX Codex +1 645installs a-philosophy-of-software-design The a-philosophy-of-software-design Claude Code skill applies software design principles to complexity, module boundaries, APIs, and abstractions. It activates during design reviews or refactoring of shallow interfaces. CX Codex +1 643installs code-complete The code-complete Claude Code skill applies software construction rules to routines, classes, control flow, defensive code, and tests. It activates for implementation and design tasks. CX Codex +1 611installs release-it The release-it Claude Code skill applies production reliability rules to failure handling, timeouts and retries. It activates on tasks involving integration failures, deployment or operational readiness. CX Codex +1 607installs the-pragmatic-programmer the-pragmatic-programmer — a skill for Claude Code and Codex applying Hunt and Thomas-inspired engineering guidelines. Triggers during architecture decisions, automation work, and code refactoring. CX Codex +1 603installs working-effectively-with-legacy-code working-effectively-with-legacy-code — a skill for Claude Code and Codex that enforces Michael Feathers' legacy code techniques. Activates during risky refactoring, missing test coverage, and dependency breaking. CX Codex +1 602installs refactoring-guru refactoring-guru — a skill for Claude Code helps diagnose code smells and choose focused refactoring techniques. The agent applies its rules to code changes while preserving behavior. CX Codex +1 598installs

Project sponsors

Companies that keep this analytics open