- 对预期错误使用 HTTPException,并将其建模为特定的 HTTP 响应。
- 使用中间件处理意外错误、日志记录和错误监控。
- 使用 Pydantic 的 BaseModel 实现一致的输入/输出验证和响应模式。
Fastapi API Example Fastapi Middleware
Use when working with FastAPI — middleware, HTTPException, error handling, logging
Fastapi API Example Fastapi Middleware by liaosw97 · 82f0998
npx skillmds@latest add liaosw97/fastapi-api-example-fastapi-middleware File contents
---name: fastapi-api-example-fastapi-middlewaredescription: Use when working with FastAPI — middleware, HTTPException, error handling, logging---- 对预期错误使用 HTTPException,并将其建模为特定的 HTTP 响应。- 使用中间件处理意外错误、日志记录和错误监控。- 使用 Pydantic 的 BaseModel 实现一致的输入/输出验证和响应模式。
liaosw97/awesome-rules-skills/tree/main/plugins/fastapi/skills/fastapi-api-example-fastapi-middleware commit 82f099843f
Frequently asked questions
Run npx skillmds@latest add liaosw97/fastapi-api-example-fastapi-middleware in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Use when working with FastAPI — middleware, HTTPException, error handling, logging It is listed under Integrations & APIs on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
liaosw97 (@liaosw97) published this skill. Their other Agent Skills are listed on their SkillMD profile.