Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Python Modernizer

    1

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

    $9.99

    Secure checkout via Stripe

    30-day refund 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.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    • Passed all security checks, Safe to install

    Listedtoday

    What's inside

    Frequently Asked Questions