by sickn33
Building REST APIs requires consistent router patterns with authentication and proper responses. This skill generates production-ready FastAPI routers following established conventions.
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 fastapi-router-py 技能" 开始使用
=== fastapi-router-py 技能 === 作者: sickn33 描述: Building REST APIs requires consistent router patterns with authentication and proper responses. This skill generates production-ready FastAPI routers following established conventions. 使用方法: 1. 调用技能: "使用 fastapi-router-py 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 fastapi-router-py 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
coding
safe
Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.
Copy the template from assets/template.py and replace placeholders:
{{ResourceName}} → PascalCase name (e.g., Project){{resource_name}} → snake_case name (e.g., project){{resource_plural}} → plural form (e.g., projects)# Optional auth - returns None if not authenticated
current_user: Optional[User] = Depends(get_current_user)
# Required auth - raises 401 if not authenticated
current_user: User = Depends(get_current_user_required)
@router.get("/items/{item_id}", response_model=Item)
async def get_item(item_id: str) -> Item:
...
@router.get("/items", response_model=list[Item])
async def list_items() -> list[Item]:
...
@router.post("/items", status_code=status.HTTP_201_CREATED)
@router.delete("/items/{id}", status_code=status.HTTP_204_NO_CONTENT)
src/backend/app/routers/src/backend/app/main.pyView Count
0
Download Count
0
Favorite Count
0
Quality Score
73