$npx -y skills add krzysztofsurdy/code-virtuoso --skill refactoringComprehensive skill for 89 refactoring techniques and 22 code smells with practical examples. Use when the user asks to refactor code, detect code smells, improve code quality, reduce complexity, or clean up technical debt. Covers composing methods, moving features between object
| 1 | # Refactoring |
| 2 | |
| 3 | A thorough reference covering 89 refactoring techniques and code smells — featuring PHP 8.3+ examples, rationale, step-by-step mechanics, and before/after comparisons. |
| 4 | |
| 5 | ## Refactoring Techniques (67) |
| 6 | |
| 7 | ### Composing Methods |
| 8 | - **Extract Method** — Pull code fragments into named methods → [reference](references/extract-method.md) |
| 9 | - **Inline Method** — Substitute a method call with its body → [reference](references/inline-method.md) |
| 10 | - **Extract Variable** — Give complex expressions meaningful names through explanatory variables → [reference](references/extract-variable.md) |
| 11 | - **Inline Temp** — Substitute a temporary variable with its expression → [reference](references/inline-temp.md) |
| 12 | - **Replace Temp with Query** — Swap temp variables for method calls → [reference](references/replace-temp-with-query.md) |
| 13 | - **Split Temporary Variable** — Assign separate variables for separate purposes → [reference](references/split-temporary-variable.md) |
| 14 | - **Remove Assignments to Parameters** — Introduce local variables rather than reassigning parameters → [reference](references/remove-assignments-to-parameters.md) |
| 15 | - **Replace Method with Method Object** — Convert a complex method into its own class → [reference](references/replace-method-with-method-object.md) |
| 16 | - **Substitute Algorithm** — Swap an algorithm for a clearer alternative → [reference](references/substitute-algorithm.md) |
| 17 | |
| 18 | ### Moving Features Between Objects |
| 19 | - **Move Method** — Relocate a method to the class that depends on it most → [reference](references/move-method.md) |
| 20 | - **Move Field** — Relocate a field to the class that depends on it most → [reference](references/move-field.md) |
| 21 | - **Extract Class** — Divide a class that handles too much → [reference](references/extract-class.md) |
| 22 | - **Inline Class** — Consolidate a class that does too little → [reference](references/inline-class.md) |
| 23 | - **Hide Delegate** — Introduce methods that conceal delegation chains → [reference](references/hide-delegate.md) |
| 24 | - **Remove Middle Man** — Allow clients to call the delegate directly → [reference](references/remove-middle-man.md) |
| 25 | - **Introduce Foreign Method** — Attach a missing method to a class you cannot modify → [reference](references/introduce-foreign-method.md) |
| 26 | - **Introduce Local Extension** — Build a wrapper or subclass for a library class → [reference](references/introduce-local-extension.md) |
| 27 | |
| 28 | ### Organizing Data |
| 29 | - **Self Encapsulate Field** — Route field access through getters even within the class → [reference](references/self-encapsulate-field.md) |
| 30 | - **Replace Data Value with Object** — Promote primitive data to a rich object → [reference](references/replace-data-value-with-object.md) |
| 31 | - **Change Value to Reference** — Convert value objects into reference objects → [reference](references/change-value-to-reference.md) |
| 32 | - **Change Reference to Value** — Convert reference objects into value objects → [reference](references/change-reference-to-value.md) |
| 33 | - **Replace Array with Object** — Swap arrays used as data structures for proper objects → [reference](references/replace-array-with-object.md) |
| 34 | - **Duplicate Observed Data** — Keep domain data in sync with the UI via Observer → [reference](references/duplicate-observed-data.md) |
| 35 | - **Change Unidirectional to Bidirectional** — Introduce back-references when needed → [reference](references/change-unidirectional-association-to-bidirectional.md) |
| 36 | - **Change Bidirectional to Unidirectional** — Eliminate unnecessary back-references → [reference](references/change-bidirectional-association-to-unidirectional.md) |
| 37 | - **Replace Magic Number with Symbolic Constant** — Assign meaningful names to magic numbers → [reference](references/replace-magic-number-with-symbolic-constant.md) |
| 38 | - **Encapsulate Field** — Restrict field visibility, expose accessors → [reference](references/encapsulate-field.md) |
| 39 | - **Encapsulate Collection** — Expose read-only views of collections → [reference](references/encapsulate-collection.md) |
| 40 | - **Replace Type Code with Class** — Swap type codes for enums or classes → [reference](references/replace-type-code-with-class.md) |
| 41 | - **Replace Type Code with Subclasses** — Swap type codes for a class hierarchy → [reference](references/replace-type-code-with-subclasses.md) |
| 42 | - **Replace Type Code with State/Strategy** — Swap behavior-affecting type codes for State/Strategy → [reference](references/replace-type-code-w |