agent_docs/documentation.md
Rules for writing docstrings, comments, user-facing documentation, and maintaining documentation accuracy
When to check: When writing or updating documentation, comments, or docstrings
##, ###, ####) instead of bold text for sections — preserves semantic structure and document hierarchy — Proper heading levels enable navigation, accessibility, and consistent documentation structure across all .md filesai.pydantic.dev), and API references — Prevents documentation drift that misleads users about actual behavior, limitations, or API contractsdocs/ files in mkdocs.yml nav section — Ensures documentation files are discoverable in the generated site navigation; orphaned files won't appear in the docs sitefreeform vs free-form, messages vs last message) — prevents user confusion and makes codebase searchable — Inconsistent terminology fragments documentation searches, confuses users trying to map concepts between docs and code, and signals poor API design qualityTODO: and link workarounds to upstream/internal issues — enables tracking and cleanup when conditions change — Explicit markers with tracking links prevent abandoned workarounds and make technical debt actionable and removable when upstream fixes landhttps://github.com/pydantic/pydantic-ai/issues/1234), not the #1234 shorthand — The shorthand isn't clickable outside GitHub's own rendering (IDEs, generated API docs, plain-text views), so a full link stays navigable wherever the code is readhttps://pydantic.dev/docs/ai/harness/<slug>/ (e.g. https://pydantic.dev/docs/ai/harness/exa-search/, https://pydantic.dev/docs/ai/harness/compaction/), not its GitHub repo/README — the harness has published docs; only fall back to a GitHub link when a capability has no docs page yet — Gives readers rendered, canonical docs instead of raw source, and matches how the rest of the repo references the harness (https://pydantic.dev/docs/ai/harness/)