plugins/litestar/skills/litestar-authentication/SKILL.md
Implement Litestar authentication with custom authentication middleware, built-in security backends, JWT and session flows, route inclusion and exclusion rules, and typed auth context on `Request` / `ASGIConnection`. Use when establishing identity, issuing or validating credentials, or attaching authenticated user context in Litestar. Do not use for generic request parsing, broad security audits, or unrelated transport concerns.
npx skillsauth add alti3/litestar-skills litestar-authenticationInstall 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.
on_app_init or middleware.request.user and request.auth only after authentication has been established.request.user and request.auth as authenticated context, not parsing shortcuts.401 behavior unless the project has a documented alternative.SessionAuth for browser-first applications with server-managed sessions.JWTAuth for token-in-header API clients.JWTCookieAuth for browser flows where token cookies are intentional.OAuth2PasswordBearerAuth when password-flow token issuance semantics are required.AbstractAuthenticationMiddleware when the credential source or validation logic is custom.litestar-security when the task includes authorization policy, secrets, and defense-in-depth concerns beyond identity wiring.Read only the sections you need:
Request or ASGIConnection after auth runs.401 / 403 response formatting to litestar-exception-handling.request.user as available on routes excluded from authentication.request.user and request.auth have the expected types on authenticated routes.litestar-requests for header, cookie, and body parsing concerns that are not identity-specific.litestar-security for authorization, secret hygiene, and broader security posture.litestar-exception-handling to standardize 401 and 403 contracts.litestar-testing for auth boundary, exclusion-rule, and token-flow tests.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.
tools
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.
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.