litestar-settings
OfficialStreamline secure, typed settings for Litestar apps.
System Documentation
What problem does it solve?
Litestar developers often face inconsistent, untyped, or insecure environment configuration, repeated environment variable parsing in request handlers that hurts performance, and un-cached settings that break test overrides and introduce race conditions in concurrent environments.
Core Features & Use Cases
- Dual Canonical Patterns: Provides two production-ready, Litestar-endorsed settings patterns: a zero-dependency
@dataclass+get_env+@lru_cacheworkflow for fresh projects, and apydantic_settings.BaseSettingsworkflow for projects already using Pydantic. - Guardrails & Validation: Includes explicit guardrails to avoid common anti-patterns like logging secrets, parsing env vars in handlers, or mixing configuration patterns, plus a validation checklist to ensure settings are typed, cached, and test-friendly.
- Lazy Initialization Support: Guides implementation of lazy materialization for heavy app dependencies (database pools, Redis clients, plugin graphs) to avoid import-time connection errors during Docker builds and test runs.
- Use Case: When building a new Litestar API with a PostgreSQL database and Redis cache, use this skill to implement a cached, typed settings class that loads all configuration from environment variables, avoids repeated parsing, and supports clean test overrides without mutating global process state.
Quick Start
Use the litestar-settings skill to implement a cached, typed settings class for your Litestar app that loads all configuration from environment variables, avoids repeated env parsing in request handlers, and supports clean test overrides.
Dependency Matrix
Required Modules
None requiredComponents
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: litestar-settings Download link: https://github.com/litestar-org/litestar-skills/archive/main.zip#litestar-settings Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.