backend-fastapi-python

backend-fastapi-python is a skill for Claude Code from avibebuilder/claude-prime. It costs 135 tokens per session (876 once invoked), scanned A, original, MIT.

A set of conventions for Python backend work using FastAPI, SQLModel, Pydantic settings, and asynchronous SQLAlchemy. A backend is the server-side code that handles data, business rules, and API requests.

In plain words
What is it for?
Use it to build or debug FastAPI endpoints, define schemas, write services, handle authentication and authorisation, create database migrations, and investigate validation errors such as HTTP 422 responses.
Why use it?
It reduces inconsistencies in service functions, authentication, responses, database relationships, validation, and error handling.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to build or debug FastAPI endpoints, define schemas, write services, handle authentication and authorisation, create database migrations, and investigate validation errors such as HTTP 422 responses.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/avibebuilder/claude-prime/backend-fastapi-python
Install

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.

Any agent
npx skills add avibebuilder/claude-prime --skill backend-fastapi-python
Clone the repo
git clone --depth 1 https://github.com/avibebuilder/claude-prime

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backend-fastapi-python

README.md
[![agentmods](https://agentmods.dev/badge/skills/avibebuilder/claude-prime/backend-fastapi-python/github.svg)](https://agentmods.dev/skills/avibebuilder/claude-prime/backend-fastapi-python)
Your own site
<a href="https://agentmods.dev/skills/avibebuilder/claude-prime/backend-fastapi-python"><img src="https://agentmods.dev/badge/skills/avibebuilder/claude-prime/backend-fastapi-python/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for backend-fastapi-python

Your own site · 80×15
<a href="https://agentmods.dev/skills/avibebuilder/claude-prime/backend-fastapi-python"><img src="https://agentmods.dev/badge/skills/avibebuilder/claude-prime/backend-fastapi-python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 135 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 876 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00135 $0.00876
Opus 5.5 $0.00054 $0.00350
Sonnet 5.5 $0.00027 $0.00175
Haiku 4.5 $0.00014 $0.00088

Measured 1mo ago against content hash eb45fec00160, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

backend-fastapi-python 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 1mo 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.

.claude/starter-skills/backend-fastapi-python/SKILL.md · 47 lines

How it starts

The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backend FastAPI Python

Project-specific conventions for FastAPI with SQLModel, pydantic-settings, and async SQLAlchemy.

Architecture Decisions

  1. Services are stateless functions — Not classes. First param is db: AsyncSession.
  2. Generic response wrapper — Always use ApiResponse[T] for consistency.
  3. Dependencies chain — get_current_user -> require_auth -> require_admin.
  4. Module-scoped config — Each module can have its own {module}_config.py.
  5. Error codes for frontend — AppException(status, message, error_code).

Gotchas

  • SQLModel Relationship() fields are NOT included in API responses by default. You must explicitly add them to model_config or use a separate response schema with those fields.
  • AsyncSession.refresh() does not load relationships. After commit, re-query with .options(selectinload(...)) if you need related objects.
  • Pydantic V2 uses model_validator not validator. The @validator decorator is V1 and will break silently or raise deprecation warnings.
  • Depends() in FastAPI creates a NEW instance per request — don't store state in dependency return values expecting it to persist.
  • Background tasks (BackgroundTasks) run AFTER the response is sent. If they fail, the client already got a 200. Use proper task queues (Celery, ARQ) for anything that must not silently fail.
  • Alembic --autogenerate misses: table renames (generates drop+create), index changes on existing columns, and Enum type modifications in PostgreSQL. Always review generated migrations.
  • async def endpoints block the event loop if you call sync I/O inside them. Use run_in_executor for sync libraries or define the endpoint as def (FastAPI runs sync endpoints in a threadpool).
  • HTTPException from FastAPI and HTTPException from Starlette are different classes. Importing the wrong one causes middleware to miss exception handlers.
  • SQLAlchemy's lazy="selectin" on relationships causes N+1 queries in async sessions. Use explicit selectinload() in queries instead.
  • Optional[str] = None in query params makes the field optional. str = None also works but loses type information — prefer the explicit Optional form.
  • When using response_model, FastAPI filters OUT any fields not in the model. If your response is missing data, check that the response model includes all fields, not just the ORM model.

Read the full file on GitHub · 47 lines

Changes

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.

  1. 1mo ago First seen · 47 lines · 135 tokens per session scan A eb45fec00160

Subscribe to this mod's changes

backend-fastapi-python is a skill published in the GitHub repository avibebuilder/claude-prime (120 stars, last pushed 5mo ago), licensed MIT. It adds 135 tokens to every session and 876 once invoked, about $0.0005 per session on Opus 5.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.

Related

Other skills, from other repositories

fastapi-architect

Framework-specific delta on rest-api-architect — FastAPI 0.136 on Python 3.14. Feature layout, Pydantic v2 request/response separation, async DI with lifespan, URL-prefix versioning, RFC 9457 errors, in-house OAuth2+JWT or external IdP. Read rest-api-architect first for the cross-cutting REST conventions. Use when…

ralvarezdev/ralvaskills · 92 tokens

odoo-python

Use when writing or reviewing any Python in an Odoo module — models, computes, overrides, controllers, wizards. Carries PSAE review-derived principles for ORM correctness, performance, style, and security, plus references for exact patterns. Invoke before writing logic in models/, controllers/, or wizard/.

assoumaaa/odoo-superpowers · 64 tokens

django-expert

Use when building Django web applications or REST APIs with Django REST Framework. Invoke when working with settings.py, models.py, manage.py, or any Django project file. Creates Django models with proper indexes, optimizes ORM queries using selectrelated/prefetchrelated, builds DRF serializers and viewsets, and…

Jeffallan/claude-skills · 96 tokens

fastapi-expert

Use when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke to create REST endpoints, define Pydantic models, implement authentication flows, set up async SQLAlchemy database operations, add JWT authentication, build WebSocket endpoints, or generate OpenAPI documentation. Trigger terms…

Jeffallan/claude-skills · 95 tokens

beautifulsoup-parsing

Expert guidance for HTML/XML parsing using BeautifulSoup in Python with best practices for DOM navigation, data extraction, and efficient scraping workflows.

Mindrally/skills · 32 tokens

odoo-development

Expert guidance for Odoo ERP development including Python ORM, XML views, and module architecture.

Mindrally/skills · 21 tokens