Back to Adk Python

ADK Style Guide

.agents/skills/adk-style/SKILL.md

2.7.01.9 KB
Original Source

ADK Style Guide

Conventions for src/google/adk/ and tests/unittests/. Most are enforced by a pre-commit hook or a CI job, so a violation blocks the PR rather than surfacing in review. Read the one reference for the topic you are touching.

Pick a reference

TaskReference
Adding a .py file; deciding public vs private; __init__.py and __all__visibility.md
Writing import lines; relative vs absolute; circular imports; TYPE_CHECKINGimports.md
Annotating args and returns; Optional vs | None; keyword-only args; isinstance; asserts; mypytyping.md
Defining a Pydantic model, validator, private attribute, or on-wire payloadpydantic.md
Indentation, line length, quotes; running the formatter; what each hook checksformatting.md
Writing a docstring or an explanatory commentdocumentation.md
Emitting a log record; naming the module logger; picking a levellogging.md
Anything that performs I/O — network, disk, databaseasync.md
Where a new file goes; license header; where its test goes and what to call itfile-organization.md
Writing or restructuring a unit testtesting.md

A check failed — where to look

Failing checkReference
check-new-py-prefixvisibility.md
compliance-checkslogging.md (logger name), typing.md (from __future__ import annotations), imports.md (cli/ import direction)
pyink, isort, ruff, addlicense, codespellformatting.md
Mypy Check CI jobtyping.md