python-best-practices

Enforce PEP 8, type hints, and testing patterns in Python code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Python coding best practices, conventions, and architectural patterns for production-ready applications. Use when writing, reviewing, or refactoring Python code to apply modern patterns and idiomatic style.

Core Features & Use Cases

  • General Python conventions (PEP 8, type hints, testing with pytest/hypothesis/Faker)
  • FastAPI best practices (async endpoints, error handling, OpenAPI docs, dependency injection)
  • Dataframe mindset (vectorization, columnar operations, method chaining across Pandas/Polars/DuckDB/Spark)
  • Python data model (dunder methods, iterators, context managers, descriptors, properties)

Quick Start

Install Ruff, configure pyproject.toml, and begin refactoring a representative module to align with PEP 8, type hints, and vectorized data operations.

Frequently Asked Questions about python-best-practices

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

FAQPage Schema
How do I set up pyproject.toml and Ruff for Python linting?

To configure Python linting, install Ruff and define your ruleset in pyproject.toml to enforce PEP 8 and modern conventions across modules. This setup establishes a baseline for production-ready code quality.

What are FastAPI best practices for async endpoints and dependency injection?

FastAPI best practices include using async endpoints, robust error handling, comprehensive OpenAPI docs, and dependency injection to build scalable and maintainable production-grade web applications.

How do I apply type hints and PEP 8 conventions when refactoring Python code?

When refactoring Python code, apply type hints and PEP 8 conventions by updating modules iteratively to align with modern idiomatic patterns, ensuring robust type safety and readable code structure.

What is the dataframe mindset for vectorization across Pandas and Polars?

The dataframe mindset emphasizes vectorization, columnar operations, and method chaining across Pandas, Polars, DuckDB, and Spark to optimize data processing and avoid inefficient row-wise iterations.

Do I need pytest and hypothesis to implement robust testing strategies?

For robust testing strategies, using pytest alongside hypothesis and Faker is recommended to enforce comprehensive test coverage and validate code behavior against edge cases in production modules.

When should I use Python data model features like dunder methods and context managers?

Use Python data model features like dunder methods, iterators, context managers, and descriptors when you need custom object behavior, resource management, or advanced iteration patterns in your architecture.