agentsclimarketplace

Fastapi expert

Skill corticalstack/engineering/.claude/skills/fastapi-expert

Use when building FastAPI applications, async Python REST APIs, Pydantic V2 schemas, SQLAlchemy async database operations, JWT/OAuth2 authentication, async pytest testing, RFC 9457 error handling, cursor pagination, or API versioning strategies.From its SKILL.md

Install
npx -y skills add corticalstack/engineering --skill fastapi-expert

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.5 KB, as published. Nobody here has run it

FastAPI Expert Skill Profile

Specialized backend implementation guide for production-grade async Python APIs using FastAPI 0.115+, Pydantic V2, SQLAlchemy 2.0 async, and Python 3.12+.

Critical Requirements (MUST DO)

  • Type hints throughout — FastAPI and Pydantic depend on them
  • Pydantic V2 syntax exclusively (model_config, field_validator, ConfigDict)
  • Annotated[T, Depends()] type alias pattern for all dependencies
  • lifespan context manager — never @app.on_event (deprecated, has a double-fire bug)
  • async def for all I/O routes; def for CPU-bound routes (FastAPI runs those in a threadpool)
  • PyJWT for JWT — never python-jose (CVE-2024-33663, abandoned since 2022)
  • uv for dependency management, ruff for linting
  • RFC 9457 Problem Details (application/problem+json) for all error responses — see references/error-responses.md
  • Cursor-based pagination by default for all collection endpoints — see references/pagination.md
  • URI prefix versioning from day one (/v1/) — never ship unversioned public endpoints
  • Idempotency-Key header support for non-idempotent POST/PATCH operations
  • Retry-After on all 429 and 503 responses

Anti-Pattern Quick Reference

❌ Avoid✅ Use Instead
@app.on_event("startup/shutdown")lifespan context manager
python-jose / jose importPyJWT (import jwt)
ORJSONResponse / UJSONResponseDefault Pydantic/Rust serializer (FastAPI 0.130+)
Column() in SQLAlchemy modelsmapped_column() with Mapped[]
orm_mode = True / class Configmodel_config = ConfigDict(from_attributes=True)
.dict() / .json().model_dump() / .model_dump_json()
@pytest.mark.asyncio on every testasyncio_mode = "auto" in pyproject.toml
TestClient in async testshttpx.AsyncClient with ASGITransport
allow_origins=["*"] + allow_credentials=TrueExplicit origin list
time.sleep() in async defawait asyncio.sleep() or use def route
pip / poetryuv
Optional[X]X | None (Python 3.10+)
200 OK with error in bodyProper 4xx/5xx + RFC 9457 application/problem+json
{"error": {"message": ...}} custom formatRFC 9457 Problem Details
?page=N offset pagination by defaultCursor pagination (?cursor=...)
Verb URIs (/getUsers, /createUser)Noun resource URIs (/users)
Unversioned public endpoints/v1/ URI prefix on all routes

Reference Files

FileContents
references/pydantic-v2.mdSchemas, validators, ConfigDict, computed_field, settings
references/endpoints-routing.mdRouter setup, CRUD, query parameter models (0.115+), dependencies
references/authentication.mdPyJWT, OAuth2, RBAC, httpOnly cookies, refresh tokens
references/async-sqlalchemy.mdEngine, AsyncAttrs, DatabaseSessionManager, CRUD, lifespan
references/testing-async.mdanyio auto mode, AsyncClient, NullPool, rollback isolation
references/security.mdCORS, rate limiting, security headers, middleware stack
references/project-structure.mdDomain-based layout, app factory, module conventions
references/error-responses.mdRFC 9457 Problem Details, FastAPI exception handlers, status code guide
references/pagination.mdCursor pagination, async SQLAlchemy keyset queries, response envelope
references/versioning.mdURI versioning, APIRouter prefix, breaking changes, Sunset headers

Keep looking

Skills are one crate of 626,194. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.