litestar-static-files

Installation
SKILL.md

Static Files

Execution Workflow

  1. Decide whether the app needs normal asset serving, downloadable files, or static HTML mode.
  2. Mount assets with create_static_files_router() under an explicit path and controlled directories.
  3. Set delivery behavior intentionally: inline vs attachment, HTML mode, name, schema visibility, and router metadata.
  4. Choose cache behavior that matches asset mutability and deployment strategy.
  5. Lock down file system boundaries, especially symlink behavior and any remote/custom file system integration.
  6. Verify URL reversal, 404 behavior, and template references before treating the mount as stable.

Core Rules

  • Prefer create_static_files_router() for current Litestar static-file serving.
  • Keep static directories separate from writable upload or user-content directories.
  • Use explicit URL prefixes such as /static or /assets unless HTML mode intentionally owns /.
  • Treat directories as relative to the working directory unless you pass explicit absolute paths.
  • Use send_as_attachment=True only when download behavior is intentional.
  • Use html_mode=True only when the mounted directory should behave like a static site root.
Related skills

More from alti3/litestar-skills

Installs
15
GitHub Stars
5
First Seen
Mar 2, 2026