Agent skill · Code Review & Quality

refactoring-patterns

Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", "technical debt", "move method", "inline variable", "decompose conditional", or "clean up this messy code". Also trigger when cleaning up legacy code, preparing code for new features by restructuring, or identifying which transformation fits a specific code smell. Covers smell-driven refactoring, safe transformation sequences, and testing guards. For code-quality foundations, see clean-code. For managing

wondelaigithub.com/wondelaiGitHub ↗
claude-codeMIT
Install
npx skills add wondelai/skills --skill refactoring-patterns --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 7
SKILL.md size: 16 KB
Bundled scripts: none
Version: 1.4.1
Declared author: wondelai
Path: refactoring-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 1,835
Language: Shell
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Refactoring Patterns Framework A disciplined approach to improving the internal structure of existing code without changing its observable behavior. Every refactoring follows the same loop: verify tests pass, apply one small structural change, verify tests still pass. ## Core Principle **Refactoring is not rewriting. It is a sequence of small, behavior-preserving transformations, each backed by tests.** You never change what the code does — only how it is organized. Big-bang rewrites fail because they combine structural change with behavioral change, making it impossible to know which broke things. **The foundation:** Bad code is a natural consequence of delivering under time pressure, not a character flaw. Code smells are objective signals of degraded structure; the smell catalog tells you *where* to look, and the refactoring catalog tells you *what to do*. ## Scoring **Goal: 10/10.** Score structural quality by how many of the eight [Quick Diagnostic](#quick-diagnostic) rows pass — `score = round(passed / 8 × 10)`, adjusting down when a single smell is severe. Bands: - **9-10**: no obvious smells remain, each function does one thing, names reveal intent, duplication is eliminat

What's inside
Steps it walks through
  1. Core Principle
  2. Scoring
  3. The Refactoring Patterns Framework
  4. 1. Code Smells as Triggers
  5. 2. Composing Methods
  6. 3. Moving Features Between Objects
  7. 4. Organizing Data
  8. 5. Simplifying Conditional Logic
  9. 6. Safe Refactoring Workflow
  10. Common Mistakes
  11. Quick Diagnostic
  12. Further Reading
  13. About the Author
Ships with 6 files
  • references/composing-methods.md
  • references/moving-features.md
  • references/organizing-data.md
  • references/refactoring-workflow.md
  • references/simplifying-conditionals.md
  • references/smell-catalog.md
More from skills
All skills →
About this skill
What does the refactoring-patterns skill do?

Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", "technical debt", "move method", "inline variable", "decompose conditional", or "clean up this messy code". Also trigger when cleaning up legacy code, preparing code for new features by restructuring, or identifying which transformation fits a specific code smell. Covers smell-driven refactoring, safe transformation sequences, and testing guards. For code-quality foundations, see clean-code. For managing

How do I install it?

Run `npx skills add wondelai/skills --skill refactoring-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From wondelai/skills, a repository with 1,835 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going