litestar-dataclasses

- Define dataclasses for transport boundaries with explicit field types.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "litestar-dataclasses" with this command: npx skills add alti3/litestar-skills/alti3-litestar-skills-litestar-dataclasses

Dataclasses

Execution Workflow

  • Define dataclasses for transport boundaries with explicit field types.

  • Use defaults and optionality intentionally to avoid ambiguous schemas.

  • Combine with DTO configuration when write/read shapes diverge.

  • Keep domain entities and transport dataclasses separate when needed.

Implementation Rules

  • Favor immutable or clearly controlled mutation patterns.

  • Avoid embedding persistence/session behavior in dataclasses.

  • Keep field names/schema stable for clients.

  • Validate nested dataclass behavior in serialization paths.

Example Pattern

from dataclasses import dataclass from litestar import post

@dataclass class CreateUser: name: str email: str

@post("/users") async def create_user(data: CreateUser) -> dict[str, str]: return {"email": data.email}

Validation Checklist

  • Confirm request binding maps correctly into dataclass fields.

  • Confirm response serialization matches expected JSON schema.

  • Confirm DTO include/exclude behavior remains predictable.

Cross-Skill Handoffs

  • Use litestar-dto for advanced shaping and nested field policy.

  • Use litestar-plugins when switching to different model ecosystems.

Litestar References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

litestar-authentication

No summary provided by upstream source.

Repository SourceNeeds Review
General

litestar-routing

No summary provided by upstream source.

Repository SourceNeeds Review
General

litestar-testing

No summary provided by upstream source.

Repository SourceNeeds Review
General

litestar-databases

No summary provided by upstream source.

Repository SourceNeeds Review