litestar-org/litestar-skills/litestar
Claude Code and agent skill by litestar-org/litestar-skills
- community
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/litestarSKILL.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 intoController/Routerhierarchies, and centralize application wiring increate_app() -> Litestar. - Use explicit parameter and body annotations (
FromPath,FromQuery,JSONBody,NamedDependency). Avoid untyped reserved kwargs (such asdata: MyDTOwithout a body marker) and deprecatedlitestar.params.Dependency. - Define explicit
msgspec.Struct(camelCase wire format viarename="camel") or DTO boundary contracts (dtoandreturn_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 inGuardfunctions 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)
| Subsystem | Key Symbols / Patterns | Reference | |
|---|---|---|---|
| App Composition & Lifecycle | Litestar(...), AppConfig, ApplicationCore, lifespan, State, ImmutableState, 2.22–2.25 contracts | app-and-lifecycle.md | |
| CLI & Project Config | Autodiscovery, LITESTAR_* env vars, litestar run/info/routes/schema/sessions, CLIPlugin, litestar.toml | cli-and-config.md | |
| Route Handlers & Controllers | @get/@post/@put/@patch/@delete, Controller, Router, layered config inheritance | handlers.md | |
| Parameters & Request Bodies | FromPath, FromQuery, FromHeader, FromCookie, JSONBody, RequestBody, MsgPackBody, MultipartBody, URLEncodedBody, RawBody, QueryParams, RequestCookies, UploadFile | parameters.md | |
| Domain Package Layout | domains/<name>/ structure, sub-controllers, full-stack domain wiring | layout.md | |
| DTOs & Boundary Contracts | MsgspecDTO, SQLAlchemyDTO, DataclassDTO, PydanticDTO, DTOConfig, DTOData[T], DTOField, Mark | dtos.md | |
| OpenAPI & Schema UI | OpenAPIConfig, Scalar/Swagger/Redoc/Stoplight/RapiDoc plugins, ResponseSpec, Operation, security schemes | openapi.md | |
| Dependency Injection & Dishka | Provide, NamedDependency[T], SkipValidation[T], generator cleanup, FromDishka[T], setup_dishka | di-and-dishka.md | |
| Authentication & Guards | Guard callables, ASGIConnection, JWTAuth, JWTCookieAuth, SessionAuth, OAuth2, RBAC & tenant guards | auth-and-guards.md | |
| Middleware & HTTP Security | ASGIMiddleware, DefineMiddleware, CORSConfig, CSRFConfig, AllowedHostsConfig, CompressionConfig, RateLimitConfig | middleware.md | |
| Exceptions & Problem Details | HTTPException hierarchy, ApplicationError mapping, exception_handlers, after_exception, RFC 9457 | exceptions.md | |
| Plugin Protocols | InitPlugin, CLIPluginProtocol, SerializationPluginProtocol, OpenAPISchemaPluginProtocol, DIPlugin, PydanticPlugin | plugins.md | |
| WebSockets | @websocket, WebSocket lifecycle, @websocket_listener, @websocket_stream, WS Dishka DI, WS guards, stream_pubsub | websockets.md | |
| Channels & Server-Sent Events | ChannelsPlugin (Memory, Redis, AsyncPg, PsycoPg, SQLSpec), ServerSentEvent, Stream, RealtimeEvent, RealtimePublisher | channels-and-sse.md | |
| Typed Settings & Env Config | dataclass + get_env vs pydantic-settings, @lru_cache factories, plugin config builders | settings.md | |
| Filters & Pagination | create_filter_dependencies, FilterTypes, OffsetPagination, ClassicPagination, cursor pagination, custom search | filters-and-pagination.md | |
| Data Services & Repositories | SQLAlchemyAsyncRepositoryService (advanced-alchemy) and SQLSpecAsyncService (sqlspec) CRUD services | services-and-repos.md | |
| Logging & Observability | LoggingConfig, StructlogPlugin, OpenTelemetryPlugin, PrometheusConfig, PrometheusController | logging-and-observability.md | |
| Stores & Response Caching | StoreRegistry, MemoryStore, FileStore, RedisStore, ValkeyStore, ResponseCacheConfig | stores-and-caching.md |
Standalone Ecosystem Skills
| Task | Skill | |
|---|---|---|
Convention-based domain-package discovery (AutowirePlugin, domain_packages) | litestar-autowire | |
msgspec.Struct, Meta, tagged unions, JSON/MsgPack encode/decode hooks | msgspec | |
SecurityPlugin, CurrentUser, Principal, @requires_role/@requires_scope/@requires_tenant | litestar-security | |
SQLAlchemy ORM models, SQLAlchemyPlugin, Alembic migrations, repositories | advanced-alchemy | |
SQL-first drivers, SQLFileLoader, query builders, ADK stores, data dictionary | sqlspec | |
Vite asset pipeline, HMR, TypeGen, SPA/hybrid modes, and Inertia.js (InertiaConfig, component=) | litestar-vite | |
Server-rendered HTMX requests, partial templates, HX-* response helpers | litestar-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 mounts | litestar-granian | |
TestClient, AsyncTestClient, create_async_test_client, handler/DI/Guard tests | litestar-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 gates | litestar-styleguide |
<workflow>
Workflow
- Detect the project stack first: inspect
pyproject.toml,litestar.toml, existing domain packages, DI setup (ProvidevsDishka), data layer (advanced-alchemyvssqlspec), settings (dataclassvspydantic-settings), and auth (JWTAuth/SessionAuthvslitestar-security). - Open the matching core reference in
references/*.mdfor any Litestar framework concern:
- Routing, controllers, parameters, or domain layout -> handlers.md, parameters.md, layout.md
- DTOs, request/response schemas, or OpenAPI docs -> dtos.md, openapi.md
- Dependency injection or Dishka providers -> di-and-dishka.md
- Auth backends, guards, middleware, or exception handlers -> auth-and-guards.md, middleware.md, exceptions.md
- Plugins, WebSockets, Channels/SSE, settings, or CRUD services/filters -> plugins.md, websockets.md, channels-and-sse.md, settings.md, filters-and-pagination.md, services-and-repos.md
- App composition, CLI, logging/metrics/tracing, or stores/caching -> app-and-lifecycle.md, cli-and-config.md, logging-and-observability.md, stores-and-caching.md
- 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). - 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
Guardcallables, 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_dtowithoutexclude/includefield 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
- SKILL.md in the repositoryCheckingskills/litestar/SKILL.md
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
[](https://verified-skill.com/skills/litestar-org/litestar-skills/litestar)