litestar-app-setup

Installation
SKILL.md

App Setup

Use this skill when defining or refactoring the application root object and its global behavior.

Execution Workflow

  1. Define an importable application entrypoint (app.py, application.py, main.py, or factory) for runtime and CLI discovery.
  2. Construct Litestar(...) with explicit route_handlers=[...] (controllers, routers, or handlers); this list is required.
  3. Configure app-level concerns intentionally (dependencies, middleware, exception handlers, DTO defaults, request/response classes).
  4. Choose lifecycle model:
  5. Use on_startup / on_shutdown for straightforward init/teardown hooks.
  6. Use lifespan=[...] async context managers for resource lifecycles that require context ownership.
  7. Add application hooks (after_exception, before_send, on_app_init) only for cross-cutting concerns.
  8. Use application state sparingly, initialize it explicitly, and inject it intentionally where needed.
  9. Validate layered overrides to ensure the closest layer to the handler wins as expected.

Implementation Rules

  • Keep the app module focused on composition, not business logic.
Related skills

More from alti3/litestar-skills

Installs
15
GitHub Stars
5
First Seen
Mar 2, 2026