# Twiced Technology Gmbh Seedr Refactoring Techniques

> Refactoring Techniques

- Skill: `tomevault-io/twiced-technology-gmbh-seedr-refactoring-techniques` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/twiced-technology-gmbh-seedr-refactoring-techniques`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/twiced-technology-gmbh-seedr-refactoring-techniques/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/twiced-technology-gmbh-seedr-refactoring-techniques

---


# Refactoring Techniques

66 classic refactoring techniques organized into 6 categories.

## Quick Reference

| Category | Count | When to Use |
|----------|-------|-------------|
| [Composing Methods](references/composing-methods.md) | 9 | Methods too long, complex expressions, tangled local variables |
| [Moving Features](references/moving-features.md) | 8 | Features in wrong class, class does too much/little |
| [Organizing Data](references/organizing-data.md) | 16 | Data fields need encapsulation, type codes, magic numbers |
| [Simplifying Conditionals](references/simplifying-conditionals.md) | 8 | Complex conditionals, nested if/else, null checks |
| [Simplifying Method Calls](references/simplifying-method-calls.md) | 14 | Awkward method signatures, unclear naming, side effects |
| [Dealing with Generalization](references/dealing-with-generalization.md) | 12 | Inheritance hierarchy issues, duplicate code across subclasses |

## Technique Selection Guide

### For Long/Complex Methods
1. **Extract Method** - Group related code into named method
2. **Extract Variable** - Break complex expressions into named parts
3. **Replace Temp with Query** - Convert temp variables to methods
4. **Replace Method with Method Object** - When local vars prevent extraction

### For Misplaced Features
1. **Move Method/Field** - Feature used more in another class
2. **Extract Class** - Class has multiple responsibilities
3. **Inline Class** - Class does almost nothing

### For Data Organization
1. **Encapsulate Field/Collection** - Public fields need protection
2. **Replace Magic Number with Constant** - Unclear numeric literals
3. **Replace Type Code with Subclasses/State-Strategy** - Type codes controlling behavior

### For Complex Conditionals
1. **Decompose Conditional** - Long if/else blocks
2. **Replace Conditional with Polymorphism** - Type-based switching
3. **Replace Nested Conditional with Guard Clauses** - Deep nesting
4. **Introduce Null Object** - Many null checks

### For Method Signatures
1. **Introduce Parameter Object** - Repeating parameter groups
2. **Preserve Whole Object** - Passing multiple values from same object
3. **Separate Query from Modifier** - Method has side effects
4. **Replace Constructor with Factory Method** - Complex object creation

### For Inheritance Issues
1. **Pull Up Method/Field** - Duplicate code in subclasses
2. **Push Down Method/Field** - Feature only used by some subclasses
3. **Extract Superclass/Interface** - Common features across classes
4. **Replace Inheritance with Delegation** - Subclass doesn't truly extend parent

## Workflow

1. **Identify the smell** - Name the specific code smell (e.g., Long Method, Large Class, Long Parameter List, Feature Envy)
2. **Select technique** - Use the selection guide above
3. **Read technique details** - Load the appropriate reference file and cite it (e.g., "See [Composing Methods](references/composing-methods.md) for full details")
4. **Show before/after** - Always include a concrete code example showing the code before and after applying the primary technique
5. **Apply incrementally** - Make small, verifiable changes
6. **Test after each step** - Ensure behavior is preserved

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/twiced-technology-gmbh) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-15 -->

