Back to skills
SKILL.md
Litestar Docs
ASecurityUse 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.
- 19 stars
- 0 votes
- 0 copies
- 0 views
- Added November 9, 2026
Works with
Security analysis
100/100Pro scans all 8 files and shows the line behind each finding
npx -y skills add litestar-org/litestar-skills --skill litestar-docs --agent claude-codeAre you the author of Litestar Docs?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/litestar-org-litestar-docs)---
name: litestar-docs
description: "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."
---
# 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
| Aspect | Sphinx (`docs/conf.py`) | Zensical (`zensical.toml`) |
| --- | --- | --- |
| **Primary Config** | `docs/conf.py` | `zensical.toml` |
| **Markup Formats** | `.rst` (reStructuredText) + `.md` (`myst-parser`) | `.md` (Python Markdown + `pymdown-extensions`) |
| **Theme & Styling** | `shibuya` or `litestar-sphinx-theme` (`docs/_static/custom.css`) | `variant = "modern"` (`docs/stylesheets/extra.css`) |
| **Python API Extraction** | `sphinx.ext.autodoc` + `sphinx.ext.napoleon` | `mkdocstrings-python` (Griffe static AST, optional `griffe-fieldz`) |
| **Cross-Repo Linking** | `sphinx.ext.intersphinx` (`objects.inv`) | `mkdocstrings` (`enable_inventory = true`, `objects.inv`) |
| **UI Components & Tabs** | `sphinx-design` (`.. grid::`, `.. tab-set::`), `auto-pytabs` | `pymdownx.tabbed` (`content.tabs.link`), `pymdownx.details` |
| **Code Inclusion** | `.. literalinclude::` | `pymdownx.snippets` (`--8<--`, `check_paths = true`) |
| **CLI & Config Tables** | `sphinx-click` (`.. click::`) | `tools/docs/generate_cli_docs.py` + AST-only `generate_config_tables.py` |
| **Diagrams** | `sphinxcontrib-mermaid` (`.. mermaid::`) | `pymdownx.superfences` (```` ```mermaid ````) |
## Code Style Rules
- **Match the repository's existing documentation engine.** Reason: 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 hurt scannability.
- **Cap guide pages at `<= 12` viewports (`~80–200` lines) and Reference pages at `<= 120 KB` HTML (`<= 14` TOC items).** Reason: Monolithic module dumps 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 renders zero fields without inline docstrings, and Griffe / `griffe-fieldz` require them for 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` prevent snippet drift.
- **Use `body:not([data-md-color-scheme="slate"])` / `[data-md-color-scheme]` CSS selectors (not `<picture><source media="(prefers-color-scheme: dark)">` and not `:root:not(...)`) for light/dark hero banners on Zensical pages.** Reason: Zensical sets `data-md-color-scheme` on `<body>` when toggling its theme switcher; `:root` and OS media queries do not track the toggle.
- **Keep headings unnumbered and free of inline `` `code` `` pills, reserve bordered code pills 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, and code spans in headings wrap awkwardly in the right-hand TOC.
## Quick Reference
| Topic | Reference File | Key Contents |
| --- | --- | --- |
| Sphinx Architecture | [`references/sphinx-architecture.md`](references/sphinx-architecture.md) | `docs/conf.py`, `shibuya` / `litestar-sphinx-theme`, `autodoc` + `napoleon`, `sphinx-design`, `custom.css` |
| Zensical Architecture | [`references/zensical-architecture.md`](references/zensical-architecture.md) | `zensical.toml`, built-in plugins, `mkdocstrings-python`, `griffe-fieldz`, `pymdownx`, `postbuild.py`, `verify_docs_artifacts.py` |
| Information Architecture | [`references/information-architecture.md`](references/information-architecture.md) | Domain tabs (`Learn`, `Databases`, `Integrations`, `Reference`), page budgets, WCAG AAA palette, tutorial structure |
| Python Docstrings | [`references/python-docstrings.md`](references/python-docstrings.md) | Google style, inline `TypedDict` / `msgspec.Struct` docstrings, `griffe-fieldz`, AST config tables, AST scanner |
| Database Adapter Docs | [`references/database-adapters.md`](references/database-adapters.md) | Central Capability Matrix, 1-page per-driver guide, own-symbols-only Reference templates (Sphinx & Zensical) |
| Polyglot & CLI Docs | [`references/polyglot-cli.md`](references/polyglot-cli.md) | TypeScript (`TypeDoc` / `mkdocstrings-typescript`), Rust (`.pyi` stubs + `/rustdoc/`), Click CLI generation |
| Interop & Redirects | [`references/migration-interop.md`](references/migration-interop.md) | Directive 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`), `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`.
- **Zensical Track**: Configure `[dependency-groups] doc` with `zensical>=0.1.3`, `mkdocstrings-python>=2.0.10`, `pymdown-extensions>=10.16,<12`, and `ruff>=0.17.6` (plus `griffe-fieldz` when rendering `msgspec.Struct` / dataclass field tables via Griffe). Set `exclude_docs` as a multiline string (`exclude_docs = """\nexamples/**\n"""`, never a TOML array).
### 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. For large config tables, generate Markdown blocks with an AST-only `tools/docs/generate_config_tables.py` script (`<!-- GENERATED:START config-table:... -->`) so builds do not require importing optional database drivers.
### Step 3: Structure Domain Tabs and Runnable Examples
Organize top-level navigation into task-oriented sections (`Learn`, `Databases` when multi-driver, `Integrations`, `Reference`, `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`.
### Step 4: Author Curated Reference Pages
Group API directives (`.. autoclass::` in Sphinx or `:::` in Zensical) under 2–5 H2 category headings per Reference page with explicit member allowlists, staying within `<= 120 KB` HTML and `<= 14` TOC items. Keep `inherited_members: false` / `:no-inherited-members:` on leaf classes. Watch online `objects.inv` cross-reference links inside attribute tables — linking every `str`/`int`/`None` type token inflates generated HTML size significantly when custom templates do not strip trivial builtins.
### Step 5: Run Build and Quality Checks
- **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)">` or `:root:not([data-md-color-scheme="slate"])` for Zensical hero banners.** Reason: Zensical switches themes via `data-md-color-scheme` on `<body>` without changing `:root` or OS media queries.
- **Never style non-link inline `` `code` `` spans with heavy border pills or place inline `` `code` `` / numbering in `##`/`###` headings.** Reason: Bordered pills clutter prose and tables, and code spans in headings wrap awkwardly in 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 Reference Page
````markdown
# AsyncPG API Reference
```python
from sqlspec.adapters.asyncpg import AsyncpgConfig, AsyncpgDriver
```
Inherited execution methods are documented on [`AsyncDriverAdapterBase`](../driver/async.md).
## Configuration
::: sqlspec.adapters.asyncpg.AsyncpgConfig
options:
members: [provide_connection, provide_session, provide_pool, create_pool, close_pool]
## Driver
::: sqlspec.adapters.asyncpg.AsyncpgDriver
options:
inherited_members: false
show_bases: true
members: [dialect, data_dictionary]
````
For the matching Sphinx `.rst` template and multi-driver capability matrix, see [`references/database-adapters.md`](references/database-adapters.md).
</example>
## References Index
- [Sphinx Documentation Architecture](references/sphinx-architecture.md)
- [Zensical Documentation Architecture](references/zensical-architecture.md)
- [Information Architecture & Page Budgets](references/information-architecture.md)
- [Python Docstrings & API Hygiene](references/python-docstrings.md)
- [Database Adapter Documentation](references/database-adapters.md)
- [Polyglot TypeScript, Rust, and Click CLI Docs](references/polyglot-cli.md)
- [Engine Interoperability, Syntax Translation & Redirects](references/migration-interop.md)
## Official References
- <https://www.sphinx-doc.org/en/master/> — Sphinx documentation
- <https://shibuya.lepture.com/> — Shibuya Sphinx theme
- <https://zensical.org/docs/> — Zensical documentation
- <https://mkdocstrings.github.io/python/> — mkdocstrings-python & Griffe options
## Shared Styleguide Baseline
- [General Principles](../litestar-styleguide/references/general.md)
- [Python](../litestar-styleguide/references/python.md)
- [CI/CD](../litestar-styleguide/references/ci-cd.md)
Files in this skill
- SKILL.md
- references/database-adapters.md
- references/information-architecture.md
- references/migration-interop.md
- references/polyglot-cli.md
- references/python-docstrings.md
- references/sphinx-architecture.md
- references/zensical-architecture.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.