- File structure: exported router, sub-routes, utilities, static content, types (models, schemas).
- Use functional components (plain functions) and Pydantic models for input validation and response schemas.
- Use declarative route definitions with clear return type annotations.
- Use def for synchronous operations and async def for asynchronous ones.
- Minimize @app.on_event("startup") and @app.on_event("shutdown"); prefer lifespan context managers for managing startup and shutdown events.
- Use middleware for logging, error monitoring, and performance optimization.
Fastapi Application Structure
[Applies to: **/main.py] Defines the preferred file structure and component usage for FastAPI applications.
Fastapi Application Structure by Tryboy869 · f58ce7a
npx skillmds@latest add tryboy869/fastapi-application-structure File contents
---name: fastapi-application-structuredescription: [Applies to: **/main.py] Defines the preferred file structure and component usage for FastAPI applications.---- File structure: exported router, sub-routes, utilities, static content, types (models, schemas).- Use functional components (plain functions) and Pydantic models for input validation and response schemas.- Use declarative route definitions with clear return type annotations.- Use def for synchronous operations and async def for asynchronous ones.- Minimize @app.on_event("startup") and @app.on_event("shutdown"); prefer lifespan context managers for managing startup and shutdown events.- Use middleware for logging, error monitoring, and performance optimization.
Tryboy869/senjutsu-coding-agent/tree/main/senjutsu/skills/fastapi-application-structure commit f58ce7a8a8
Frequently asked questions
Run npx skillmds@latest add tryboy869/fastapi-application-structure 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.
[Applies to: **/main.py] Defines the preferred file structure and component usage for FastAPI applications. It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. 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.
Tryboy869 (@tryboy869) published this skill. Their other Agent Skills are listed on their SkillMD profile.