Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/chandrudp29/skillhub/fastapi-patternsnpx skills add chandrudp29/skillhub --skill fastapi-patternsgit clone --depth 1 https://github.com/chandrudp29/skillhubWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00036 | $0.01447 |
| Opus 5 | $0.00018 | $0.00724 |
| Sonnet 5 | $0.00007 | $0.00289 |
| Haiku 4.5 | $0.00004 | $0.00145 |
Grade A, and why
fastapi-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 212 lines — stays where its author put it; the contents beside it link to each section on GitHub.
FastAPI Patterns
Production FastAPI patterns. Covers the 20% of FastAPI that handles 80% of real use cases.
When to Use
- Building a new FastAPI service
- Reviewing FastAPI code for quality or performance issues
- Adding auth, background tasks, or streaming to an existing service
- Debugging FastAPI errors you don't understand
Project Structure
app/
├── main.py # create_app(), lifespan
├── config.py # Settings (pydantic-settings)
├── dependencies.py # Shared dependencies (DB, auth)
├── routers/
│ ├── jobs.py
│ └── users.py
└── models/
├── requests.py # Pydantic request models
└── responses.py # Pydantic response models
App Setup with Lifespan
# main.py
from contextlib import asynccontextmanager
from fastapi import FastAPI
@asynccontextmanager
async def lifespan(app: FastAPI):
# Startup: init DB pools, load models, etc.
app.state.db = await create_db_pool()
app.state.model = load_ml_model()
yield
# Shutdown: cleanup
await app.state.db.close()
app = FastAPI(title="My API", lifespan=lifespan)
app.include_router(jobs.router, prefix="/jobs", tags=["jobs"])
app.include_router(users.router, prefix="/users", tags=["users"])
Dependency Injection
FastAPI's Depends is the right way to share DB connections, auth, and config:
# dependencies.py
from fastapi import Depends, HTTPException, status
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
security = HTTPBearer()
async def get_db(request: Request) -> AsyncGenerator:
async with request.app.state.db.acquire() as conn:
yield conn # connection returned to pool after request
async def get_current_user(
credentials: HTTPAuthorizationCredentials = Depends(security),
db = Depends(get_db),
) -> User:
token = credentials.credentials
user = await verify_token(token, db)
if not user:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Invalid or expired token",
headers={"WWW-Authenticate": "Bearer"},
)
return user
# routers/jobs.py — inject where needed
@router.get("/", response_model=list[JobResponse])
async def list_jobs(
current_user: User = Depends(get_current_user),
db = Depends(get_db),
limit: int = Query(default=20, ge=1, le=100),
):
return await db.fetch_jobs(user_id=current_user.id, limit=limit)
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 212 lines · 36 tokens per session scan A 459d3dd2c3a1
fastapi-patterns is a skill published in the GitHub repository chandrudp29/skillhub (13 stars, last pushed 2mo ago), licensed MIT. It adds 36 tokens to every session and 1,447 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
fastapi-expert
Expert-level FastAPI development for high-performance Python APIs with async support.
fastapi
FastAPI best practices + Pydantic. Use when building or reviewing FastAPI APIs.
fastapi-docs
FastAPI 0.115+ — path/query params, Pydantic, dependency injection, OAuth2/JWT, middleware, WebSocket, testing.
fastapi-endpoint
Plan and build production-ready FastAPI endpoints with async SQLAlchemy, Pydantic v2 models, dependency injection for auth, and pytest tests. Uses interview-driven planning to clarify data models, authentication method, pagination strategy, and caching before writing any code.
fastcrud
Use when building or modifying CRUD endpoints with FastCRUD (the fastcrud PyPI package) in a FastAPI project — covers FastCRUD, crudrouter, EndpointCreator, FilterConfig, JoinConfig, auto-relationship detection, the filter operator syntax (gte, in, ilike, etc.), cursor pagination, soft delete, and how to avoid N+1…
api
FastAPI + async/sync HTTP client patterns, JWT auth, multi-provider routing, Pydantic request/response models, CORS, background tasks, and typed frontend API clients — synthesized from lead-gen-engine and seo-geo-aeo-engine.