advanced-alchemy
Use when working with advanced_alchemy, alembic/, SQLAlchemyAsyncRepositoryService, SQLAlchemyAsyncConfig, repository_type,…
Use when working with litestar_security, SecurityPlugin, SecurityConfig, SecureController, CurrentUser, Principal, SecurityContext, or requires_role/scope/tenant/capability/assurance. Not for basic Litestar Guards.
Claude Code
$ npx -y skills add litestar-org/litestar-skills --skill litestar-security --agent claude-code
Codex
$ npx skills add litestar-org/litestar-skills --skill litestar-security -a codex -y
Cursor
$ npx skills add litestar-org/litestar-skills --skill litestar-security -a cursor -y
Gemini CLI
$ npx skills add litestar-org/litestar-skills --skill litestar-security -a gemini-cli -y
GitHub Copilot
$ npx skills add litestar-org/litestar-skills --skill litestar-security -a github-copilot -y
OpenCode
$ npx skills add litestar-org/litestar-skills --skill litestar-security -a opencode -y
Windsurf
$ npx skills add litestar-org/litestar-skills --skill litestar-security -a windsurf -y
name: litestar-security description: "Use when working with litestar_security, SecurityPlugin, SecurityConfig, SecureController, CurrentUser, Principal, SecurityContext, or requires_role/scope/tenant/capability/assurance. Not for basic Litestar Guards."
`litestar-security` is a declarative authentication and authorization framework for Litestar. It provides credential slots and mechanisms, unified session management, local accounts, MFA, WebAuthn passkeys, OAuth/OIDC, API keys, workload JWTs, and browser hardening.
Two separate axes, wired through two separate Litestar keywords:
Do not conflate them: the policy helpers (`public`, `required`, `any_of`, `all_of`, `at_least`, `optional`, `exclude`, `mechanism`) take **mechanism names**, while the guard combinators (`requires_any_of`, `requires_all_of`, `requires_at_least`, `requires_one_of`) take **predicates**.
from litestar import Litestar, get
from litestar.di import NamedDependency
from litestar_security import (
SecurityConfig,
SecurityContext,
SecurityPlugin,
public,
)
@get("/", auth=public(), sync_to_thread=False)
def index(security_context: NamedDependency[SecurityContext]) -> dict[str, bool]:
return {"authenticated": bool(security_context.evidence)}
app = Litestar(
route_handlers=[index],
plugins=[SecurityPlugin(SecurityConfig())],
)With mechanisms configured and no inherited policy, routes default to implicit `required()`. With no mechanisms at all they are public.
from typing import ClassVar
from litestar import get
from litestar_security import (
AuthenticationPolicy,
PublicController,
SecureController,
all_of,
any_of,
at_least,
public,
required,
)
policy_default = required()
policy_session = required("session")
policy_either = any_of("session", "api-key")
policy_both = all_of("api-key", "service-jwt")
policy_threshold = at_least(2, "session", "api-key", "service-jwt")
policy_public = public()Apply policy on controllers via `SecureController` / `PublicController` and on routes via `auth=`:
class HealthController(PublicController):
path = "/health"
@get("/")
async def check(self) -> dict[str, str]:
return {"status": "ok"}
class AccountController(SecureController):
path = "/accounts"
auth: ClassVar[AuthenticationPolicy] = required("session")Use `opt={"auth": ...}` only on `Router`, `Litestar`, or third-party controllers that cannot subclass `SecureController`.
from typing import ClassVar
from litestar import get
from litestar_security import (
AuthenticationPolicy,
SecureController,
required,
requires_any_of,
requires_role,
requires_scope,
)
class ReportsController(SecureController):
path = "/reports"
auth: ClassVar[AuthenticationPolicy] = required("session")
guards = [requires_role("analyst")]
@get("/", guards=[requires_any_of(requires_scope("read:all"), requires_scope("read:reports"))])
async def list_reports(self) -> list[dict[str, str]]:
return []Opinionated, first-party agent skills, plugins, subagents, hooks, and rules for the Litestar framework and its ecosystem — published from a single-root repository across Google Antigravity, Claude Code, Codex CLI, Cursor, OpenCode, and VS Code / Copilot.
Use when working with advanced_alchemy, alembic/, SQLAlchemyAsyncRepositoryService, SQLAlchemyAsyncConfig, repository_type,…
Use when working with litestar_autowire, AutowirePlugin, AutowireConfig, domain_packages, AutowireIntegration, AutowireLoader, or…
Use when working with uv build, hatch build, PyApp, PYAPP_*, wheel assets, GitHub release matrices, cargo-zigbuild, or…
Use when working with Dockerfile, compose, Railway, Cloud Run, GKE, systemd, Kubernetes, Terraform, deploy scripts, or…
Use when working with zensical.toml, docs/conf.py, sphinx, shibuya, litestar-sphinx-theme, mkdocstrings, Griffe, objects.inv, or…
Use when working with litestar_email, EmailPlugin, EmailConfig, EmailService, EmailMessage, SMTPConfig, ResendConfig,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.