fastapi-development

Implement FastAPI APIs and streaming; not diff review or generic Python.

SKILL.md

GitHub
<!-- GENERATED BY generate_skill_wrappers.py; DO NOT EDIT MANUALLY. -->

Generated Claude Code skill — do not edit manually

This complete skill and its bundled resources are generated from agent-plugins/skills/fastapi-development/SKILL.md. Manual changes in this directory will be overwritten the next time the generator runs. Edit the canonical skill instead.

FastAPI Development

Implement the requested FastAPI behavior using the project's supported versions, established stack and public contract. Preserve unrelated work. Return implemented changes, observed verification and remaining limits.

Route precisely

  • Use for creating or changing FastAPI endpoints, Pydantic request/response boundaries, dependencies, lifespan resources or streaming behavior.
  • Use code-review for a read-only review of an existing diff. Do not start implementation merely because reviewed code uses FastAPI.
  • Use api-and-interface-design for a proposed API contract, review-spec for a proposed specification and verify-impl for conformance to an accepted spec.
  • Use uv-project-workflow when the requested result is Python environment or dependency management; the presence of a Python file does not choose uv.
  • Do not activate for unrelated Python, Django, Flask, generic asyncio, or an API with no FastAPI requirement. Establish the framework if it is genuinely unresolved.

Establish the contract and compatibility

  1. Read repository instructions and working-tree state. Identify the owning app/package, affected routes and tests; preserve dirty overlapping work.
  2. Read Python constraints, manifests/lockfiles, resolved FastAPI/Starlette/Pydantic versions, ASGI deployment, lifespan and test configuration. Distinguish a released installed API from upstream main.
  3. State the requested inputs, outputs, status/error behavior, authorization, compatibility and resource ownership. For streams, name the protocol and whether incremental delivery or disconnect behavior is required.
  4. Consult references/contracts-and-versions.md only for the affected features. Verify a feature against the installed version's signatures/source or matching official docs before using it. If evidence is unavailable, use an established supported path or state the missing verification; do not invent a version floor or upgrade automatically.

Implement the smallest coherent change

  • Prefer Annotated parameter/dependency declarations for new compatible code. Reuse dependency aliases when useful; avoid unrelated rewrites of working signatures.
  • Define validation where untrusted values enter. Keep missing values, None, defaults, coercion and strictness consistent with the contract. For new required Pydantic fields prefer no ellipsis default; do not treat existing RootModel or ellipsis as globally deprecated.
  • Declare the public output schema through a supported return type or response_model. Keep internal secrets out of that schema. Direct Response objects need their own serialization/filtering guarantees.
  • Keep router/app dependencies and authorization explicit. Use ordinary validation instead of dependency machinery when no external state or shared execution is needed.
  • Match sync/async execution to actual calls. Keep blocking work off the event loop with a supported, bounded approach; preserve the chosen DB/HTTP libraries unless replacement is requested or demonstrably necessary.
  • Own each session, client, file, task and generator until its last consumer finishes. Align yield cleanup with response consumption and the installed dependency-scope semantics. Do not capture request resources for detached work without a lifecycle and failure owner.
  • Use the requested stream protocol. Check support before adopting native SSE, JSON Lines helpers or newer frontend APIs. Include cancellation and cleanup; do not create unbounded work behind a semaphore.
  • Reuse repository tooling. uv, Ruff, ty, Asyncer, SQLModel and HTTPX are options, not mandatory migrations. Do not enable telemetry/exporters or start a production server as a side effect of editing an endpoint.

Verify behavior

Use the configured targeted ASGI tests and local quality checks. Verify the changed public body/schema, invalid inputs, authorization, error status and resource cleanup as applicable. Exercise app lifespan when a test depends on its resources.

For streaming, distinguish producer iteration, in-process HTTP buffering and an actual incremental/disconnect test. Report which was observed; a buffered TestClient result does not prove deployed backpressure or proxy behavior. Inspect test setup before contacting services or modifying data. Do not install missing tooling merely to claim a check passed.

Use a defect/control comparison when it materially validates a regression claim; keep scratch inputs isolated. Report unrun tests, missing dependencies and unsupported version cells. Separate schema/type-check success from runtime behavior.

Report

Return the implemented scope, version evidence, public behavior changes, files affected, actual tests/results and unverified behavior. Identify any dependency/configuration change and its side effects. Do not commit, publish, deploy or launch external services without the applicable authorization.

Adapted and substantially rewritten from the official FastAPI skill, MIT, copyright Sebastián Ramírez; see LICENSE.fastapi. Changes include version gates, precise routing, stack preservation and explicit verification limits. Attribution does not imply endorsement.