refactoring-patterns

Apply Fowler refactoring patterns to Java, Kotlin, and Python codebases.

5|1|Updated Jun 17, 2026
One-click install
npx skills add https://github.com/roanbrasil/engineer-grade-agent-skills --skill refactoring-patterns-roanbrasil
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring-patterns
Source: https://github.com/roanbrasil/engineer-grade-agent-skills/tree/main/skills/refactoring-patterns
Command: npx skills add https://github.com/roanbrasil/engineer-grade-agent-skills --skill refactoring-patterns-roanbrasil

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the risk of breaking production code during unstructured refactoring, provides access to Martin Fowler's proven refactoring catalog, and removes guesswork about when refactoring is safe versus when a full rewrite is the better choice.

Core Features & Use Cases

  • Proven Refactoring Catalog: Full Martin Fowler pattern library with before/after code examples in Java, Kotlin, and Python for common structural improvements like extract method, rename, and move patterns.
  • Large-Scale Migration Patterns: Strangler Fig, Branch by Abstraction, and Parallel Change (Expand-Contract) for safely modernizing legacy systems without service downtime.
  • Safe Refactoring Discipline: Pre-refactor checklists, anti-pattern avoidance guidance, and clear rules for when to refactor versus when to rewrite to avoid wasted effort.
  • Use Case Example: If you're maintaining a legacy Python service with tangled business logic, use this Skill to safely extract methods, replace conditional dispatch with polymorphism, and incrementally improve code maintainability without breaking existing functionality.

Quick Start

Use the refactoring-patterns skill to safely extract the calculateTotal method from the printBill function in your order processing service, following the provided before/after examples to preserve existing behavior.

Frequently Asked Questions about refactoring-patterns

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

FAQPage Schema
How do I safely refactor legacy code without breaking production?

Safely refactor legacy code by applying proven, language-agnostic patterns like pre-refactor checklists and behavior-preserving structural improvements to eliminate the risk of production regressions.

What is the Strangler Fig pattern for legacy system migration?

The Strangler Fig pattern is a large-scale migration strategy for safely modernizing legacy systems by incrementally replacing functionality without causing service downtime.

When should I refactor code versus doing a full rewrite?

You should refactor code when behavior can be preserved through structural improvements, but a full rewrite is better when the existing system is too tangled for safe, incremental refactoring patterns.

Can I apply Martin Fowler refactoring patterns to Python and Kotlin codebases?

Yes, you can apply Martin Fowler refactoring patterns to polyglot Java, Kotlin, and Python codebases using provided before and after code examples for common structural improvements.

How do I extract a method from tangled business logic without changing behavior?

Extract a method from tangled business logic by following before and after examples that preserve existing functionality while incrementally improving code maintainability and reducing technical debt.

What are the limitations of ad-hoc code refactoring?

Ad-hoc code refactoring lacks safety checklists and anti-pattern avoidance guidance, which introduces the risk of production regressions and makes it unsafe for large-scale legacy migration.