plugins/litestar/skills/litestar-testing/SKILL.md
Test Litestar applications with TestClient, AsyncTestClient, create_test_client, websocket test helpers, dependency overrides, mocked dependencies, lifecycle-aware fixtures, and deterministic success and failure assertions. Use when adding or fixing Litestar test coverage, including exception contracts, override precedence, websocket behavior, event-bus side effects, or live-server-only response patterns. Do not use as a substitute for production observability or runtime debugging strategy.
npx skillsauth add alti3/litestar-skills litestar-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
TestClient, AsyncTestClient, create_test_client, or subprocess live-server helpers.AsyncTestClient when tests, fixtures, and app resources must share the same event loop.create_test_client for isolated handler tests or small app subsets.TestClient for synchronous tests that do not need to share async resources with the app.AsyncTestClient when async fixtures or resources are involved.create_test_client when you want a disposable app assembled inline for one test.websocket_connect() for websocket contract tests.Read only the sections you need:
404/405 testing, and layered precedence tests, read references/failure-patterns.md.app.debug only when a test needs it; otherwise keep tests aligned with production-facing behavior.TestClient with async fixtures that create loop-bound resources.404 and 405 handlers are tested at app scope.litestar-dependency-injection to design override-friendly providers and scope rules.litestar-exception-handling to standardize failure envelopes before locking tests.litestar-events when tests depend on event IDs, listeners, and custom emitter behavior.litestar-responses for stream, redirect, file, and SSE contract details.litestar-openapi when tests must lock down schema or docs behavior.litestar-websockets when the main challenge is websocket endpoint design rather than test harness setup.development
Build Litestar WebSocket endpoints with low-level websocket handlers, websocket listeners, websocket streams, dependency injection, custom websocket classes, transport-mode control, and graceful connection lifecycle handling. Use when implementing bidirectional real-time communication, reactive websocket message handling, or proactive server push over WebSockets. Do not use for server-side pub/sub fanout that is better expressed with channels alone.
development
Configure Litestar templating with `TemplateConfig`, Jinja/Mako/MiniJinja engines, file-or-string `Template` responses, request and CSRF-aware context, template callables, and custom engine integration. Use when implementing or fixing server-rendered HTML in Litestar. Do not use for static asset serving or pure JSON API endpoints.
development
Configure Litestar stores and the store registry for caching, server-side sessions, rate limiting, and other key-value state with explicit backend selection, bytes-safe data handling, TTL and renewal policy, namespacing, registry wiring, and lifecycle cleanup. Use when a Litestar app depends on `MemoryStore`, `FileStore`, `RedisStore`, `ValkeyStore`, or `StoreRegistry`. Do not use for relational persistence, domain repositories, or response-caching policy details that belong in database or caching-focused skills.
development
Serve static assets in Litestar with `create_static_files_router()`, explicit mount paths, HTML mode, cache-control policy, URL reversal, custom file systems, and symlink-safe directory boundaries. Use when exposing JS, CSS, images, downloadable artifacts, or static HTML from controlled directories. Do not use for upload ingestion, user-writable file publication, or arbitrary file-download endpoints that need per-request authorization logic.