do-refactor-code

Analyzes Python code files for refactoring opportunities and provides suggestions.

2|Updated Nov 6, 2015
One-click install
npx skills add https://github.com/ahoym/dotfiles --skill do-refactor-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: do-refactor-code
Source: https://github.com/ahoym/dotfiles/tree/main/.claude/commands/do-refactor-code
Command: npx skills add https://github.com/ahoym/dotfiles --skill do-refactor-code

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill helps developers identify and implement code refactoring opportunities to improve code structure, readability, and maintainability.

Core Features & Use Cases

  • Code Analysis: Analyzes code for specific refactoring patterns like helper extraction, nested function removal, and test factory creation.
  • Automated Suggestions: Provides actionable suggestions for refactoring, including code snippets and explanations.
  • Use Case: You have a large Python file that's becoming difficult to manage. Use this Skill to analyze it for opportunities to extract helper methods or even split it into a package, making the codebase cleaner and easier to work with.

Quick Start

Analyze the file '/path/to/your/code.py' for refactoring opportunities.

Frequently Asked Questions about do-refactor-code

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

FAQPage Schema
How do I identify refactoring opportunities in a large Python file?

To identify refactoring opportunities in Python code, analyze the file for code smells like deeply nested functions and large classes. This Skill uses static analysis to detect patterns violating best practices, suggesting helper method extraction and test factory creation to improve maintainability.

When do I need to extract helper methods or classes from my codebase?

You need to extract helper methods or classes when a Python file becomes difficult to manage. This refactoring improves code structure and readability by splitting large files into packages and isolating specific logic into dedicated helper components.

What is the best way to remove nested functions in Python for better maintainability?

The best way to remove nested functions in Python is to analyze the code structure and extract them. This Skill identifies nested function patterns and provides actionable suggestions to refactor them into standalone methods, enhancing code readability and maintainability.

Does static code analysis work for creating test factories in Python?

Static code analysis works for creating test factories in Python by examining your code structure. This Skill analyzes code files to identify patterns suitable for test factory creation, providing actionable code snippets to improve your testing maintainability.

Can I use code analysis to split a large Python file into a package?

You can use code analysis to split a large Python file into a package. The Skill evaluates your codebase to identify helper class extraction opportunities, providing specific suggestions to restructure the file into a cleaner, more modular package layout.