python-best-practices

Guide Python code quality with PEP 8, type hints, and Ruff, Black, Mypy tooling.

34|7|Updated Nov 29, 2025
One-click install
npx skills add https://github.com/jkitchin/skillz --skill python-best-practices-jkitchin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-best-practices
Source: https://github.com/jkitchin/skillz/tree/main/skills/programming/python-best-practices
Command: npx skills add https://github.com/jkitchin/skillz --skill python-best-practices-jkitchin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ruff, black, mypy, uv, pytest.

What problem does it solve?

A comprehensive guide to writing professional Python code that adheres to industry best practices, including PEP 8, modular design, testing, type hints, and modern tooling.

Core Features & Use Cases

  • Code quality guidance: PEP 8, naming, imports, and docstrings for maintainable code.
  • Tooling for quality: Ruff, Black, Mypy, uv for fast, reliable development.
  • Testing & architecture: TDD patterns, unit tests, and clean project structure.

Quick Start

Request a starter project layout with a small module showing type hints, tests, and a pre-commit configuration.

Frequently Asked Questions about python-best-practices

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

FAQPage Schema
How do I ensure my Python code follows PEP 8 and industry standards?

PEP 8 compliance ensures readable, maintainable code. Use automated tools like Ruff for linting and Black for consistent formatting to enforce standards across your codebase without manual review overhead.

What's the best way to add type hints to an existing Python project?

Type hints improve code clarity and catch bugs early. Mypy validates type annotations; start by annotating function signatures and public module interfaces, then gradually expand coverage while running Mypy to identify type mismatches.

How do I set up a Python project with testing and proper structure from the start?

Test-driven development with modular architecture requires configuring pytest, organizing code into packages, writing unit tests before implementation, and using pre-commit hooks to enforce quality checks automatically on every commit.

Can I use Ruff and Black together in my Python workflow?

Yes. Ruff handles fast linting and import sorting while Black manages code formatting; they work in synergy. Configure both in your project to run automatically via pre-commit or your build pipeline for consistent results.

What's the difference between using Mypy and Ruff for Python code quality?

Mypy validates type annotations and catches type-related errors; Ruff performs broader linting including style, complexity, and logical issues. Use both: Mypy for type safety, Ruff for comprehensive code quality and performance.

Do I need a dependency manager like uv for a small Python project?

uv accelerates dependency resolution and project setup. For any Python project—small or large—uv reduces installation time and ensures reproducible environments, making it worth adopting early for consistency and speed.