/py-pit:background-jobs-boundariesfrom py-pit
Provides guardrails for using FastAPI BackgroundTasks appropriately, distinguishing best-effort follow-ups from durable job infrastructure.
Ships in py-pit. 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.
In-process background tasks are best-effort follow-ups, not job infrastructure.
Use them only for small, fast, non-critical work after a request completes.
These require a real job system.
Request, DB sessions, ORM objects, or DI state.asyncio.create_task() inside handlers.Small follow-up work such as:
Tasks must be fast, idempotent, and failure-tolerant.
Background tasks should accept identifiers or simple payloads only and load resources inside the task itself.
Example pattern:
from fastapi import BackgroundTasks
@app.post("/users/{user_id}/welcome")
async def send_welcome(user_id: int, background_tasks: BackgroundTasks):
background_tasks.add_task(send_welcome_email, user_id)
return {"status": "scheduled"}
async def send_welcome_email(user_id: int):
async with AsyncSessionLocal() as session:
user = await session.get(User, user_id)
if not user:
return
await email_service.send_welcome(user.email)
Background task functions must be async def when using async sessions. FastAPI runs async background tasks in the event loop, so this works without threads. For CPU-heavy or truly blocking work, use a real job queue instead.
Key properties:
Background tasks are best-effort helpers.
If the work must be reliable or durable, use a real queue or job system.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
16 skills in this plugin
/alembic-migrationsProduction-safe Alembic migration workflows for SQLAlchemy 2.x projects. Use this skill when adding Alembic, generating migrations, reviewing autogenerate diffs, fixing broken migrations, or establishing a safe schema evolution workflow in a Python backend./click-cliDesign, generate, and improve Python CLIs using the Click library. Focus on idiomatic architecture, command groups, modular layouts, CLI UX conventions, and avoiding common Click anti-patterns./click-cli-linterAudit and improve existing Python Click CLIs by identifying architecture problems, anti-patterns, and CLI UX issues, then proposing minimal, high-value fixes.Generated from the plugin's indexed repository (robhowley/py-pit-skills) — no native marketplace selected
npx claudepluginhub p/robhowley-py-pitOther plugins' skills for the same job