66 classic refactoring techniques organized into 6 categories.
Quick Reference
Category
Count
When to Use
Composing Methods
9
Methods too long, complex expressions, tangled local variables
Moving Features
8
Features in wrong class, class does too much/little
Organizing Data
16
Data fields need encapsulation, type codes, magic numbers
Simplifying Conditionals
8
Complex conditionals, nested if/else, null checks
Simplifying Method Calls
14
Awkward method signatures, unclear naming, side effects
Dealing with Generalization
12
Inheritance hierarchy issues, duplicate code across subclasses
Technique Selection Guide
For Long/Complex Methods
Extract Method - Group related code into named method
Extract Variable - Break complex expressions into named parts
Replace Temp with Query - Convert temp variables to methods
Replace Method with Method Object - When local vars prevent extraction
For Misplaced Features
Move Method/Field - Feature used more in another class
Extract Class - Class has multiple responsibilities
Inline Class - Class does almost nothing
For Data Organization
Encapsulate Field/Collection - Public fields need protection
Replace Magic Number with Constant - Unclear numeric literals
Replace Type Code with Subclasses/State-Strategy - Type codes controlling behavior
For Complex Conditionals
Decompose Conditional - Long if/else blocks
Replace Conditional with Polymorphism - Type-based switching
Replace Nested Conditional with Guard Clauses - Deep nesting
Introduce Null Object - Many null checks
For Method Signatures
Introduce Parameter Object - Repeating parameter groups
Preserve Whole Object - Passing multiple values from same object
Separate Query from Modifier - Method has side effects
Replace Constructor with Factory Method - Complex object creation
For Inheritance Issues
Pull Up Method/Field - Duplicate code in subclasses
Push Down Method/Field - Feature only used by some subclasses
Extract Superclass/Interface - Common features across classes
Replace Inheritance with Delegation - Subclass doesn't truly extend parent
Workflow
Identify the smell - Name the specific code smell (e.g., Long Method, Large Class, Long Parameter List, Feature Envy)
Select technique - Use the selection guide above
Read technique details - Load the appropriate reference file and cite it (e.g., "See Composing Methods for full details")
Show before/after - Always include a concrete code example showing the code before and after applying the primary technique
Apply incrementally - Make small, verifiable changes
Test after each step - Ensure behavior is preserved
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: twiced-technology-gmbh-seedr-refactoring-techniques3description: Refactoring Techniques4---56# Refactoring Techniques7866 classic refactoring techniques organized into 6 categories.910## Quick Reference1112| Category | Count | When to Use |13|----------|-------|-------------|14| [Composing Methods](references/composing-methods.md) | 9 | Methods too long, complex expressions, tangled local variables |15| [Moving Features](references/moving-features.md) | 8 | Features in wrong class, class does too much/little |16| [Organizing Data](references/organizing-data.md) | 16 | Data fields need encapsulation, type codes, magic numbers |17| [Simplifying Conditionals](references/simplifying-conditionals.md) | 8 | Complex conditionals, nested if/else, null checks |18| [Simplifying Method Calls](references/simplifying-method-calls.md) | 14 | Awkward method signatures, unclear naming, side effects |19| [Dealing with Generalization](references/dealing-with-generalization.md) | 12 | Inheritance hierarchy issues, duplicate code across subclasses |2021## Technique Selection Guide2223### For Long/Complex Methods241. **Extract Method** - Group related code into named method252. **Extract Variable** - Break complex expressions into named parts263. **Replace Temp with Query** - Convert temp variables to methods274. **Replace Method with Method Object** - When local vars prevent extraction2829### For Misplaced Features301. **Move Method/Field** - Feature used more in another class312. **Extract Class** - Class has multiple responsibilities323. **Inline Class** - Class does almost nothing3334### For Data Organization351. **Encapsulate Field/Collection** - Public fields need protection362. **Replace Magic Number with Constant** - Unclear numeric literals373. **Replace Type Code with Subclasses/State-Strategy** - Type codes controlling behavior3839### For Complex Conditionals401. **Decompose Conditional** - Long if/else blocks412. **Replace Conditional with Polymorphism** - Type-based switching423. **Replace Nested Conditional with Guard Clauses** - Deep nesting434. **Introduce Null Object** - Many null checks4445### For Method Signatures461. **Introduce Parameter Object** - Repeating parameter groups472. **Preserve Whole Object** - Passing multiple values from same object483. **Separate Query from Modifier** - Method has side effects494. **Replace Constructor with Factory Method** - Complex object creation5051### For Inheritance Issues521. **Pull Up Method/Field** - Duplicate code in subclasses532. **Push Down Method/Field** - Feature only used by some subclasses543. **Extract Superclass/Interface** - Common features across classes554. **Replace Inheritance with Delegation** - Subclass doesn't truly extend parent5657## Workflow58591. **Identify the smell** - Name the specific code smell (e.g., Long Method, Large Class, Long Parameter List, Feature Envy)602. **Select technique** - Use the selection guide above613. **Read technique details** - Load the appropriate reference file and cite it (e.g., "See [Composing Methods](references/composing-methods.md) for full details")624. **Show before/after** - Always include a concrete code example showing the code before and after applying the primary technique635. **Apply incrementally** - Make small, verifiable changes646. **Test after each step** - Ensure behavior is preserved6566---67> Converted and distributed by [TomeVault](https://tomevault.io/claim/twiced-technology-gmbh) — claim your Tome and manage your conversions.68<!-- tomevault:4.0:skill_md:2026-04-15 -->
Run npx skillmds@latest add tomevault-io/twiced-technology-gmbh-seedr-refactoring-techniques in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Refactoring Techniques It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.