用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill fastapi-backend命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
正在显示 SKILL.md
基于 SOC 职业分类
| name | fastapi-backend |
| description | > Use when this capability is needed. |
Load this skill when:
backend/app/api/backend/app/services/All endpoints use async and receive the DB session via dependency injection.
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.ext.asyncio import AsyncSession
from app.database import get_db
from app.schemas import IncidentDetail
router = APIRouter()
@router.get("/{incident_id}", response_model=IncidentDetail)
async def get_incident(incident_id: str, db: AsyncSession = Depends(get_db)):
incident = await incident_service.get_incident(db, incident_id)
if not incident:
raise HTTPException(status_code=404, detail="Incident not found")
return incident
All database operations go through service functions, never directly in endpoints.
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from app.models import Incident
async def get_incident(db: AsyncSession, incident_id: str) -> Incident | None:
stmt = select(Incident).where(Incident.id == incident_id)
result = await db.execute(stmt)
return result.scalar_one_or_none()
Long-running operations (like agent triage) use FastAPI BackgroundTasks.
from fastapi import BackgroundTasks
@router.post("/", status_code=201)
async def create_incident(
data: IncidentCreate,
background_tasks: BackgroundTasks,
db: AsyncSession = Depends(get_db),
):
incident = await incident_service.create_incident(db, **data.model_dump())
background_tasks.add_task(run_triage, incident.id)
return incident
# Bad - DON'T do this
@router.get("/{id}")
def get_incident(id: str):
with Session() as db:
return db.query(Incident).get(id)
# Bad - DON'T do this
@router.post("/")
async def create(data: IncidentCreate, db: AsyncSession = Depends(get_db)):
incident = Incident(**data.model_dump())
db.add(incident)
await db.commit() # Logic should be in service layer
return incident
| Task | Pattern |
|---|---|
| Get DB session | db: AsyncSession = Depends(get_db) |
| Return 404 | raise HTTPException(status_code=404, detail="...") |
| Background task | background_tasks.add_task(fn, *args) |
| Multipart upload | file: UploadFile = File(...) |
| Query params | status: str | None = Query(None) |
| Pagination | page: int = Query(1, ge=1), per_page: int = Query(20, ge=1, le=100) |
Source: alexlombana9/SRE-Agent-Hackathon-2026 — distributed by TomeVault.