一键导入
crud-gen
Generate production-ready FastAPI CRUD endpoints with SQLModel. Creates complete Create, Read, Update, Delete operations following project patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate production-ready FastAPI CRUD endpoints with SQLModel. Creates complete Create, Read, Update, Delete operations following project patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | crud-gen |
| description | Generate production-ready FastAPI CRUD endpoints with SQLModel. Creates complete Create, Read, Update, Delete operations following project patterns. |
Auto-scaffold complete CRUD endpoints for SQLModel entities with pagination, validation, error handling, and proper session management.
/websites/fastapi_tiangolo and /websites/sqlmodel_tiangolo for latest patternsasync def with proper session handlingint | None) and AnnotatedAnalyze Target: Identify SQLModel entity to scaffold
Query Docs: Fetch Context7 patterns for FastAPI + SQLModel CRUD
Generate Schemas:
class TodoBase(SQLModel):
title: str = Field(max_length=200, index=True)
description: str | None = None
class TodoCreate(TodoBase):
pass
class TodoUpdate(SQLModel):
title: str | None = None
description: str | None = None
status: TodoStatus | None = None
class TodoPublic(TodoBase):
id: int
status: TodoStatus
created_at: datetime
Generate Endpoints:
POST /{resource}/ - Create with validationGET /{resource}/ - List with pagination (offset, limit ≤100)GET /{resource}/{id} - Get by ID with 404 handlingPATCH /{resource}/{id} - Partial update with model_dump(exclude_unset=True)DELETE /{resource}/{id} - Soft or hard deleteAdd Dependencies:
SessionDep = Annotated[Session, Depends(get_session)]
Include Error Handling:
User: "Generate CRUD for the Todo model" Action: Query Context7 → Generate TodoCreate, TodoUpdate, TodoPublic → Create 5 endpoints → Return complete code
Scaffold FastMCP tool implementations with database integration, error handling, and test session support. Generates production-ready MCP tools.
Generate comprehensive pytest integration tests for MCP tools and FastAPI endpoints. Includes fixtures, edge cases, and validation tests.
Manage Todo operations (Create, Read, Update, Delete) using SQLModel and Postgres. Use when the user wants to organize tasks.