agentleFS
litestar-orglitestar-org/litestar-skills/skills/litestar-docs/SKILL.md

litestar-docs

Skill19 starsChanged 10 days agoMITView on GitHub

Use when working with zensical.toml, docs/conf.py, sphinx, shibuya, litestar-sphinx-theme, mkdocstrings, Griffe, objects.inv, or API reference docs. Not for OpenAPI route schemas.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    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
  1. Very specific:

    Run tools/docs/scan_public_docstrings.py --check-leaks --check-overloads --check-typeddicts <pkg> before building docs.

    line 61
  2. Very specific:

    Sphinx: Run uv run sphinx-build -b html -W --keep-going docs site and verify output artifacts.

    line 73
  3. Very specific:

    Zensical: Run zensical build --clean --strict, tools/docs/postbuild.py, and tools/docs/verify_docs_artifacts.py.

    line 74

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

litestar-docs

Dual-engine documentation architecture for litestar-org and ecosystem repositories, supporting both Sphinx (docs/conf.py + shibuya / litestar-sphinx-theme + autodoc / napoleon) and Zensical (zensical.toml + mkdocstrings-python / Griffe static AST). Match the repository's chosen documentation engine and apply shared quality invariants across both.

Documentation Engine Matrix

AspectSphinx (docs/conf.py)Zensical (zensical.toml)
Primary Configdocs/conf.pyzensical.toml
Markup Formats.rst (reStructuredText) + .md (myst-parser).md (Python Markdown + pymdown-extensions)
Theme & Stylingshibuya or litestar-sphinx-theme (docs/_static/custom.css)variant = "modern" (docs/stylesheets/extra.css)
Python API Extractionsphinx.ext.autodoc + sphinx.ext.napoleonmkdocstrings-python (Griffe static AST)
Cross-Repo Linkingsphinx.ext.intersphinx (objects.inv)mkdocstrings (enable_inventory = true, objects.inv)
UI Components & Tabssphinx-design (.. grid::, .. tab-set::), auto-pytabspymdownx.tabbed (content.tabs.link), pymdownx.details
Code Inclusion.. literalinclude::pymdownx.snippets (--8<--, check_paths = true)
CLI Referencesphinx-click (.. click::)tools/docs/generate_cli_docs.py
Diagramssphinxcontrib-mermaid (.. mermaid::)pymdownx.superfences (```mermaid)

Core Rules

  • Match the repository's existing documentation engine. Reason: Both Sphinx and Zensical are first-class engines in the Litestar ecosystem; inspect docs/conf.py vs zensical.toml before making edits.
  • Enforce a 68–75ch (46rem) reading column with persistent left and right sidebars. Reason: Uncapped prose columns and hidden right-hand "On this page" outlines degrade scannability on technical pages.
  • Cap guide pages at <= 12 viewports (~80–200 lines) and Reference pages at <= 120 KB HTML (<= 14 TOC items). Reason: Monolithic module dumps with 15+ classes and 200+ inherited methods bury primary constructors.
  • Disable inherited members on leaf classes and show base classes (show_bases = true / :show-inheritance:). Reason: Base driver or repository methods belong once on the base class Reference page.
  • Document every public TypedDict and msgspec.Struct field with a PEP 257 inline docstring immediately below the field. Reason: Sphinx autoclass renders zero fields without inline attribute docstrings, and Griffe requires them to build structured parameter tables.
  • Never write docstrings on @overload stubs or leak internal compiler notes (mypyc, PyCapsule) into public docstrings. Reason: Both engines render overload docstrings ahead of the implementation docstring.
  • Execute standalone docs/examples/**/*.py modules in pytest. Reason: Standalone modules checked by ruff, pyright, and pytest stay runnable and prevent snippet rot.
  • Use [data-md-color-scheme] CSS classes (not <picture><source media="(prefers-color-scheme: dark)">) for light/dark hero banners on Zensical pages, hide single-page left sidebars on Home, and omit redundant <h1> titles above hero logos. Reason: <picture> media queries only respond to OS-level dark mode and fail when toggling Zensical's theme button ([data-md-color-scheme="slate"]).
  • Keep headings unnumbered and free of inline `code` pills, reserve bordered code pills strictly for clickable links (a > code), keep tab labels short (white-space: nowrap), and never write \| inside backticked code in Markdown tables. Reason: Python-Markdown splits table cells on | before backticks are parsed (leaving literal \| in <code>), and bordered pills on every non-link code span create visual noise.

Quick Reference

TopicReference FileKey Contents
Sphinx Architecturereferences/sphinx-architecture.mddocs/conf.py, shibuya / litestar-sphinx-theme, autodoc + napoleon, sphinx-design, custom.css
Zensical Architecturereferences/zensical-architecture.mdzensical.toml, built-in plugins, mkdocstrings-python, pymdownx, postbuild.py, verify_docs_artifacts.py
Information Architecturereferences/information-architecture.mdDomain tabs (Learn, Databases, Integrations, Reference), page budgets, WCAG AAA palette, tutorial structure
Python Docstringsreferences/python-docstrings.mdGoogle style, inline TypedDict / msgspec.Struct docstrings, type alias leak prevention, AST scanner
Database Adapter Docsreferences/database-adapters.mdCentral Capability Matrix, 1-page per-driver guide, own-symbols-only Reference templates (Sphinx & Zensical)
Polyglot & CLI Docsreferences/polyglot-cli.mdTypeScript (TypeDoc / mkdocstrings-typescript), Rust (.pyi stubs + /rustdoc/), Click CLI generation
Interop & Redirectsreferences/migration-interop.mdDirective translation matrix, cross-engine objects.inv linking, URL redirect stubs
<workflow>

Workflow

Step 1: Detect Engine and Configure Dependencies

Inspect the repository root for docs/conf.py (Sphinx) or zensical.toml (Zensical):

  • Sphinx Track: Configure [dependency-groups] doc with sphinx, shibuya (or litestar-sphinx-theme via Git, which extends pydata-sphinx-theme), sphinx-design, sphinx-copybutton, sphinx-click, sphinxcontrib-mermaid, auto-pytabs[sphinx], and myst-parser. Configure docs/conf.py with sphinx.ext.autodoc, sphinx.ext.napoleon, and sphinx.ext.intersphinx. See references/sphinx-architecture.md.
  • Zensical Track: Configure [dependency-groups] doc with zensical>=0.1.3, mkdocstrings-python>=2.0.10, pymdown-extensions>=13.0, and ruff>=0.17.6. Configure zensical.toml with use_directory_urls = true, navigation.tabs, toc.follow, pymdownx.snippets (check_paths = true), and enable_inventory = true. See references/zensical-architecture.md.

Step 2: Enforce Docstring and TypedDict Hygiene

Run tools/docs/scan_public_docstrings.py --check-leaks --check-overloads --check-typeddicts <pkg> before building docs. Ensure every public TypedDict and msgspec.Struct field has an inline PEP 257 docstring and zero duplicate class-level Attributes: blocks. See references/python-docstrings.md.

Step 3: Structure Domain Tabs and Runnable Examples

Organize top-level navigation into task-oriented sections (Learn, Databases when multi-driver, Integrations, Reference, Playground when applicable, Project). Author runnable scripts under docs/examples/<area>/<topic>.py with main() entry points, include them via .. literalinclude:: (Sphinx) or --8<-- (Zensical), and execute them in tests/unit/docs/test_examples.py. See references/information-architecture.md.

Step 4: Author Curated Reference Pages (<= 120 KB HTML, <= 14 TOC items)

Group API directives (.. autoclass:: in Sphinx or ::: in Zensical) under 2–5 H2 category headings per Reference page with explicit member allowlists. Keep inherited_members: false / :no-inherited-members: on leaf classes so inherited base methods are documented once on the base class page. For Click CLIs, use .. click:: (sphinx-click) in Sphinx or tools/docs/generate_cli_docs.py in Zensical.

Step 5: Run Build and Quality Gates

  • Sphinx: Run uv run sphinx-build -b html -W --keep-going docs site and verify output artifacts.
  • Zensical: Run zensical build --clean --strict, tools/docs/postbuild.py, and tools/docs/verify_docs_artifacts.py.
</workflow><guardrails>

Guardrails

  • Never hide .sy-rside (Shibuya), .bd-sidebar-secondary (pydata-sphinx-theme / litestar-sphinx-theme), or .md-sidebar--secondary (Zensical) in custom CSS. Reason: Hiding the right-hand "On this page" outline traps readers on multi-section guides and API pages.
  • Never load numpydoc or sphinx_autodoc_typehints alongside sphinx.ext.napoleon in Sphinx. Reason: Combining them double-parses docstrings and duplicates union types across signatures and parameter lists.
  • Never place :no-index: on primary .. automodule:: directives in Sphinx. Reason: :no-index: strips HTML id="" anchors from public classes and breaks :class: cross-references across the site.
  • Never enable inherited members on leaf adapter or plugin classes. Reason: Repeating 40+ base methods across adapter pages inflates HTML past 400 KB and duplicates search results.
  • Never use mkdocs-click on Click >= 8.3 in Zensical. Reason: mkdocs-click renders literal Sentinel.UNSET defaults and drops positional argument tables; use tools/docs/generate_cli_docs.py.
  • Never map "path/foo.md" = "path/foo/index.md" in Zensical redirect_maps when use_directory_urls = true. Reason: Both resolve to site/path/foo/index.html and create a self-redirect loop; emit flat site/path/foo.html stubs in postbuild.py.
  • Never use <picture><source media="(prefers-color-scheme: dark)"> for hero banners inside Zensical Markdown pages. Reason: Zensical switches themes via [data-md-color-scheme="default"|"slate"] without altering the browser's OS media query, causing the light-mode dark-ink banner to render invisibly on the dark slate canvas.
  • Never style non-link inline `code` spans with heavy border pills or place inline `code` / numbering in ##/### headings. Reason: Bordered pills on every identifier clutter prose and tables, and code spans in headings wrap awkwardly in both the main column and the right-hand TOC.
</guardrails><validation>

Validation Checkpoint

  • uv run python -m tools.docs.scan_public_docstrings --check-leaks --check-overloads --check-typeddicts <pkg> exits 0
  • Documentation build (sphinx-build -b html -W --keep-going docs site or zensical build --clean --strict) exits 0 with zero warnings
  • objects.inv exists in the built output directory and is non-empty
  • Every built Reference HTML file is <= 120,000 bytes with <= 14 "On this page" TOC items
  • uv run pytest tests/unit/docs/ -q passes with zero inline comments in docs/examples/
</validation><example>

Example — Curated Adapter Reference Page (Zensical & Sphinx)

Zensical (docs/reference/adapters/asyncpg.md)

# AsyncPG API Reference

```python
from sqlspec.adapters.asyncpg import AsyncpgConfig, AsyncpgDriver
```

API reference for `sqlspec.adapters.asyncpg`. Inherited execution methods are documented on [`AsyncDriverAdapterBase`](../driver/async.md).

## Configuration & Parameter Types

::: sqlspec.adapters.asyncpg.AsyncpgConfig
    options:
      members:
        - provide_connection
        - provide_session
        - provide_pool
        - create_pool
        - close_pool

::: sqlspec.adapters.asyncpg.config.AsyncpgPoolConfig

## Driver & Exception Handling

::: sqlspec.adapters.asyncpg.AsyncpgDriver
    options:
      inherited_members: false
      show_bases: true
      members:
        - dialect
        - data_dictionary

Sphinx (docs/reference/adapters/asyncpg.rst)

AsyncPG API Reference
=====================

.. code-block:: python

    from sqlspec.adapters.asyncpg import AsyncpgConfig, AsyncpgDriver

API reference for ``sqlspec.adapters.asyncpg``. Inherited execution methods are documented on :class:`~sqlspec.driver.AsyncDriverAdapterBase`.

Configuration & Parameter Types
-------------------------------

.. autoclass:: sqlspec.adapters.asyncpg.AsyncpgConfig
    :members: provide_connection, provide_session, provide_pool, create_pool, close_pool
    :no-inherited-members:
    :show-inheritance:

.. autoclass:: sqlspec.adapters.asyncpg.config.AsyncpgPoolConfig
    :members:
    :no-inherited-members:

Driver & Exception Handling
---------------------------

.. autoclass:: sqlspec.adapters.asyncpg.AsyncpgDriver
    :members: dialect, data_dictionary
    :no-inherited-members:
    :show-inheritance:
</example>

References Index

  • Sphinx Documentation Architecture
  • Zensical Documentation Architecture
  • Information Architecture & Page Budgets
  • Python Docstrings & API Hygiene
  • Database Adapter Documentation
  • Polyglot TypeScript, Rust, and Click CLI Docs
  • Engine Interoperability, Syntax Translation & Redirects

Official References

Shared Styleguide Baseline

  • General Principles
  • Python
  • CI/CD

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.