Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Python Modernizer

    1

    Automated Python code modernization for f-strings, type hints, and legacy syntax patterns.

    $1

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Python Modernizer

    Python Modernizer

    Example session with this skill installed

    Modernize the typing and string formatting in app/services/auth.py for Python 3.10. I want to see the diff first.

    • Read your context and instructions
    • Compiled the python modernizer

    I have analyzed app/services/auth.py for Python 3.10 compatibility. Below is the diff report for f-strings and modern type union syntax.

    Modernization Diff (app/services/auth.py)

    --- app/services/auth.py
    +++ app/services/auth.py
    @@ -1,15 +1,14 @@
    -from typing import List, Optional, Union
    +from typing import List
     
     class AuthProvider:
    -    def __init__(self, provider_name: str):
    -        self.message = "Initializing %s provider" % provider_name
    +    def __init__(self, provider_name: str) -> None:
    +        self.message = f"Initializing {provider_name} provider"
     
    -    def get_users(self, role: Optional[str] = None) -> Union[List[str], None]:
    +    def get_users(self, role: str | None = None) -> list[str] | None:
             """Fetch users by role."""
             if role is None:
                 return []
    -        print("Fetching for: {}".format(role))
    +        print(f"Fetching for: {role}")
             return ["admin", "editor"]
     
    -    def log_error(self, code: int, msg: str):
    -        return "Error %d: %s" % (code, msg)
    +    def log_error(self, code: int, msg: str) -> str:
    +        return f"Error {code}: {msg}"
    

    Advisory Notes

    • Found type(role) == str on line 22. Consider replacing with isinstance(role, str).
    • Redundant open(file, 'r') detected on line 45; the 'r' mode is default in Python 3.

    Next steps

    1. Run with --write to apply these 6 changes to the file.
    2. Execute your test suite to verify the f-string interpolation logic.
    3. Review the isinstance advisory to ensure type checking remains strict.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Legacy Python code slows down development and introduces technical debt that modern linters flag. This skill automates the transition to modern idioms, moving your codebase from outdated patterns to clean, efficient syntax compatible with Python 3.9 through 3.11+.

    What it does

    • Syntax Upgrades converts legacy % and .format() strings to modern f-strings.
    • Type Hinting Modernization migrates typing.List or Union to built-in generics and pipe syntax.
    • Boilerplate Removal strips redundant object inheritance, super() arguments, and u prefixes.
    • Resource Cleanup optimizes open() calls and literal constructors like dict() or list().
    • Advisory Reporting flags complex patterns like pathlib migrations or dataclass opportunities without risky auto-changes.

    How it works

    1. Analyze Provide a file or directory to scan for legacy patterns against a target Python version.
    2. Preview Review the diff report to see proposed changes without modifying the source.
    3. Select Use specific flags to isolate certain modernizations like f-strings or typing only.
    4. Apply Execute the write command to update files with verified, parsed code changes.

    Frameworks & tools

    This skill operates on standard Python source code and targets syntax features introduced in Python 3.9, 3.10, and 3.11.

    Why this beats prompting it yourself

    Generic prompts often hallucinate syntax or break complex logic during string formatting. This skill uses a logic-heavy approach that validates every rewrite against a parser to ensure code remains valid while strictly following version-specific PEP standards.

    Use cases

    • Version Upgrades when migrating a service from Python 3.7 to 3.10+.
    • Technical Debt Reduction before a major refactor or library migration.
    • Codebase Standardization to enforce consistent modern idioms across a team.

    Known limitations

    Does not auto-rewrite == None or pathlib transitions as these can impact library behavior. String conversions are restricted to simple cases to prevent breakage.

    Manual testing is required after writing changes. Complex string formatting and behavioral changes like pathlib or dataclasses are reported but not auto-modified.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    Permissions

    Terminal / Shell
    Read Files
    Listed1 month ago
    Updated28 days ago

    What's inside

    Frequently Asked Questions

    This skill uses a parser-driven approach to ensure all rewrites remain syntactically valid, avoiding the logic errors and 'hallucinations' common when asking a standard LLM to refactor complex string formatting or nested type hints.

    The skill is optimized for Python 3.9 through 3.11+, allowing you to specify a target version to ensure the generated syntax (like pipe-based Union types) is fully supported by your environment.

    No, the tool includes a Preview mode that generates a diff report, allowing you to review all proposed changes and select specific modernization flags before any files are actually modified.

    The skill focuses on syntax idioms like f-strings and type hints; it intentionally flags but does not auto-change complex patterns like pathlib migrations or dataclass conversions to prevent breaking library-specific behavior.

    Your purchase includes the full Python Modernizer skill set, including all modernization modules for syntax, typing, and boilerplate removal, along with documentation for CLI flags and integration.

    New in Code Quality & Review