Litestar styleguide

From litestar-org/litestar-skills · View interactive version

Litestar styleguide is an AI agent skill from the GitHub repository litestar-org/litestar-skills. Use when authoring Litestar skill content, Python/TypeScript examples, PEP 604, async I/O, Google docstrings, ruff/mypy/pyright, pytest, or CI rules. Not for focused Litestar APIs.

How to use this skill

Skill file

litestar-styleguide

This is the shared style baseline that every other skill in this plugin references. It exists so that cross-cutting rules (PEP 604 unions, async I/O, ruff + mypy + pyright + prek, test file naming, CI/CD conventions) live in exactly one place — and individual skills stay focused on their framework or tool-specific surface.

Code Style Rules

Quick Reference

| Slice | Reference File | Key Topics |

| --- | --- | --- |

| Cross-language principles | CODE0 | Simplicity over cleverness, boundary validation, naming, import order |

| Python conventions | CODE0 | PEP 604/585, # noqa: TC001, TC002, msgspec.Struct, async I/O, docstrings, ruff, mypy, pyright, prek |

| Litestar baseline | CODE0 | Typed markers (FromPath, FromQuery, JSONBody, RequestBody, NamedDependency, SkipValidation), Provide vs Dishka, MsgspecDTO, Guards, plugins |

| TypeScript conventions | CODE0 | Strict tsconfig, discriminated unions, named exports, oxlint / biome |

| Testing conventions | CODE0 | pytest + anyio, AsyncTestClient lifespan fixtures, Vitest, 90%+ coverage |

| CI/CD conventions | CODE0 | GitHub Actions with setup-uv, prek / .pre-commit-config.yaml, matrix builds |

| Canonical reference apps | CODE0 | litestar-fullstack-inertia, litestar-fullstack, litestar-sqlstack, oracledb-vertexai-demo |

| Google Developer Knowledge MCP | CODE0 | Opt-in MCP setup for fresh GCP / Firebase / Maps documentation |

| Documentation architecture | CODE0 | Zensical Free (zensical.toml), mkdocstrings-python (Griffe), TypedDict inline docstrings, objects.inv, llms.txt |

How sibling skills consume this

Every SKILL.md in this plugin has a ## Shared Styleguide Baseline section near the bottom. That section links to a subset of these references — only the ones that apply to the skill's language / framework mix. For example:

The sibling skill extends the baseline with its own tool-specific Code Style Rules, Quick Reference, Guardrails, and Validation — but it does not duplicate the baseline. If a convention is generic (type hints, naming, imports), it belongs here.

When to update this skill

<workflow>

Workflow — consuming this baseline

  1. Open the sibling skill you are editing (skills/<name>/SKILL.md).
  2. Look at its ## Shared Styleguide Baseline section — it already lists a subset of the references here.
  3. When adding a rule to the sibling, ask: is it generic (language/tooling) or framework-specific? Generic → land it in the right file under references/ here. Specific → keep it in the sibling.
  4. Cross-link bidirectionally if a rule here is amplified in the sibling.

</workflow>

<guardrails>

Guardrails

</guardrails>

<validation>

Validation Checkpoint

</validation>

<example>

Example — adding a new rule

A reviewer finds that two sibling skills independently wrote "use ruff format not black". Instead of leaving duplicates, pull the rule into references/python.md:

- **Use `ruff format`, never `black`.** Reason: ruff is the single toolchain for
  lint + format; running two formatters produces style drift.

Then in each sibling's SKILL.md, replace the duplicate with a pointer:

## Shared Styleguide Baseline

- [Python](../litestar-styleguide/references/python.md)

</example>

References Index

Official References

Shared Styleguide Baseline

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.