agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when building APIs with FastAPI. Covers dependency injection, Pydantic v2 validation, async database access, authentication, background tasks, and testing. Trigger on "fastapi endpoint is slow under load", "set up depends for the db session", "pydantic v2 validation error",
Claude Code
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill fastapi --agent claude-code
Codex
$ npx skills add nimadorostkar/Claude-Skills-collection --skill fastapi -a codex -y
Cursor
$ npx skills add nimadorostkar/Claude-Skills-collection --skill fastapi -a cursor -y
Gemini CLI
$ npx skills add nimadorostkar/Claude-Skills-collection --skill fastapi -a gemini-cli -y
GitHub Copilot
$ npx skills add nimadorostkar/Claude-Skills-collection --skill fastapi -a github-copilot -y
OpenCode
$ npx skills add nimadorostkar/Claude-Skills-collection --skill fastapi -a opencode -y
Windsurf
$ npx skills add nimadorostkar/Claude-Skills-collection --skill fastapi -a windsurf -y
name: fastapi description: Use when building APIs with FastAPI. Covers dependency injection, Pydantic v2 validation, async database access, authentication, background tasks, and testing. Trigger on "fastapi endpoint is slow under load", "set up depends for the db session", "pydantic v2 validation error", "test my fastapi app". Do not use for API contract decisions like pagination or versioning — see the api-design skill. metadata: category: backend version: 1.0.0 tags: [fastapi, python, pydantic, async, api]
Build FastAPI services that use the framework's strengths — declarative validation and dependency injection — without falling into its two standard traps: blocking calls inside `async def`, and business logic in the route handler.
1. **Define the schemas** — Separate request, response, and internal models. Never return an ORM object directly; a `response_model` is your defense against leaking a password hash. 2. **Build the dependencies** — Database session, current user, feature flags. These are the injection points that make the app testable. 3. **Keep handlers thin** — Parse, authorize, delegate, return. Business logic lives in a service module that knows nothing about HTTP. 4. **Get async right** — In an `async def` handler, every I/O call must be awaited. A blocking call there stalls the entire event loop, not just that request. 5. **Test through the app** — `httpx.AsyncClient` with `app.dependency_overrides` gives you real routing, real validation, and a fake database.
**Dependency-injected handler and an overridable test:**
from typing import Annotated
from fastapi import APIRouter, Depends, HTTPException, status
router = APIRouter(prefix="/orders", tags=["orders"])
SessionDep = Annotated[AsyncSession, Depends(get_session)]
CurrentUser = Annotated[User, Depends(get_current_user)]
@router.post("", response_model=OrderRead, status_code=status.HTTP_201_CREATED)
async def create_order(
payload: OrderCreate,
session: SessionDep,
user: CurrentUser,
) -> Order:
try:
return await orders.place(session, customer_id=user.id, items=payload.items)
except InsufficientInventory as e:
raise HTTPException(status.HTTP_409_CONFLICT, detail=str(e)) from e@pytest.fixture
async def client(session: AsyncSession) -> AsyncIterator[AsyncClient]:
app.dependency_overrides[get_session] = lambda: session
app.dependency_overrides[get_current_user] = lambda: User(id="usr_test")
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://test") as c:
yield c
app.dependency_overrides.clear()A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory,…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling,…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.