[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-0872f372-1ba6-415e-94dc-10909cd35f4d":3,"$fVYvqZo032TGodsVZnz9Rt1vbKE0VIac3SkeMxnDMdEE":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"0872f372-1ba6-415e-94dc-10909cd35f4d","fastapi-router-py","创建遵循既定模式、具备适当认证、响应模型和HTTP状态码的FastAPI路由器。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: fastapi-router-py\ndescription: \"Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# FastAPI Router\n\nCreate FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.\n\n## Quick Start\n\nCopy the template from assets\u002Ftemplate.py and replace placeholders:\n- `{{ResourceName}}` → PascalCase name (e.g., `Project`)\n- `{{resource_name}}` → snake_case name (e.g., `project`)\n- `{{resource_plural}}` → plural form (e.g., `projects`)\n\n## Authentication Patterns\n\n```python\n# Optional auth - returns None if not authenticated\ncurrent_user: Optional[User] = Depends(get_current_user)\n\n# Required auth - raises 401 if not authenticated\ncurrent_user: User = Depends(get_current_user_required)\n```\n\n## Response Models\n\n```python\n@router.get(\"\u002Fitems\u002F{item_id}\", response_model=Item)\nasync def get_item(item_id: str) -> Item:\n    ...\n\n@router.get(\"\u002Fitems\", response_model=list[Item])\nasync def list_items() -> list[Item]:\n    ...\n```\n\n## HTTP Status Codes\n\n```python\n@router.post(\"\u002Fitems\", status_code=status.HTTP_201_CREATED)\n@router.delete(\"\u002Fitems\u002F{id}\", status_code=status.HTTP_204_NO_CONTENT)\n```\n\n## Integration Steps\n\n1. Create router in `src\u002Fbackend\u002Fapp\u002Frouters\u002F`\n2. Mount in `src\u002Fbackend\u002Fapp\u002Fmain.py`\n3. Create corresponding Pydantic models\n4. Create service layer if needed\n5. Add frontend API functions\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,113,1832,"2026-05-16 13:17:42",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"90adc839-194a-49fb-b62b-0a4b93bf62ed","1.0.0","fastapi-router-py.zip",1042,"uploads\u002Fskills\u002F0872f372-1ba6-415e-94dc-10909cd35f4d\u002Ffastapi-router-py.zip","0a685f4cfa4f44287b63c991ed10ba5797a765b80e79d11b25d8a5e915509b83","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":1924}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]