google-python-style

Applies Google's Python style guide rules when writing or reviewing Python code.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/chughtapan/google-guide-skills --skill google-python-style-chughtapan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: google-python-style
Source: https://github.com/chughtapan/google-guide-skills/tree/main/skills/google-python-style
Command: npx skills add https://github.com/chughtapan/google-guide-skills --skill google-python-style-chughtapan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Python codebases drift into inconsistent imports, naming, exception handling, and formatting when contributors lack a shared standard. This Skill gives an agent the concrete rules from Google's Python Style Guide so code is written and reviewed against one authoritative convention. ## Core Features & Use Cases - Language rules: Covers imports, exceptions, mutable global state, comprehensions, lambdas, default arguments, properties, threading, and true/false evaluations. - Formatting and documentation: Enforces 80-character lines, 4-space indentation, docstring structure for modules, classes, and functions, and import grouping and sorting. - Typing guidance: Provides rules for type annotations, NoneType handling, typing imports, and generics for public APIs. - Use Case: While reviewing a pull request, the agent flags a catch-all except: block, a mutable default argument, and misordered imports, then rewrites them to match Google's conventions. ## Quick Start Review this Python file using the Google Python style guide and fix any violations in imports, naming, and docstrings.

Frequently Asked Questions about google-python-style

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

FAQPage Schema
How do I format Python imports according to the Google style guide?▼

Place imports at the top of the file in four groups: __future__ imports, standard library, third-party packages, then repository sub-packages. Sort each group lexicographically by full package path, use one import per line, and never use relative imports.

What naming conventions does the Google Python style guide require?▼

Use module_name, ClassName, function_name, GLOBAL_CONSTANT_NAME, and instance_var_name patterns. Avoid single-character names except for counters and iterators, avoid double-underscore privacy, and never use dashes in .py filenames.

When should I use type annotations in Python code?▼

Annotate public APIs at minimum, plus code that is error-prone, hard to understand, or type-stable. Declare None explicitly with X | None in Python 3.10+, and prefer abstract container types like collections.abc.Sequence over concrete list in signatures.

Why should I avoid mutable default arguments in Python functions?▼

Mutable default values are evaluated once at definition time and shared across calls, causing state to leak between invocations. The Google style guide prohibits them; use None as the default and assign the mutable object inside the function body.

What are the limits of this Python style guidance?▼

It is a style reference, not a beginner tutorial, and it does not teach Python fundamentals. Repository-specific requirements and newer authoritative guidance take precedence over these rules when they conflict.