← Back to list

crud-gen
by jawwad-ali
⭐ 1🍴 0📅 Jan 13, 2026
SKILL.md
name: crud-gen description: Generate production-ready FastAPI CRUD endpoints with SQLModel. Creates complete Create, Read, Update, Delete operations following project patterns.
FastAPI CRUD Generator
Purpose
Auto-scaffold complete CRUD endpoints for SQLModel entities with pagination, validation, error handling, and proper session management.
Core Rules
- Context7 First: Query
/websites/fastapi_tiangoloand/websites/sqlmodel_tiangolofor latest patterns - uv Only: Never suggest pip commands
- Async Pattern: All operations use
async defwith proper session handling - Type Safety: Use Python 3.10+ union types (
int | None) andAnnotated - Response Models: Separate Create, Update, Public schemas
Workflow
-
Analyze 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 withmodel_dump(exclude_unset=True)DELETE /{resource}/{id}- Soft or hard delete
-
Add Dependencies:
SessionDep = Annotated[Session, Depends(get_session)] -
Include Error Handling:
- 404 for not found
- 422 for validation errors
- Proper session commit/rollback
Output Format
- Complete router file with all 5 CRUD operations
- Includes imports, schemas, and endpoints
- Ready to integrate into existing FastAPI app
Example Usage
User: "Generate CRUD for the Todo model" Action: Query Context7 → Generate TodoCreate, TodoUpdate, TodoPublic → Create 5 endpoints → Return complete code
Quality Checks
- ✓ All endpoints use SessionDep
- ✓ Pagination on list (default limit=100, max=100)
- ✓ HTTPException for 404 errors
- ✓ model_validate() for create
- ✓ model_dump(exclude_unset=True) for update
- ✓ session.refresh() after mutations
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon