python-best-practices

Enforce modern typing, import sorting, docstrings, and exception handling in Python code.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/expeor/aws-automation --skill python-best-practices-expeor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-best-practices
Source: https://github.com/expeor/aws-automation/tree/main/.claude/skills/python-best-practices
Command: npx skills add https://github.com/expeor/aws-automation --skill python-best-practices-expeor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python projects often suffer from inconsistent coding standards, readability issues, and maintainability challenges. This guide provides a clear set of guidelines for typing hints, import sorting, docstrings, formatting, and exception handling to improve code quality across teams.

Core Features & Use Cases

  • Type hints and modern Python typing: promotes Python 3.10+ style annotations for clarity and tooling support.
  • Import and formatting discipline: aligns on isort/RUFF-compatible practices to keep imports organized.
  • Documentation and error handling: encourages consistent docstrings and precise exception usage.
  • Use Case: A legacy Python module can be refactored to modern typing, clean imports, and comprehensive docstrings to improve readability and maintenance.

Quick Start

Refactor an existing module to align with Python best practices according to this guide.

Frequently Asked Questions about python-best-practices

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

FAQPage Schema
How do I enforce Python type hints and modern typing in a legacy codebase?

To enforce Python type hints in a legacy codebase, refactor existing modules to use Python 3.10+ style annotations. This improves clarity, tooling support, and maintainability across teams by standardizing typing practices.

What's the best way to organize Python imports for consistent formatting?

The best way to organize Python imports is using isort and Ruff-compatible practices. This import sorting discipline keeps dependencies structured and aligned with established coding standards for better readability.

How does Ruff handle Python linting and coding standards?

Ruff handles Python linting by enforcing consistent formatting, import sorting, and coding standards. It integrates linting checks to align your project with modern Python practices, improving overall code quality and maintainability.

Can I use these Python coding standards for both new projects and legacy code?

Yes, you can apply these Python coding standards to both new projects and legacy codebases. The guidelines support refactoring existing modules to modern typing, clean imports, and comprehensive docstrings for improved maintenance.

Why do I need Python 3.10+ features for type hints and exception handling?

Python 3.10+ features are needed for modern typing annotations and precise exception handling. They provide enhanced syntax for type hints, allowing clearer documentation and better tooling support across your development environment.