Refactoring Rules

Identify code smells and apply refactoring techniques to improve code design.

1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/iceflower/opencode-agents-and-skills --skill refactoring-rules
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Refactoring Rules
Source: https://github.com/iceflower/opencode-agents-and-skills/tree/main/skills/refactoring
Command: npx skills add https://github.com/iceflower/opencode-agents-and-skills --skill refactoring-rules

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of improving existing code's internal structure without altering its external behavior, making it more understandable, maintainable, and extensible.

Core Features & Use Cases

  • Code Smell Identification: Detects and provides solutions for common code smells at method, class, and coupling levels.
  • Refactoring Techniques: Offers practical guidance and examples for basic and API refactoring techniques like Extract Method, Rename, Move Method, and Separate Query from Modifier.
  • Use Case: A developer is faced with a complex, hard-to-read method. They can consult this Skill to identify potential code smells and apply techniques like "Extract Method" to break it down into smaller, more manageable, and understandable functions.

Quick Start

Apply the 'Extract Method' refactoring technique to simplify a long method.

Frequently Asked Questions about Refactoring Rules

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

FAQPage Schema
How do I identify code smells in a complex method to improve maintainability?

To identify code smells and improve maintainability, analyze your complex methods at the method, class, and coupling levels. Detecting these structural issues is the essential first step before applying targeted refactoring techniques to simplify the code.

What is the best way to apply the Extract Method refactoring pattern to clean code?

The best way to apply the Extract Method refactoring pattern for clean code is to take small steps, breaking down long, hard-to-read methods into smaller, manageable functions. This restructuring preserves external behavior while improving readability.

How does behavior preservation work during code refactoring?

Behavior preservation during code refactoring works by executing modifications in small steps accompanied by tests. This process ensures the internal structure changes to improve design and maintainability without altering the software's observable external behavior.

Can I use API refactoring techniques to restructure existing software design?

Yes, you can use API refactoring techniques to restructure existing software design. Patterns like Move Method and Separate Query from Modifier allow you to safely restructure interfaces and improve code quality while maintaining existing functionality.

When should I not use refactoring techniques on existing code?

You should not use refactoring techniques on existing code when you lack accompanying tests to verify behavior preservation. Without tests to validate that external behavior remains unaltered, restructuring code introduces significant risks of breaking functionality.