guru-refactor-moving

Move methods and fields between classes to resolve responsibility drift.

1|Updated Dec 22, 2025
One-click install
npx skills add https://github.com/CybLow/pypaginate --skill guru-refactor-moving
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: guru-refactor-moving
Source: https://github.com/CybLow/pypaginate/tree/main/.opencode/skills/guru-refactor-moving
Command: npx skills add https://github.com/CybLow/pypaginate --skill guru-refactor-moving

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This collection teaches proven refactoring techniques for moving responsibilities between objects to improve cohesion and reduce coupling.

Core Features & Use Cases

  • Move Method: relocate behavior to the class that uses its data most.
  • Move Field: relocate a field to the owning class to reduce cross-class dependencies.
  • Extract Class: split responsibilities into a new class for maintainability.
  • Inline Class: collapse a tiny helper class into its usage site.
  • Hide Delegate: expose a cleaner API by hiding delegation chains.
  • Remove Middle Man: let client code access delegates directly when appropriate.
  • Introduce Foreign Method: add a utility method for unmodifiable or external classes.
  • Introduce Local Extension: extend an unmodifiable class with a local wrapper or subclass.

Quick Start

Identify a candidate method or field that frequently uses data from another class and move it to the owning class to improve cohesion.

Frequently Asked Questions about guru-refactor-moving

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a class that has too many responsibilities?▼

To refactor an overloaded class, use the Extract Class technique to split distinct responsibilities into new components, improving cohesion and reducing cross-class dependencies for better maintainability.

When should I move a method to another class during code cleanup?▼

Move a method during code cleanup when it uses data from another class more frequently than its own. Relocating behavior to the owning class reduces coupling and improves overall object-oriented design.

What is the difference between Hide Delegate and Remove Middle Man in object-oriented refactoring?▼

Hide Delegate conceals delegation chains to expose a cleaner API, while Remove Middle Man eliminates unnecessary delegation by letting clients access delegates directly when the wrapper adds no value.

How can I extend an unmodifiable class without modifying its source code?▼

To extend an unmodifiable class, apply the Introduce Local Extension technique using a wrapper or subclass. Alternatively, use Introduce Foreign Method to add a utility method for external classes.

How do I consolidate a tiny helper class that adds unnecessary complexity?▼

Consolidate a tiny helper class by applying the Inline Class refactoring technique. This collapses the minimal helper into its usage site, reducing unnecessary abstraction and simplifying the object interactions.