Skip to content
Skillv1.0.0

fastapi

FastAPI framework best practices including Pydantic schemas, dependency injection, and async patterns.

by diegosouzapw(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from diegosouzapw/awesome-omni-skill (skills/backend/fastapi/SKILL.md). Install upstream with npx skills add diegosouzapw/awesome-omni-skill --skill fastapi. Copyright stays with the author.

FastAPI Best Practices

Project Structure

  • app/main.py - Application entry
  • app/routers/ - Route handlers
  • app/models/ - SQLAlchemy models
  • app/schemas/ - Pydantic schemas
  • app/services/ - Business logic
  • app/dependencies.py - Dependency injection

Pydantic Schemas

  • Use separate schemas for input/output
  • Use Field() for validation
  • Use model_validator for complex validation
  • Use Config for schema settings

Dependency Injection

  • Use Depends() for dependencies
  • Create reusable dependencies
  • Use yield for cleanup logic
  • Cache expensive dependencies

Async

  • Use async def for I/O operations
  • Use httpx for async HTTP
  • Use databases/SQLAlchemy async
  • Avoid blocking in async context

Performance

  • Use response_model for serialization
  • Enable response caching
  • Use background tasks
  • Stream large responses
  • Use connection pooling

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/diegosouzapw-awesome-omni-skill-fastapi/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

diegosouzapw-awesome-omni-skill-fastapi.ocm.jsonjson
{
  "ocm": "1",
  "id": "diegosouzapw-awesome-omni-skill-fastapi",
  "kind": "skill",
  "name": "fastapi",
  "description": "FastAPI framework best practices including Pydantic schemas, dependency injection, and async patterns.",
  "publisher": "diegosouzapw",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "framework",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "FastAPI framework best practices including Pydantic schemas, dependency injection, and async patterns."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/diegosouzapw/awesome-omni-skill",
      "path": "skills/backend/fastapi/SKILL.md",
      "ref": "a6b3c3005cedf056a48b084671c6282426d6e9fc",
      "url": "https://github.com/diegosouzapw/awesome-omni-skill/blob/a6b3c3005cedf056a48b084671c6282426d6e9fc/skills/backend/fastapi/SKILL.md",
      "key": "diegosouzapw/awesome-omni-skill/skills/backend/fastapi/SKILL.md"
    }
  },
  "instructions": "# FastAPI Best Practices\n\n## Project Structure\n- app/main.py - Application entry\n- app/routers/ - Route handlers\n- app/models/ - SQLAlchemy models\n- app/schemas/ - Pydantic schemas\n- app/services/ - Business logic\n- app/dependencies.py - Dependency injection\n\n## Pydantic Schemas\n- Use separate schemas for input/output\n- Use Field() for validation\n- Use model_validator for complex validation\n- Use Config for schema settings\n\n## Dependency Injection\n- Use Depends() for dependencies\n- Create reusable dependencies\n- Use yield for cleanup logic\n- Cache expensive dependencies\n\n## Async\n- Use async d",
  "cost": {
    "context_tokens": 217
  }
}

Fetch it by URL: GET /api/v1/registry/diegosouzapw-awesome-omni-skill-fastapi/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.