agentsclimarketplace

Litestar dto openapi

Skill litestar-org/litestar-skills/plugins/litestar/skills/litestar-dto-openapi

Opinionated first-party agent skills, plugins, subagents, slash commands, and MCP servers for the Litestar framework ecosystem — publishable to Claude Code, Gemini CLI, Codex CLI, Cursor, OpenCode, and VS Code/Copilot from a single repo.

Install
npx -y skills add litestar-org/litestar-skills --skill litestar-dto-openapi

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 13 stars13 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Auto-activate for MsgspecDTO, DTOConfig, litestar.dto, OpenAPIConfig, response DTOs, schema_extra, RequestEncodingType, or /schema. Not for persistence models alone.

SKILL.md

2.5 KB, as published. Nobody here has run it

Litestar DTO and OpenAPI

Use this skill for DTO selection, msgspec-first schemas, request/response typing, and OpenAPI shape.

Code Style Rules

  • Prefer msgspec DTOs in Litestar apps unless the project is already Pydantic-led.
  • Keep persistence models separate from API DTOs.
  • Use camelCase wire names while Python stays snake_case.
  • Exclude server-owned fields from write DTOs.
  • Treat nullability and requiredness separately: T | None permits null; only a default value makes a field optional.

Quick Reference

<workflow>

Workflow

  1. Identify input, output, and persistence shapes separately.
  2. Choose msgspec DTOs or match the existing Pydantic stack.
  3. Configure excludes, partial updates, rename behavior, and media type.
  4. Check the generated OpenAPI schema.
</workflow> <guardrails>

Guardrails

  • Do not leak internal persistence-only fields into write DTOs.
  • Do not switch an existing Pydantic-heavy project to msgspec opportunistically.
  • Do not rely on untyped dict payloads when request shape is known.
  • Do not treat OpenAPI as documentation only; it is the contract.
</guardrails> <validation>

Validation Checkpoint

  • Request and response DTOs are explicit.
  • Wire names match the API convention.
  • Server-owned fields are excluded from writes.
  • /schema output matches the intended contract.
  • Nullable fields without defaults remain in the OpenAPI required array.
</validation> <example>

Example

from litestar.dto import DTOConfig, MsgspecDTO

class UserWriteDTO(MsgspecDTO[UserWrite]):
    config = DTOConfig(exclude={"id", "created_at"})
</example>

References Index

Official References

Shared Styleguide Baseline

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.