plugins/litestar/skills/litestar-caching/SKILL.md
Configure Litestar response caching with route-level `cache` controls, app-level `ResponseCacheConfig`, store selection, TTL strategy, cache key design, and `cache_response_filter` rules. Use when optimizing read-heavy or polling-heavy Litestar endpoints without breaking correctness for tenant-, locale-, or auth-scoped responses. Do not use for write-heavy or immediately consistent workflows unless cache invalidation or versioning is designed explicitly.
npx skillsauth add alti3/litestar-skills litestar-cachingInstall 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.
cache=True, an explicit TTL in seconds, or CACHE_FOREVER.ResponseCacheConfig for default_expiration, store selection, and global key/filter behavior.cache=True as "use ResponseCacheConfig.default_expiration", not as "cache forever."CACHE_FOREVER only for truly immutable or explicitly versioned resources.cache_response_filter to control which responses are written to cache after the status code is known.cache=True when the app-wide default TTL is correct for the route.cache=<seconds> when a route needs a specific freshness window.CACHE_FOREVER when the payload is immutable, content-addressed, or versioned externally.ResponseCacheConfig for baseline TTL, default key builder, named store selection, and response-write filtering.cache_key_builder= when one handler needs extra key dimensions without changing the whole app.Read only the sections you need:
cache modes, ResponseCacheConfig, default expiration, and store wiring, read references/route-and-config-patterns.md.cache_response_filter examples and test patterns that prove cache correctness, read references/filter-and-testing-patterns.md.cache=True plus an explicit app-level default_expiration.MemoryStore only for single-process or low-stakes cases.GET responses by default; be conservative with anything else.cache=True without noticing that default_expiration=None makes the entry indefinite.CACHE_FOREVER for mutable business data without explicit invalidation or versioning.cache_response_filter as a substitute for good key design.cache_response_filter allows and rejects the expected status codes and methods.litestar-stores for backend store lifecycle, namespacing, and TTL policy beyond response caching.litestar-testing to lock down cache hits, misses, and stale-data boundaries.litestar-security or litestar-authentication when response visibility depends on user identity or permissions.litestar-responses when response metadata or specialized response containers affect what is safe to cache.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.