From patriotforge
Use when writing Python backend code — FastAPI routers, SQLAlchemy models, Pydantic schemas, service functions, dependency injection, or app configuration.
How this skill is triggered — by the user, by Claude, or both
Slash command
/patriotforge:backendThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Stack:** FastAPI · Python 3.12 · SQLAlchemy 2.x (async) · Pydantic v2 · Redis 7 · PostgreSQL 15
Stack: FastAPI · Python 3.12 · SQLAlchemy 2.x (async) · Pydantic v2 · Redis 7 · PostgreSQL 15
backend/
├── app/
│ ├── main.py # create_app() factory + lifespan
│ ├── config.py # Settings(BaseSettings) — env-driven
│ ├── routers/ # one file per module (auth.py, quotes.py, …)
│ ├── services/ # pure business logic — no HTTP objects
│ ├── schemas/ # Pydantic request/response models
│ ├── models/ # SQLAlchemy ORM models
│ └── deps.py # dependency injection functions
├── tests/ # pytest-asyncio tests
├── alembic/ # database migrations
└── pyproject.toml
router = APIRouter(prefix="/api/auth", tags=["auth"])
@router.post("/login", response_model=LoginResponse, status_code=200)
async def login(
data: LoginRequest,
db: AsyncSession = Depends(get_db_session),
redis: Redis = Depends(get_redis),
request: Request, response: Response,
): ...
response_model, status_code, explicit Depends()DuplicateEmail, InvalidCredentials), not HTTPExceptionmodel_config = ConfigDict(extra='forbid') — reject unknown fieldsmodel_config = ConfigDict(from_attributes=True) — ORM compatibilitySecretStr for passwordsMapped[] type annotations + mapped_column()forge_ prefix (e.g., forge_users)mapped_column(UUID, primary_key=True, default=uuid4)created_at, updated_at, deleted_atget_db_session(): yields AsyncSession from app.state.async_session_factoryget_redis(): returns app.state.rediscreate_app(settings) builds the app — test-friendly, no module-level singletonssed/awk for file editing📖 Reference files: backend/app/routers/auth.py, backend/app/services/auth.py, backend/app/schemas/auth.py
npx claudepluginhub aka-kolton/patriotforge-claude-plugin --plugin patriotforgeProvides Python backend patterns for layered architecture, async I/O, dependency injection, and separation of HTTP, business logic, and data access layers. Examples use FastAPI, SQLAlchemy, and Pydantic.
Provides FastAPI best practices for project structure, Pydantic v2 schemas, dependency injection, async handlers, auth, transactional service layers, and testing with httpx and pytest.
Guides building production-ready Python backends with FastAPI, async patterns, SQLAlchemy, Pydantic validation, authentication, and error handling.