---
name: fowler-refactoring-names
source: https://app.decimal.ai/s/fowler-refactoring-names@1/SKILL.md
source_sha256: 9eff5628ea56
---

# Canonical refactoring names

## Contract

When you identify or recommend a refactoring, name it with the **exact canonical
term** from the standard refactoring catalog. The catalog was re-titled in its
current edition: several long-familiar names were renamed. Use the CURRENT
canonical name, not the older name and not an informal paraphrase.

## Rules

Match the situation to the one canonical name. The third column is the wrong
default to avoid.

| Situation | Canonical name | Do NOT say |
|---|---|---|
| Pull a fragment of a routine into its own named routine | **Extract Function** | Extract Method |
| Fold a trivial routine's body back into its callers | **Inline Function** | Inline Method |
| Give a sub-expression its own named local | **Extract Variable** | Introduce Explaining Variable |
| Remove a temporary that only mirrors an expression | **Inline Variable** | Inline Temp |
| Rename a function, or add/remove a parameter (any signature change) | **Change Function Declaration** | Rename Method / Add Parameter |
| Relocate a routine to the class/module it truly belongs on | **Move Function** | Move Method |
| Replace a bare number or string literal with a named constant | **Replace Magic Literal** | Replace Magic Number with Symbolic Constant |
| Pull a tangled test and its branches into named routines | **Decompose Conditional** | (generic) simplify the if |
| Flatten nesting by returning early on special preconditions | **Replace Nested Conditional with Guard Clauses** | (bare) guard clauses / early returns |
| Delete unused, unreachable code | **Remove Dead Code** | Delete Dead Code |
| Split a class's second responsibility into a new class | **Extract Class** | Split Class |
| Replace a type switch with subclass overrides | **Replace Conditional with Polymorphism** | Use Polymorphism |
| Bundle parameters that travel together into one object | **Introduce Parameter Object** | Extract Parameter Object |
| Rewrite a loop as a filter/map collection chain | **Replace Loop with Pipeline** | Replace Loop with Stream |
| Separate one loop that does two unrelated jobs | **Split Loop** | Separate Loop |
| Move a declaration next to its first use | **Slide Statements** | Move Statement / Reorder Statements |
| Group free functions that share data into a class | **Combine Functions into Class** | Group Functions into Class |
| Route access to a variable through accessor routines | **Encapsulate Variable** | Encapsulate Field / Self-Encapsulate Field |
| Split a routine that both returns a value and mutates state | **Separate Query from Modifier** | Split Command and Query |
| Separate two stages (parse then compute) mixed in one routine | **Split Phase** | Separate Phases |
| Swap a method body for a clearer equivalent algorithm | **Substitute Algorithm** | Replace Algorithm |
| Merge near-identical routines that differ only by a value | **Parameterize Function** | Parameterize Method |
| Move a duplicated method up to the shared superclass | **Pull Up Method** | Move Up Method |
| Move a superclass method down to its one relevant subclass | **Push Down Method** | Move Down Method |
| Replace a temporary with a method that recomputes it | **Replace Temp with Query** | Replace Variable with Method |
| Combine conditionals that all yield the same result | **Consolidate Conditional Expression** | Combine Conditionals |

Rules that hold for every entry:

1. Use the name **verbatim**, in title case, exactly as the catalog spells it.
2. Prefer the CURRENT name over any former name (see the renames below).
3. Never invent a variant ("Extract Helper", "Swap Algorithm") — the catalog name
   is a fixed term of art, not a description you compose.

## The renames (current name ← former name)

- Extract Function ← Extract Method
- Inline Function ← Inline Method
- Extract Variable ← Introduce Explaining Variable
- Inline Variable ← Inline Temp
- Change Function Declaration ← Rename Method / Add Parameter / Change Signature
- Move Function ← Move Method
- Replace Magic Literal ← Replace Magic Number with Symbolic Constant
- Encapsulate Variable ← Encapsulate Field / Self-Encapsulate Field
- Parameterize Function ← Parameterize Method

## Worked examples

Each pair is the base's likely name (BEFORE) → the canonical name (AFTER).

- "Extract Method" → **Extract Function**
- "Replace Magic Number with Symbolic Constant" → **Replace Magic Literal**
- "Rename Method" (for a signature change) → **Change Function Declaration**
- "Inline Temp" → **Inline Variable**
- "Encapsulate Field" → **Encapsulate Variable**
- "Move Method" → **Move Function**
- "Parameterize Method" → **Parameterize Function**
- "guard clauses" (as the whole name) → **Replace Nested Conditional with Guard Clauses**

## Edge cases

- **One name covers several old ones.** Renaming a function, adding a parameter,
  and removing a parameter are all **Change Function Declaration** — do not return
  the old sub-names as if they were separate refactorings.
- **Extract Variable vs Extract Function.** Naming a sub-expression in a local is
  Extract Variable; lifting a block into a callable routine is Extract Function.
- **Extract Class vs Combine Functions into Class.** Splitting responsibilities out
  of an existing class is Extract Class; gathering free functions that share data
  into a new class is Combine Functions into Class.
- **Guard clauses.** The full canonical name is *Replace Nested Conditional with
  Guard Clauses* — "guard clauses" alone names the technique, not the refactoring.

## Do / Don't

- **Do** write "Extract Function"; **don't** write "Extract Method".
- **Do** write "Replace Magic Literal"; **don't** write "Replace Magic Number".
- **Do** write "Change Function Declaration" for a rename; **don't** write "Rename Method".
- **Do** write "Inline Variable"; **don't** write "Inline Temp".
- **Do** write "Encapsulate Variable"; **don't** write "Encapsulate Field".
- **Do** give the full "Replace Nested Conditional with Guard Clauses"; **don't** abbreviate to "guard clauses".

## Common mistakes

- Using the pre-rename name (Extract Method, Move Method, Inline Temp) out of habit.
- Answering "Rename Method" / "Add Parameter" instead of the umbrella Change Function Declaration.
- Returning a plain-English description ("break it into smaller functions") instead of the term of art.
- Coining a plausible-sounding variant ("Extract Helper", "Replace Switch with Polymorphism") the catalog does not use.

## Quick checklist

- [ ] Exact catalog name, title case, verbatim.
- [ ] Current name, not the former name.
- [ ] Umbrella name where the catalog folds several (Change Function Declaration).
- [ ] No invented variant, no plain-English paraphrase.
