plugins/litestar/skills/litestar-static-files/SKILL.md
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.
npx skillsauth add alti3/litestar-skills litestar-static-filesInstall 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.
create_static_files_router() under an explicit path and controlled directories.404 behavior, and template references before treating the mount as stable.create_static_files_router() for current Litestar static-file serving./static or /assets unless HTML mode intentionally owns /.send_as_attachment=True only when download behavior is intentional.html_mode=True only when the mounted directory should behave like a static site root.html_mode=True when /index.html and /404.html should drive static-site behavior.cache_control= when shared cache headers should apply to every static response from that router.name= when template helpers or route_reverse() must distinguish multiple static mounts.include_in_schema=False for public asset routes unless there is a real reason to document them.file_system= when assets come from a non-default or remote file system.guards, middleware, or hooks only when asset access needs policy beyond plain public serving.Read only the sections you need:
create_static_files_router() setup, directory handling, attachment mode, and route naming, read references/router-basics-and-naming.md./static or /assets.url_for or route_reverse() instead of hardcoding paths./ as the mount path without intending HTML mode or full static-site ownership.404.index.html and 404.html as intended when enabled.route_reverse() or template URL generation resolves the right path for each static router name.litestar-templating when the main task is rendering HTML that references static assets.litestar-responses when one-off file download responses or manual response headers are the real concern.litestar-file-uploads when the challenge is ingesting or validating files before publication.litestar-testing when static asset routing, headers, and 404 behavior need regression coverage.litestar-security when access to static or downloadable files must be guarded intentionally.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.