responses
SKILL.md
Responses
Use this skill for response shaping, status code control, and custom response behavior.
Workflow
- Default to typed return values for standard JSON responses.
- Use
Response(...)when headers/cookies/media/status must be controlled explicitly. - Use response DTO/serialization controls where domain objects need transformation.
- Ensure error responses are consistent with exception handlers.
Core Patterns
Typed Return
from litestar import get
@get("/ping")
async def ping() -> dict[str, str]:
return {"message": "pong"}
Explicit Response
from litestar import Response, get
@get("/created")
async def created() -> Response[dict[str, str]]:
return Response({"result": "ok"}, status_code=201)
Response Checklist
- Use precise return types for better schema generation.
- Set explicit status codes for non-default flows.
- Keep response envelope conventions consistent across the API.
- Coordinate response contracts with exception handling.
Litestar References
Weekly Installs
2
Repository
alti3/litestar-skillsGitHub Stars
5
First Seen
12 days ago
Security Audits
Installed on
cline2
gemini-cli2
github-copilot2
codex2
kimi-cli2
cursor2