From scaffolding
Python backend patterns with FastAPI, async SQLAlchemy, and Pydantic. Use when creating routes, models, schemas, or services.
npx claudepluginhub komluk/scaffolding --plugin scaffoldingThis skill uses the workspace's default tool permissions.
Best practices for Python backend development with FastAPI, SQLAlchemy, and async programming.
Integrates Mem0 persistent memory for Claude Code tasks using MCP tools. Retrieves relevant memories on new tasks, stores learnings like decisions and strategies, captures session states.
Creates web-based slidedecks for developers using Slidev with Markdown, Vue components, code highlighting, animations, interactive demos, and presenter notes. Use for technical presentations, conference talks, code walkthroughs, and workshops.
Best practices for Python backend development with FastAPI, SQLAlchemy, and async programming.
app/
└── backend/
├── app/
│ ├── main.py # FastAPI app initialization
│ ├── config.py # Settings (pydantic-settings)
│ ├── api/v1/endpoints/ # Route handlers
│ ├── core/ # Security, exceptions
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ ├── repositories/ # Data access
│ └── db/session.py # Database session
├── tests/
├── alembic.ini
└── requirements.txt
| Layer | Responsibility |
|---|---|
| Endpoints | HTTP handling, request/response |
| Services | Business logic, orchestration |
| Repositories | Data access, queries |
| Models | Database schema |
| Schemas | Data validation, serialization |
async_sessionmaker for async sessionsexpire_on_commit=False for response dataselect() statements (SQLAlchemy 2.0 style)scalar_one_or_none() for single itemsscalars().all() for listsselectin or joinedload| Type | Purpose | Example |
|---|---|---|
| Base | Shared fields | UserBase(email, username) |
| Create | POST request | UserCreate(Base + password) |
| Update | PATCH request | UserUpdate(all optional) |
| Response | API response | UserResponse(Base + id, created_at) |
| InDB | Internal with secrets | UserInDB(Response + hashed_password) |
model_config = ConfigDict(from_attributes=True) for ORMField() for validation constraintsfield_validator for custom validationget_by_id(id) - Single item by primary keyget_all(skip, limit) - Paginated listcreate(**kwargs) - Insert new recordupdate(id, **kwargs) - Update existingdelete(id) - Remove recordget_by_email(), get_active_users()get_db - Database sessionget_current_user - Authenticated userget_current_superuser - Admin userget_user_service(session)# Endpoint receives dependencies, passes to service
async def create_user(
data: UserCreate,
session: AsyncSession = Depends(get_db)
):
service = UserService(session)
return await service.create(data)
pydantic-settings for env loading@lru_cache for singleton@property for computed valuesDATABASE_URL - Database connectionSECRET_KEY - JWT signingDEBUG - Development modeCORS_ORIGINS - Allowed originsdb_session - In-memory SQLite sessionclient - AsyncClient with appget_db dependency for testspytest.mark.asyncio for async tests| Tool | Purpose |
|---|---|
| black | Code formatting |
| ruff | Linting |
| mypy | Type checking |
| pytest | Testing |
| pytest-cov | Coverage |