python-refactoring

Analyze Python code for complexity, duplication, and best practices.

Updated Feb 20, 2026
One-click install
npx skills add https://github.com/jackmcintyre/localshift --skill python-refactoring-jackmcintyre
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-refactoring
Source: https://github.com/jackmcintyre/localshift/tree/main/.opencode/skills/python-refactoring
Command: npx skills add https://github.com/jackmcintyre/localshift --skill python-refactoring-jackmcintyre

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires radon, ruff, and includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill addresses the challenges of maintaining clean, readable, and efficient Python code within the LocalShift project, preventing technical debt and improving developer productivity.

Core Features & Use Cases

  • Code Analysis: Identifies complexity, duplication, and anti-patterns.
  • Refactoring Suggestions: Provides actionable recommendations for improving code structure, readability, and performance.
  • Type Hinting: Enforces and suggests improvements for Python type hints.
  • Use Case: When a function becomes too long or complex, you can ask this Skill to suggest ways to break it down into smaller, more manageable methods.

Quick Start

Use the python-refactoring skill to analyze the complexity of the file '/custom_components/localshift/coordinator.py'.

Frequently Asked Questions about python-refactoring

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

FAQPage Schema
How do I analyze Python code complexity and identify anti-patterns?

Analyzing Python code complexity involves evaluating code structure to identify duplication and anti-patterns. This process uses static analysis to detect areas with high complexity, suggesting targeted refactoring strategies to improve overall maintainability.

What is the best way to refactor a long and complex Python function?

Refactoring long Python functions requires analyzing their complexity to suggest breaking them down into smaller, more manageable methods. This approach improves code readability, structure, and overall maintainability for software development workflows.

Do I need radon and ruff to suggest Python refactoring strategies?

Yes, suggesting Python refactoring strategies requires static analysis tools like radon and linters such as ruff. These dependencies are necessary to identify code complexity, adherence to best practices, and propose actionable improvements.

How do I enforce Python type hints and improve code quality?

Enforcing Python type hints improves code quality by analyzing adherence to best practices and suggesting actionable improvements. This refactoring process targets code structure and readability to prevent technical debt and boost developer productivity.

Can static analysis tools improve Python code performance and maintainability?

Static analysis tools improve Python code performance and maintainability by identifying complexity, duplication, and anti-patterns. They propose actionable refactoring strategies that enhance code structure and readability within software development workflows.

What are the limitations of using linters for Python refactoring?

Limitations of using linters for Python refactoring include their reliance on static analysis, meaning they identify structural issues and anti-patterns but do not execute code to evaluate runtime performance or dynamic behavior in complex projects.