litestar-org/litestar-skills/litestar

Claude Code and agent skill by litestar-org/litestar-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Auto-activate for Litestar, Controller, Router, @get/@post, FromPath, MsgspecDTO, OpenAPIConfig, Provide, FromDishka, Guard, ASGIMiddleware, HTTPException, ChannelsPlugin, or WebSocket. Not for standalone libs.

Install

npx vskill@latest install litestar-org/litestar-skills/litestar

SKILL.md

Litestar Core Framework & Ecosystem Hub

Use this skill for all core Litestar framework subsystems (application composition, routing, controllers, parameters, DTOs, OpenAPI, dependency injection, Dishka integration, authentication/guards, middleware, exception handling, plugin protocols, WebSockets, Channels/SSE, typed settings, and CRUD data services/pagination) and to route to standalone Litestar ecosystem skills.

This guidance targets the released Litestar 2.25.0 contract. Do not copy unreleased main APIs into consumer examples.

Code Style Rules

  • Prefer first-party Litestar ecosystem packages (litestar-granian, advanced-alchemy, sqlspec, msgspec, litestar-saq, litestar-queues, litestar-vite, litestar-autowire, litestar-security, litestar-email, litestar-mcp, litestar-htmx) and match the project's existing stack.
  • Keep Litestar(...) app setup and route handlers thin: group domain routes into Controller / Router hierarchies, and centralize application wiring in create_app() -> Litestar.
  • Use explicit parameter and body annotations (FromPath, FromQuery, JSONBody, NamedDependency). Avoid untyped reserved kwargs (such as data: MyDTO without a body marker) and deprecated litestar.params.Dependency.
  • Define explicit msgspec.Struct (camelCase wire format via rename="camel") or DTO boundary contracts (dto and return_dto) on routes and controllers; never expose raw ORM models directly without a write-safe DTO.
  • Enforce authentication via middleware or litestar-security, and enforce authorization in Guard functions or security decorators — never inside route handler bodies.
  • Prefer built-in middleware configs (CORSConfig, CSRFConfig, AllowedHostsConfig, RateLimitConfig, CompressionConfig) over custom middleware.
  • Raise domain-specific exceptions in services and map them to HTTP responses in exception_handlers.
  • Use async I/O for all request handlers, WebSocket/SSE streams, service methods, stores, and external clients.

Quick Reference

