plugins/litestar/skills/litestar-templating/SKILL.md
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.
npx skillsauth add alti3/litestar-skills litestar-templatingInstall 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.
template_config with the right TemplateConfig shape: directory, directory=[...], or instance=....Template responses with explicit template_name or template_str and a stable, minimal context mapping.engine_callback.template_config.directory or directory=[...] for normal file-based templates.instance= only when you intentionally own engine creation or loader/environment wiring.instance with directory.template_name for normal pages and reusable fragments; use template_str only for small inline templates.instance= when you need a custom environment, loader, or preconfigured engine object.engine_callback when the engine needs custom callables, globals, or centralized one-time setup.Read only the sections you need:
TemplateConfig, directory vs. instance setup, and engine access, read references/engine-selection-and-setup.md.Template responses, file vs. string rendering, context shaping, request access, and CSRF inputs, read references/template-responses-and-context.md..jinja2, .mako, or .minijinja.url_for and url_for_static_asset inside templates for links and asset references.csrf_input for HTML forms and csrf_token only when the token must be embedded another way.template_str mainly for very small fragments, prototyping, or HTMX-style inline responses.directory and instance in the same TemplateConfig.template_str snippets.template_config exists and uses a valid directory or instance configuration.litestar-htmx for fragment-oriented update flows and progressive enhancement.litestar-responses when response container behavior, headers, cookies, or status codes are the main concern.litestar-static-files when asset mounting and static URL behavior are part of the task.litestar-security when CSRF configuration or broader web security policy is the real issue.litestar-testing for client assertions on rendered HTML, redirects, and form flows.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 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.