python-google-style
Skill0 starsChanged 9 days agoMITView on GitHub
Audit Python code (.py) against the Google Python Style Guide (https://google.github.io/styleguide/pyguide.html) and PEP 8, plus mandatory Google-style docstrings (Args/Returns/Raises) on every module, class and public function and type hints on public APIs, and report violations. Use when asked to check/review/lint/audit Python code against Google style, PEP 8 or docstring completeness. Also apply these rules when writing or editing Python.
- Installs packages
In this repository28 other files it gives its agents.
- accessibility-auditSkill
- api-design-reviewSkill
- architecture-reviewSkill
- complexity-checkSkill
- concurrency-reviewSkill
- config-reviewSkill
- cpp-google-styleSkill
- csharp-google-styleSkill
- dead-code-finderSkill
- dependency-auditSkill
- doc-comment-auditSkill
- error-handling-reviewSkill
- full-reviewSkill
- java-google-styleSkill
- logging-reviewSkill
- markdown-readme-google-styleSkill
- naming-reviewSkill
- owasp-security-reviewSkill
- performance-reviewSkill
- privacy-reviewSkill
- regex-reviewSkill
- repo-hygieneSkill
- review-without-fixingSkill
- secrets-scanSkill
- shell-google-styleSkill
- sql-reviewSkill
- test-coverage-reviewSkill
- todo-auditSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Check the files/directories the user names, otherwise the whole repo.
- Very specific: line 16
Run (no pipe; output is capped): bash <skill-dir>/scripts/check.sh <project-root> [hitsPerRule=8]
- Very specific: line 18
No linter installed: the script says so.
- Distinctive: line 83
MUST = error, SHOULD = warning, style hints = info.
- Distinctive: line 84
Every finding has a concrete location.
- Distinctive: line 87
Do not change code. Apply fixes only when the user explicitly asks for it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Google Python Style + mandatory docstrings
Sources: https://google.github.io/styleguide/pyguide.html · https://peps.python.org/pep-0008/
Audit: script first, read code only where needed. Review only: report findings, don't edit unless the user explicitly asks. In legacy code with its own config (pyproject.toml [tool.ruff], .pylintrc, setup.cfg), report deviations from Google style once, then follow the project config.
Scope
Check the files/directories the user names, otherwise the whole repo. Skip .git/, .venv/, venv/, build/, dist/, __pycache__/, site-packages/, node_modules/, vendor/, migrations and generated files (# Generated by, DO NOT EDIT, *_pb2.py).
Audit steps
- Run (no pipe; output is capped):
bash <skill-dir>/scripts/check.sh <project-root> [hitsPerRule=8]- Uses
ruff(preferred) orpylintif installed, then grep/awk heuristics## ID count SEV | desc+ samplesfile:line:code. - No linter installed: the script says so. Tell the user that
pip install ruffmakes the check more precise, then continue with heuristics and manual review. Never install anything yourself.
- Uses
- Heuristic hits: spot-check samples, drop false positives (list below). Bulk formatting hits (line length, quotes) = one root cause: report once, suggest a formatter (
ruff format,pyink,black --line-length 80). - Review ★ rules manually in ≤5 representative files (largest/core modules).
- Report (format below). Fix order: docstring/type gaps on public API → MUST rules → SHOULD.
Rules (ID → script; ★ manual)
Language
- P4 no bare
except:; ★ catchExceptiononly to re-raise or at an isolation boundary; keeptrybodies small; custom exceptions end inError - ★
assertonly for internal invariants, never to validate public arguments - P5 no mutable default arguments (
[],{},list(),dict(),set()); useNone - P6 no wildcard imports · P7 no relative imports (use the full package path) · ★
import x/from pkg import modulefor modules and packages only, not classes/functions (exempt:typing,collections.abc,typing_extensions) - P8
is None/is not None, never== None; no== True/False; ★ implicit false for sequences (if not items:) - ★ no mutable global state; module constants are fine · ★ avoid power features (metaclasses,
__del__, reflection hacks) - P11 avoid
@staticmethod(write a module function) · ★@classmethodonly for named constructors - P15 files/sockets via
with(not barex = open(...)) - P12 logging with
%-placeholders:logger.info('Got %s', x), not f-strings - ★
if __name__ == '__main__':guard, logic inmain()· ★ functions ≤ ~40 lines (guideline) - ★ type hints on all public functions/methods (project rule);
X | None/Optional[X]for nullable
Style
- P1 no tabs; 4 spaces · P2 ≤80 columns (except long imports, URLs,
# pylint: disablelines) - P3 no backslash continuation; use implicit joining inside
() - P10 one statement per line (no
;) · P9 one import per line (excepttypingnames) - ★ imports grouped
__future__→ stdlib → third-party → local, each lexicographically sorted - ★ 2 blank lines between top-level definitions, 1 between methods
- ★ consistent quote character per file;
"""for docstrings - P13 TODO format:
# TODO: <link> - <text>(legacy# TODO(<user>): <text>accepted)
Naming
module_name,package_name,ClassName,ExceptionName,function_name,method_name,GLOBAL_CONSTANT,local_var,param_name; leading_for internal- ★ no single-char names outside short scopes (
i,j,k,e,f,vok); ★ no__double_leadingnames (name mangling); no dashes in module names
Docstrings (project rule: stricter than the Guide)
- D1 module docstring at the top of every file (summary line + description)
- D2 every class and every public function/method has a docstring (
_privateand__dunder__exempt unless non-trivial); ★@overridemethods may skip it if behavior is unchanged - ★ summary line ≤80 chars, ends with
., then blank line, then body - ★ sections in order
Args:→Returns:/Yields:→Raises:;Args:lists every parameter asname: Description.(indent 4, continuation +4); no section forNonereturns - ★ class docstring describes the instance; public attributes in
Attributes:;@propertydocstring reads like an attribute ("The Bigtable path.") - ★ consistent mood per file: descriptive ("Fetches rows.") or imperative ("Fetch rows.")
Template:
def fetch_rows(table: Table, keys: Sequence[str]) -> dict[str, Row]:
"""Fetches rows from a table.
Args:
table: The table to read from.
keys: Row keys to fetch. Missing keys are skipped.
Returns:
A dict mapping each found key to its row.
Raises:
IOError: If the table cannot be read.
"""False positives to drop
P2 in long string literals that can't be split, or in URLs inside docstrings · P3 inside string literals · P5 when the default is never mutated (still mention as info) · P8 in SQLAlchemy/pandas expressions (col == None builds a query) · P11 when a framework requires it · D2 in tests (test_* functions need no docstring) · anything in generated code.
Report
In the user's language, grouped by file:
path/to/file.py:line - error|warning|info - <ID> <rule> - <why it is a problem> (https://google.github.io/styleguide/pyguide.html#<section>)- MUST = error, SHOULD = warning, style hints = info.
- Every finding has a concrete location; mark uncertain ones as "possible".
- Bulk hits with one root cause: report once with count and 2-3 sample locations.
- End with a summary: findings per severity, then the 3 most important things to fix first.
- Do not change code. Apply fixes only when the user explicitly asks for it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