Core Framework Subsystems (This Skill)
SubsystemKey Symbols / PatternsReference
App Composition & LifecycleLitestar(...), AppConfig, ApplicationCore, lifespan, State, ImmutableState, 2.22–2.25 contractsapp-and-lifecycle.md
CLI & Project ConfigAutodiscovery, LITESTAR_* env vars, litestar run/info/routes/schema/sessions, CLIPlugin, litestar.tomlcli-and-config.md
Route Handlers & Controllers@get/@post/@put/@patch/@delete, Controller, Router, layered config inheritancehandlers.md
Parameters & Request BodiesFromPath, FromQuery, FromHeader, FromCookie, JSONBody, RequestBody, MsgPackBody, MultipartBody, URLEncodedBody, RawBody, QueryParams, RequestCookies, UploadFileparameters.md
Domain Package Layoutdomains/<name>/ structure, sub-controllers, full-stack domain wiringlayout.md
DTOs & Boundary ContractsMsgspecDTO, SQLAlchemyDTO, DataclassDTO, PydanticDTO, DTOConfig, DTOData[T], DTOField, Markdtos.md
OpenAPI & Schema UIOpenAPIConfig, Scalar/Swagger/Redoc/Stoplight/RapiDoc plugins, ResponseSpec, Operation, security schemesopenapi.md
Dependency Injection & DishkaProvide, NamedDependency[T], SkipValidation[T], generator cleanup, FromDishka[T], setup_dishkadi-and-dishka.md
Authentication & GuardsGuard callables, ASGIConnection, JWTAuth, JWTCookieAuth, SessionAuth, OAuth2, RBAC & tenant guardsauth-and-guards.md
Middleware & HTTP SecurityASGIMiddleware, DefineMiddleware, CORSConfig, CSRFConfig, AllowedHostsConfig, CompressionConfig, RateLimitConfigmiddleware.md
Exceptions & Problem DetailsHTTPException hierarchy, ApplicationError mapping, exception_handlers, after_exception, RFC 9457exceptions.md
Plugin ProtocolsInitPlugin, CLIPluginProtocol, SerializationPluginProtocol, OpenAPISchemaPluginProtocol, DIPlugin, PydanticPluginplugins.md
WebSockets@websocket, WebSocket lifecycle, @websocket_listener, @websocket_stream, WS Dishka DI, WS guards, stream_pubsubwebsockets.md
Channels & Server-Sent EventsChannelsPlugin (Memory, Redis, AsyncPg, PsycoPg, SQLSpec), ServerSentEvent, Stream, RealtimeEvent, RealtimePublisherchannels-and-sse.md
Typed Settings & Env Configdataclass + get_env vs pydantic-settings, @lru_cache factories, plugin config builderssettings.md
Filters & Paginationcreate_filter_dependencies, FilterTypes, OffsetPagination, ClassicPagination, cursor pagination, custom searchfilters-and-pagination.md
Data Services & RepositoriesSQLAlchemyAsyncRepositoryService (advanced-alchemy) and SQLSpecAsyncService (sqlspec) CRUD servicesservices-and-repos.md
Logging & ObservabilityLoggingConfig, StructlogPlugin, OpenTelemetryPlugin, PrometheusConfig, PrometheusControllerlogging-and-observability.md
Stores & Response CachingStoreRegistry, MemoryStore, FileStore, RedisStore, ValkeyStore, ResponseCacheConfigstores-and-caching.md
Standalone Ecosystem Skills
TaskSkill
Convention-based domain-package discovery (AutowirePlugin, domain_packages)litestar-autowire
msgspec.Struct, Meta, tagged unions, JSON/MsgPack encode/decode hooksmsgspec
SecurityPlugin, CurrentUser, Principal, @requires_role/@requires_scope/@requires_tenantlitestar-security
SQLAlchemy ORM models, SQLAlchemyPlugin, Alembic migrations, repositoriesadvanced-alchemy
SQL-first drivers, SQLFileLoader, query builders, ADK stores, data dictionarysqlspec
Vite asset pipeline, HMR, TypeGen, SPA/hybrid modes, and Inertia.js (InertiaConfig, component=)litestar-vite
Server-rendered HTMX requests, partial templates, HX-* response helperslitestar-htmx
Redis-backed background workers, queues, cron schedules (litestar-saq)litestar-saq
SQL/memory task queues, @task, QueueService, workers (litestar-queues)litestar-queues
Transactional email (EmailPlugin, SMTP/Resend/SendGrid/Mailgun/SES backends)litestar-email
Model Context Protocol servers and agent runtimes (LitestarMCP, SkillController, AgentRuntime)litestar-mcp
Granian ASGI server plugin, runtime threads, HTTP/2, TLS, static mountslitestar-granian
TestClient, AsyncTestClient, create_async_test_client, handler/DI/Guard testslitestar-testing
Typed test data factories (MsgspecFactory, ModelFactory, DataclassFactory)polyfactory
Docker database/service fixtures for integration tests (pytest-databases)pytest-databases
Wheels, PyApp standalone binaries, GitHub release matrices (litestar-build)litestar-build
Containers, Cloud Run, GKE, Kubernetes, systemd, runtime servers (litestar-deployment)litestar-deployment
Python/TypeScript/Litestar code style, linting, typing, and quality gateslitestar-styleguide

<workflow>

Workflow

  1. Detect the project stack first: inspect pyproject.toml, litestar.toml, existing domain packages, DI setup (Provide vs Dishka), data layer (advanced-alchemy vs sqlspec), settings (dataclass vs pydantic-settings), and auth (JWTAuth/SessionAuth vs litestar-security).
  2. Open the matching core reference in references/*.md for any Litestar framework concern:
  1. Open standalone ecosystem skills when working on dedicated first-party packages (advanced-alchemy, sqlspec, msgspec, litestar-vite, litestar-htmx, litestar-saq, litestar-queues, litestar-security, litestar-autowire, litestar-email, litestar-mcp, litestar-granian, litestar-testing, polyfactory, pytest-databases, litestar-build, litestar-deployment).
  2. Keep the stack consistent across the feature: never mix two persistence layers, two DI containers, or two settings paradigms unless the repository already bridges them intentionally.

</workflow>

<guardrails>

Guardrails

  • Do not infer a new stack from examples — always match the current project's data layer, DI pattern, settings style, and auth mechanism first.
  • Do not put authentication, authorization, SQL queries, environment parsing, or heavy background work directly inside route handlers; delegate to Guard callables, services/repositories, cached settings factories, and task queues.
  • Do not use deprecated StaticFilesConfig, litestar.contrib.* plugins, litestar.repository, litestar.params.Dependency, or implicit dependency parameters.
  • Do not expose ORM models directly in dto / return_dto without exclude / include field rules that prevent mass assignment and hidden relationship lazy-loads.
  • Do not call os.getenv() inside request handlers or module-level code outside the settings module, and never hardcode secrets in source files.
  • Do not call start_subscription(..., history=N) on Channels backends that do not implement history (RedisChannelsPubSubBackend, AsyncPgChannelsBackend, PsycoPgChannelsBackend).

</guardrails>

<validation>

Validation Checkpoint

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/litestar-org/litestar-skills/litestar/badge)](https://verified-skill.com/skills/litestar-org/litestar-skills/litestar)

Something wrong with this skill or its page? Tell us.