Python Style Standards

Enforce Python style standards with ruff, pylint, and mypy.

Updated Sep 8, 2025
One-click install
npx skills add https://github.com/randalmurphal/claude-config --skill python-style-standards
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Python Style Standards
Source: https://github.com/randalmurphal/claude-config/tree/main/skills/python-style
Command: npx skills add https://github.com/randalmurphal/claude-config --skill python-style-standards

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python coding standards including line length (80 chars), naming conventions (snake_case, PascalCase), type hints, docstrings, exception handling, and logging patterns. Use when writing new Python code or reviewing code quality.

Core Features & Use Cases

  • Line Length & Formatting: Enforce 80-character limit and PEP 8 compliance.
  • Naming Conventions: snake_case for functions/vars; PascalCase for classes.
  • Type Hints & Docstrings: Mandatory type hints and descriptive docstrings.
  • Exception Handling & Logging: Structured patterns for errors and logs.

Quick Start

Use the Python style standards before writing new Python code or during reviews. Run ruff format ., ruff check ., and mypy as part of the CI linting.

Frequently Asked Questions about Python Style Standards

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

FAQPage Schema
How do I enforce Python PEP 8 standards across my codebase?

PEP 8 enforcement combines formatting, linting, and type checking. Use ruff format to apply 80-character line limits and style rules, ruff check for linting violations, and mypy for type checking. Run these tools in your CI pipeline to catch violations before code review.

What naming conventions should I use in Python code?

Python naming conventions follow snake_case for functions, variables, and modules, and PascalCase for class names. These standards improve readability and consistency across teams. Enforce them automatically using ruff and pylint to catch deviations during development.

Do I need type hints and docstrings in Python production code?

Type hints and docstrings are essential for maintainability and code quality. Type hints enable static type checking with mypy to catch bugs early; docstrings document intent and usage. Both should be mandatory in production codebases enforced through linting rules.

How should I structure exception handling and logging in Python?

Structured exception handling and logging patterns prevent silent failures and aid debugging. Define specific exception types, use consistent logging levels, and log contextual information. Enforce patterns through code review and linting checks integrated into your CI workflow.

Can I automate Python code quality checks in CI?

Yes. Integrate ruff format, ruff check, and mypy into your CI pipeline to automatically enforce style standards on every commit. This catches violations early, reduces review overhead, and maintains consistent quality across your Python codebase without manual intervention.

Why enforce an 80-character line length in Python?

The 80-character limit improves readability and readability and accommodates side-by-side diffs and terminal windows. It encourages simpler logic and clearer code structure. PEP 8 recommends this standard, and tools like ruff enforce it automatically.