refactoring-patterns

Translate code smell detection into behavior-preserving refactoring patterns.

150|48|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/irahardianto/awesome-agv --skill refactoring-patterns-irahardianto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring-patterns
Source: https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/refactoring-patterns
Command: npx skills add https://github.com/irahardianto/awesome-agv --skill refactoring-patterns-irahardianto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you reduce risk during refactoring by giving a safe, repeatable pattern catalog for improving code structure while preserving behavior.

Core Features & Use Cases

  • Code smell taxonomy: Maps common smells (structural and coupling) to concrete refactoring moves like extraction, interface introduction, and responsibility reshaping.
  • Safe transformation playbook: Covers behavior-preserving strategies such as characterization tests, strangler fig migration, branch by abstraction, and parallel run comparisons.
  • Refactoring success metrics: Defines targets for complexity, duplication, coupling trends, and test coverage to verify progress and guard against regressions.

Quick Start

Use the refactoring-patterns skill to guide an incremental refactor of a “long method” by first defining characterization tests, applying an extraction step, and then validating unchanged outputs and improved complexity.

Frequently Asked Questions about refactoring-patterns

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

FAQPage Schema
How do I refactor code safely while preserving behavior?

To refactor safely while preserving behavior, execute stepwise transformations using strategies like strangler fig, branch by abstraction, and parallel run comparisons. Establish characterization tests and track quality metrics throughout the incremental cleanup process to validate unchanged outputs and guard against regressions.

What is the best way to migrate callbacks to async/await without breaking existing functionality?

Migrating callbacks to async/await requires incremental transformation patterns that preserve behavior. Apply the safe transformation playbook using branch by abstraction and parallel run comparisons to replace legacy callback structures gradually while tracking behavior preservation metrics and validating unchanged outputs.

How do I remediate technical debt after running static analysis?

Remediate technical debt after static analysis by mapping detected code smells to concrete refactoring moves like extraction and interface introduction. Execute these incremental transformations stepwise while tracking complexity, duplication, and coupling trends to verify progress and guard against regressions.

What metrics should I track to verify refactoring progress?

Track refactoring success metrics including complexity reduction, duplication removal, coupling trends, and test coverage. Monitoring these quality metrics during incremental transformation provides measurable evidence of structural improvement, verifies progress, and guards against regressions throughout the refactoring process.

When should I use the strangler fig pattern for incremental code cleanup?

Use the strangler fig pattern when incremental cleanup requires gradually replacing legacy code with new structures without breaking existing functionality. It supports behavior-preserving migration by enabling parallel run comparisons and stepwise execution alongside branch by abstraction for safe responsibility reshaping.