Litestar exceptions
Skill litestar-org/litestar-skills/skills/litestar-exceptions
Opinionated first-party agent skills, plugins, subagents, slash commands, and MCP servers for the Litestar framework ecosystem — publishable to Claude Code, Gemini CLI, Codex CLI, Cursor, OpenCode, and VS Code/Copilot from a single repo.
npx -y skills add litestar-org/litestar-skills --skill litestar-exceptionsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 13 stars13 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Auto-activate for exception_handlers, HTTPException, ApplicationError, NotFoundError, ValidationException, PermissionDeniedException, RFC 9457, or domain error mapping. Not for client-side errors.
SKILL.md
2.6 KB, as published. Nobody here has run it
Litestar Exceptions
Use this skill for domain exception hierarchies, handler registration, and HTTP error response shape.
Code Style Rules
- Centralize domain-to-HTTP translation in exception handlers.
- Keep route handlers free of repetitive try/except blocks.
- Use domain exception classes when services need stable error contracts.
- Keep validation errors aligned with DTO and OpenAPI behavior.
- Use
ProblemDetailsPluginexplicitly when the API contract requires RFC 9457. NativeHTTPExceptionresponses are Litestar's JSON error envelope.
Quick Reference
- Exception patterns: exceptions.md
- Pair with litestar-auth-guards for permission failures.
- Pair with litestar-data-services for not-found and conflict behavior.
Workflow
- Define a small domain exception hierarchy.
- Register handlers at app config.
- Raise domain exceptions from services or Litestar exceptions from framework boundaries.
- Test response status and payload shape.
Guardrails
- Do not catch exceptions in every handler.
- Do not leak database exception messages to API clients.
- Do not return inconsistent error payloads from neighboring routes.
- Do not replace Litestar validation behavior without a clear API reason.
- Do not describe native
HTTPExceptionresponses as Problem Details unlessProblemDetailsPluginis configured for them.
Validation Checkpoint
- Exceptions have stable status mapping.
- App-level handlers are registered.
- Services do not return sentinel error values.
- Tests cover representative failure responses.
Example
class ApplicationError(HTTPException):
status_code = 500
class ConflictError(ApplicationError):
status_code = 409
</example>
References Index
Official References
- https://docs.litestar.dev/ - Litestar documentation
- https://docs.litestar.dev/latest/reference/ - Litestar API reference
- https://github.com/litestar-org/litestar/tree/v2.24.0 - Audited Litestar 2.24.0 source