registry/skills/fastapi-best-practices/SKILL.md
FastAPI best practices and conventions. Use when writing, reviewing, or refactoring FastAPI applications — route handlers, Pydantic schemas, dependency injection, project structure, async patterns, testing, or API documentation. Triggers on tasks involving FastAPI routers, endpoints, request validation, response models, or application configuration. Does not cover general Python syntax or typing — see modern-python-development for that.
npx skillsauth add provectus/awos-recruitment fastapi-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Opinionated conventions for building production FastAPI applications. General Python idioms (naming, type hints, error handling, dataclasses) are covered by modern-python-development — this skill focuses on FastAPI-specific patterns.
| Category | Impact | Reference |
|---|---|---|
| Project Structure | HIGH | references/project-conventions.md |
| Async Routes | CRITICAL | references/async-patterns.md |
| Pydantic Integration | HIGH | references/pydantic-patterns.md |
| Dependency Injection | HIGH | references/dependencies.md |
| Database & Migrations | MEDIUM | references/project-conventions.md |
| Testing | MEDIUM | references/project-conventions.md |
| API Documentation | LOW | references/project-conventions.md |
async def — use ONLY with non-blocking await calls; blocks event loop otherwisedef (sync) — use for blocking I/O; runs in threadpool automaticallyrun_in_threadpool() from StarletteSee references/async-patterns.md for decision matrix, threadpool caveats, and examples.
Organize by domain, not by file type:
src/
├── auth/ # Domain package
│ ├── router.py # Endpoints
│ ├── schemas.py # Pydantic models
│ ├── models.py # DB models
│ ├── service.py # Business logic
│ ├── dependencies.py # Route dependencies
│ ├── config.py # Env vars (BaseSettings)
│ ├── constants.py # Constants, error codes
│ ├── exceptions.py # Domain exceptions
│ └── utils.py # Helpers
├── posts/ # Another domain
│ └── ...
├── config.py # Global config
├── database.py # DB connection
└── main.py # App init
from src.auth import constants as auth_constantsSee references/project-conventions.md for full layout, DB naming, Alembic, and linting.
Field, EmailStr, AnyUrl) before writing custom onesBaseSettings by domain — one per module, not a single global configValueError in validators becomes a 422 response with the full messageSee references/pydantic-patterns.md for base model template, schema design, and ORM mode.
async dependencies to avoid threadpool overhead on trivial operationsSee references/dependencies.md for chaining, auth, pagination, and DB session patterns.
lower_case_snake, singular (post, user, post_like)_at suffix; date columns: _date suffixSee references/project-conventions.md for index naming template, Alembic migration conventions, and SQL-first examples.
See references/project-conventions.md for async test fixture setup.
openapi_url=None for non-allowed environmentsresponse_model, status_code, description, tags on endpointsSee references/project-conventions.md for docs configuration and endpoint documentation examples.
Each reference file contains detailed explanations, correct/incorrect code examples, and rationale. Read individual files as needed for the category you're working on.
development
Insurance underwriting domain knowledge for building automated submission processing systems. Covers submission-to-bind lifecycle, document extraction patterns, compliance gates (sanctions, licensing, clearance), human-in-the-loop design for regulated financial services, confidence calibration for extracted fields, operating mode progression (manual to automated), and evidence traceability requirements. Use when designing or implementing underwriting pipelines, extraction agents, compliance workflows, HITL review systems, or decision package assembly for insurance or MGA operations.
development
This skill should be used when the user asks to "write TypeScript code", "create a TypeScript module", "define TypeScript types", "add type annotations", "use generics", "handle errors in TypeScript", "set up tsconfig", "organize TypeScript project", or when writing any TypeScript code that is not tied to a specific library or framework. Covers type system, strict mode, naming conventions, error handling, async patterns, and project structure.
development
Use when working with Terraform or OpenTofu - creating modules, writing tests (native test framework, Terratest), setting up CI/CD pipelines, reviewing configurations, choosing between testing approaches, debugging state issues, implementing security scanning (trivy, checkov), or making infrastructure-as-code architecture decisions. Enforces Provectus opinionated conventions (exact version pinning, etc.) on top of community best practices.
development
This skill should be used when the user asks to "write Swift code", "create a Swift type", "set up a Swift package", "review Swift code", "refactor Swift", "use async/await in Swift", "fix Swift style", or when generating any Swift source code regardless of target platform. Provides modern Swift 6+ best practices covering type system, optionals, concurrency, error handling, protocols, generics, and idiomatic patterns. Does not cover any specific platform or framework.