Py Refactor

🌐Community
by l-mb · vlatest · Repository

Automates Python code refactoring tasks like renaming variables, extracting methods, and improving readability.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add py-refactor npx -- -y @trustedskills/py-refactor
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "py-refactor": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/py-refactor"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill automates Python code refactoring tasks. It can identify and apply common refactoring patterns, improving code readability and maintainability. The tool aims to reduce manual effort in modernizing existing Python codebases.

When to use it

  • Improving Legacy Code: Refactor older Python scripts that are difficult to understand or modify.
  • Code Cleanup Before Testing: Prepare code for testing by applying consistent formatting and simplifying complex logic.
  • Automating Repetitive Tasks: Reduce the time spent on common refactoring operations like renaming variables or extracting methods.
  • Modernizing Python Versions: Adapt older Python 2 code to be compatible with newer versions (Python 3).

Key capabilities

  • Automated refactoring patterns
  • Code readability improvements
  • Maintainability enhancements
  • Compatibility updates (Python 2 to Python 3)

Example prompts

  • "Refactor this function to use list comprehensions."
  • "Extract the repeated code block into a separate method."
  • "Rename variable 'data' to 'user_records'."

Tips & gotchas

  • The skill requires access to the Python source code.
  • Review refactoring changes carefully before committing them, as automated changes may not always be perfect.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
l-mb
Installs
5

🌐 Community

Passed automated security scans.