ask-fastapi-architect

📁 navanithans/agent-skill-kit 📅 10 days ago
2
总安装量
2
周安装量
#66720
全站排名
安装命令
npx skills add https://github.com/navanithans/agent-skill-kit --skill ask-fastapi-architect

Agent 安装分布

gemini-cli 2
qoder 2
replit 2
antigravity 2
codebuddy 2
qwen-code 2

Skill 文档

<critical_constraints> ❌ NO global DB sessions → use Depends(get_db) ❌ NO manually instantiating services in routes → use Depends ❌ NO routes without response_model → prevents data leaks ✅ MUST use Pydantic V2 (model_config, ConfigDict) ✅ MUST use AsyncSession with select() ✅ MUST use alembic for migrations </critical_constraints>

<pydantic_v2>

from pydantic import BaseModel, ConfigDict, Field

class UserCreate(BaseModel):
    model_config = ConfigDict(from_attributes=True)
    username: str = Field(..., min_length=3)
    email: str

</pydantic_v2>

<dependency_injection>

@router.post("/", response_model=ShowUser)
async def create_user(
    user_in: UserCreate,
    db: AsyncSession = Depends(get_db),
    current_user: User = Depends(get_current_active_user)
):
    return await UserService.create(db, user_in)

</dependency_injection>

<async_db>

result = await db.execute(select(User).where(User.id == user_id))
user = result.scalars().first()

</async_db>