Refactorer

Refactor Python code by detecting code smells and applying systematic patterns.

1|1|Updated Jan 6, 2026
One-click install
npx skills add https://github.com/Geralt1983/Thanos --skill refactorer-geralt1983
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Refactorer
Source: https://github.com/Geralt1983/Thanos/tree/main/.gemini/skills/refactorer
Command: npx skills add https://github.com/Geralt1983/Thanos --skill refactorer-geralt1983

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses code that is difficult to read, maintain, or extend by providing systematic guidance on refactoring, cleanup, and modernization.

Core Features & Use Cases

  • Code Smell Detection: Identifies common anti-patterns like long methods, large classes, and duplicate code.
  • Refactoring Patterns: Applies proven techniques such as Extract Method, Replace Conditional with Polymorphism, and Introduce Parameter Object.
  • Modernization: Updates code to use current language idioms and best practices.
  • Use Case: You have a complex function with many nested conditionals that is hard to understand. This Skill can help you simplify it using guard clauses or by replacing conditionals with polymorphism, making it more readable and maintainable.

Quick Start

Use the refactorer skill to simplify the attached Python function 'complex_logic.py'.

Frequently Asked Questions about Refactorer

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

FAQPage Schema
How do I refactor code to fix common code smells like long methods and duplicate code?

To refactor code smells, you can apply systematic transformations like Extract Method to break down long methods and eliminate duplicate code. This process improves readability while preserving the original behavior.

What is the best way to simplify complex nested conditionals for better maintainability?

The best way to simplify complex nested conditionals for maintainability is by replacing them with guard clauses or using polymorphism. These refactoring patterns reduce cognitive complexity and make control flow clearer.

Can I modernize outdated code patterns without changing the software's behavior?

Yes, you can modernize outdated code patterns without changing behavior by applying behavior-preserving transformations. This updates the code to use current language idioms and best practices while maintaining functionality.

How do I reduce code complexity in large classes that are difficult to maintain?

To reduce code complexity in large classes, apply refactoring techniques such as Extract Class or Introduce Parameter Object. These patterns help split responsibilities and reduce the overall complexity of the system.

When do I need to use systematic refactoring instead of just cleaning up code?

You need systematic refactoring when code has deep structural issues like anti-patterns or high complexity that simple cleanup cannot fix. It applies proven patterns to ensure behavior-preserving transformations and long-term maintainability.