Py Modernize
Py Modernize automatically updates Python code to use modern features and best practices, improving maintainability and performance.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add py-modernize npx -- -y @trustedskills/py-modernize
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"py-modernize": {
"command": "npx",
"args": [
"-y",
"@trustedskills/py-modernize"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
The py-modernize skill automatically updates Python code to use modern language features and best practices. It handles things like replacing deprecated syntax, updating idioms, and improving overall code style based on current Python conventions. This helps maintain compatibility with newer Python versions and improves code readability.
When to use it
- Legacy Codebases: Modernize older Python 2 or early Python 3 code to take advantage of new features and improve maintainability.
- Code Style Enforcement: Ensure a consistent coding style across a project by automatically applying modern conventions.
- Preparing for Migration: Simplify the process of migrating to newer Python versions by proactively addressing compatibility issues.
- Refactoring Existing Code: Quickly update code to use more efficient or readable constructs without manual intervention.
Key capabilities
- Automatic conversion of deprecated syntax.
- Updates to reflect current Python idioms and best practices.
- Code style improvements based on modern conventions.
- Compatibility updates for newer Python versions.
Example prompts
- "Modernize this Python code: [paste code here]"
- "Update this file to use more modern Python features:
my_script.py" - "Refactor this function using current best practices: [paste function definition here]"
Tips & gotchas
- The skill requires a working Python environment and the
modernizepackage to be installed. Ensure these prerequisites are met before use. - While generally safe, always review the changes made by the skill, especially in critical code sections.
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 Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.