Habilidades python-fastapi
🐍

python-fastapi

Seguro

使用 FastAPI 建構生產級 Python API

También disponible en: 0xkynz

建立 Python API 需要了解 FastAPI 模式、非同步資料庫存取和適當的專案結構。本技能提供使用現代 Python 工具建構可擴展 API 的專家模式。

Soporta: Claude Codex Code(CC)
⚠️ 67 Deficiente
1

Descargar el ZIP de la skill

2

Subir en Claude

Ve a Configuración → Capacidades → Skills → Subir skill

3

Activa y empieza a usar

Pruébalo

Usando "python-fastapi". Create a FastAPI project with user authentication and items CRUD

Resultado esperado:

  • Project structure generated with src/app/features/{auth,users,items}/
  • Models: User with email, hashed_password, is_active fields
  • Schemas: UserCreate, UserResponse, UserUpdate with Pydantic validation
  • Services: UserService with create, get, list, update methods
  • Repositories: UserRepository with async database operations
  • API endpoints: GET /users, POST /users, GET /users/{id}, PATCH /users/{id}
  • Authentication router with JWT token generation
  • Database session dependency with async_sessionmaker
  • Tests: conftest.py with async client fixture

Auditoría de seguridad

Seguro
v3 • 1/10/2026

Pure documentation skill containing only markdown content with code examples. No executable code, no file system access, no network calls, no external command execution. Contains standard FastAPI development patterns and best practices.

1
Archivos escaneados
710
Líneas analizadas
0
hallazgos
3
Auditorías totales
No se encontraron problemas de seguridad

Puntuación de calidad

38
Arquitectura
100
Mantenibilidad
81
Contenido
23
Comunidad
100
Seguridad
70
Cumplimiento de la especificación

Lo que puedes crear

建構 REST API

使用非同步 Python、適當的驗證和乾淨的架構模式建立可擴展的 REST API。

為 Web 應用程式添加後端

為 Web 應用程式開發具有非同步資料庫存取的快速 Python 後端。

容器化 Python API

為容器部署建構 FastAPI 專案,並具有適當的配置管理。

Prueba estos prompts

新的 FastAPI 專案
建立具有基於功能的模組化架構的新 FastAPI 專案結構。包含使用者認證端點、SQLAlchemy 非同步模型和 Pydantic v2 驗證架構。
新增功能
在我的 FastAPI 專案中新增功能模組,包含 CRUD 端點、儲存庫模式、服務層和適當的依賴注入。
資料庫遷移
為我的 FastAPI 專案中的非同步 SQLAlchemy 設定 Alembic。包含遷移環境設定和範例遷移腳本。
撰寫測試
使用 httpx AsyncClient 和記憶體 SQLite 資料庫為我的 FastAPI 端點撰寫 pytest 非同步測試案例。

Mejores prácticas

  • 全程使用 async/await 實現非阻塞資料庫操作
  • 使用路由、服務和儲存庫層分離關注點
  • 在處理前使用 Pydantic v2 架構驗證所有輸入
  • 使用 FastAPI 依賴注入以獲得乾淨的可測試性

Evitar

  • 不要將業務邏輯直接放在 API 路由處理程式中
  • 不要在非同步 FastAPI 端點中使用同步資料庫呼叫
  • 不要將機密或憑證提交到版本控制
  • 不要為了方便而在生產環境中停用驗證

Preguntas frecuentes

需要什麼 Python 版本?
使用這些模式的 FastAPI 需要 Python 3.12 或更新版本以獲得最佳的非同步支援。
這是否支援 PostgreSQL 和 SQLite?
是的。為 PostgreSQL 生產環境使用 asyncpg,為測試使用 aiosqlite。
我可以在 Docker 容器中使用這個嗎?
專案結構與 Docker 搭配良好。請新增 Dockerfile 和 docker-compose.yml。
使用此技能時我的資料安全嗎?
是的。這是一個提供模式的說明技能。不會儲存或傳輸任何資料。
如何排除啟動錯誤?
檢查您的資料庫 URL 格式,確保資料庫正在執行,並確認所有環境變數都已設定。
這與 Flask 或 Django 有何不同?
FastAPI 提供非同步支援、自動 OpenAPI 文件和現成的 Pydantic 驗證。

Detalles del desarrollador

Estructura de archivos

📄 SKILL.md