Refactoring

Execute safe refactoring workflows with tests after each incremental change.

Updated Jan 19, 2026
One-click install
npx skills add https://github.com/saknarinZ/agent_skills_gemini --skill refactoring-saknarinz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Refactoring
Source: https://github.com/saknarinZ/agent_skills_gemini/tree/main/.agent/skills/refactoring
Command: npx skills add https://github.com/saknarinZ/agent_skills_gemini --skill refactoring-saknarinz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

ปรับปรุงคุณภาพโค้ดให้ดีขึ้นโดยไม่เปลี่ยนพฤติกรรมของโปรแกรม ทำให้โค้ดอ่านง่ายขึ้น มีความมั่นคงมากขึ้น และง่ายต่อการบำรุงรักษา

Core Features & Use Cases

  • เทคนิคหลัก เช่น Extract Method, Replace Conditional with Polymorphism, Introduce Parameter Object
  • ปฏิบัติตามหลัก SOLID เพื่อลดความซับซ้อนและเพิ่มความสามารถในการขยาย
  • รองรับการทดสอบและตรวจสอบความถูกต้องก่อน refactor

Quick Start

ระบุจุดที่มี code smells แล้วทำการ refactor อย่างทีละขั้นตอน พร้อมรันชุดทดสอบทุกขั้นตอนและบันทึกการเปลี่ยนแปลง

Frequently Asked Questions about Refactoring

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

FAQPage Schema
How do I safely refactor legacy code without altering its behavior?

To safely refactor legacy code without altering behavior, apply small incremental changes and run existing tests after each step. This preserves program functionality while improving readability, stability, and maintainability.

Do I need existing tests before starting a code refactoring workflow?

Yes, existing tests are required before starting a code refactoring workflow. You must run the test suite after each small incremental change to verify that the program's behavior remains unchanged throughout the process.

What is the best way to replace complex conditional logic with polymorphism?

The best way to replace complex conditional logic with polymorphism is using the Replace Conditional with Polymorphism technique. This reduces complexity and improves extensibility by aligning with SOLID principles during the refactor.

How do I use Extract Method and Introduce Parameter Object to improve code quality?

To improve code quality, use Extract Method to break down long functions and Introduce Parameter Object to group multiple parameters. These refactoring techniques enhance readability while maintaining the original behavior.

Can I apply incremental refactoring techniques across multi-language codebases?

Yes, you can apply incremental refactoring techniques across multi-language codebases. The workflow favors small, step-by-step changes with frequent commits and documentation updates to ensure safe improvements.

When should I not use large scale refactoring on a stable project?

You should avoid large scale refactoring on a stable project when you lack sufficient test coverage. Safe refactoring requires running tests after each incremental step to prevent unintended behavior changes.