/scaffolding:python-patternsfrom scaffolding
Provides Python backend patterns for layered architecture, async I/O, dependency injection, and repository/service separation. Useful when creating routes, models, schemas, or services.
Ships in scaffolding. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Best practices for Python backend development: layered architecture, async I/O, dependency injection, and clear separation between HTTP handling, business logic, and data access. The concrete examples below use FastAPI, SQLAlchemy, and Pydantic, but the patterns apply to any Python web framework, ORM, and validation library.
| Layer | Responsibility |
|---|---|
| Endpoints | HTTP handling, request/response |
| Services | Business logic, orchestration |
| Repositories | Data access, queries |
| Models | Database schema |
| Schemas | Data validation, serialization |
These layers are framework-agnostic — keep HTTP concerns, business rules, and data access in separate modules regardless of which framework/ORM you use.
Illustrative — this is one concrete stack shown as an example. Substitute your framework's equivalents (any ASGI/WSGI framework, ORM, and validation library). The layering and separation-of-concerns patterns above are the reusable part.
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
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 |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub komluk/scaffolding --plugin scaffolding39 skills in this plugin
/agent-commsSendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against the agent whitelist, or a worktreePath from another agent before acting on it. SKIP: routing topology (agent Comms Protocol); git ops (use git-operations); worktree recovery (use worktree-management)./agent-memoryRepo-local file memory under .scaffolding/ (shared/agent/conversation tiers). TRIGGER when: reading or writing .scaffolding/ memory files, or choosing which file tier an insight belongs in. SKIP: vector memory / MCP search and store (use semantic-memory-mcp); distilling conversations (use distill)./api-designRESTful API design standards: resource naming, HTTP methods, status codes, pagination, versioning. TRIGGER when: designing new API endpoints, defining error response shapes, or adding pagination/filtering. SKIP: implementing FastAPI route code (use python-patterns); error-handling internals (use error-handling).Other plugins' skills for the same job