python-code-style

Configure Python linting, formatting, naming conventions, and docstring standards for projects.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/scoots31/engineering-playbook --skill python-code-style-scoots31
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-code-style
Source: https://github.com/scoots31/engineering-playbook/tree/main/references/python-code-style
Command: npx skills add https://github.com/scoots31/engineering-playbook --skill python-code-style-scoots31

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ruff, mypy.

What problem does it solve? Inconsistent code style, missing type annotations, and undocumented public APIs make Python codebases hard to maintain and review. This Skill provides concrete standards and tool configurations for linting, formatting, naming, and documentation. ## Core Features & Use Cases - Tooling Configuration: Ready-to-use ruff, mypy, and pyright configurations for pyproject.toml with strict type checking and automated formatting. - Naming and Import Standards: PEP 8-based conventions for files, classes, functions, constants, and import organization. - Documentation Patterns: Google-style docstring templates for functions and classes, plus README and CHANGELOG structures. - Use Case: When starting a new Python project, apply this Skill to set up ruff for linting and formatting, enable strict mypy checking, and establish docstring standards before writing the first module. ## Quick Start Set up linting, formatting, and docstring standards for my Python project using ruff and mypy.

Frequently Asked Questions about python-code-style

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

FAQPage Schema
How do I configure ruff for linting and formatting in Python?

Add a [tool.ruff] section to pyproject.toml with line-length, target-version, and lint rule selections like E, F, I, B, and UP. Run ruff check --fix to lint and auto-fix, and ruff format to format code.

What is the difference between mypy and pyright for type checking?

Both perform static type checking on Python code. Mypy is configured with strict = true in pyproject.toml, while pyright uses typeCheckingMode = "strict" and typically runs faster. Either can enforce disallow_untyped_defs for production code.

How do I write Google-style docstrings for Python functions?

Start with a one-line summary, then add Args, Returns, and Raises sections describing parameters, return values, and exceptions. Include an Example section with doctest-style usage for complex public functions.

Should I use relative or absolute imports in Python projects?

Use absolute imports exclusively, such as from myproject.utils import retry_decorator. Absolute imports are more maintainable, clearer about module origins, and avoid breakage when files are moved within the package.

What line length should I use for Python code formatting?

Set line length to 120 characters for modern displays while maintaining readability. Configure it in ruff with line-length = 120 and ignore E501 in lint rules since the formatter handles line wrapping.