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.
npx agentmods add skills/darellchua2/opencode-config-template/fastapi-pydantic-orm-patterns-skillnpx skills add darellchua2/opencode-config-template --skill fastapi-pydantic-orm-patterns-skillgit clone --depth 1 https://github.com/darellchua2/opencode-config-templateWrote 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.
[](https://agentmods.dev/skills/darellchua2/opencode-config-template/fastapi-pydantic-orm-patterns-skill)<a href="https://agentmods.dev/skills/darellchua2/opencode-config-template/fastapi-pydantic-orm-patterns-skill"><img src="https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/fastapi-pydantic-orm-patterns-skill.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00046 | $0.02395 |
| Opus 5 | $0.00023 | $0.01197 |
| Sonnet 5 | $0.00009 | $0.00479 |
| Haiku 4.5 | $0.00005 | $0.00239 |
Grade A, and why
fastapi-pydantic-orm-patterns-skill 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 2d 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.
How it starts
The opening of the file, as written. The whole thing — 311 lines — stays where its author put it; the contents beside it link to each section on GitHub.
What I do
I provide battle-tested patterns for FastAPI + Pydantic v2 + SQLAlchemy/asyncpg backends, extracted from production incidents across multiple repos. Each pattern caused a real bug and has a concrete fix.
When to use me
Use this skill when:
- Writing or reviewing FastAPI endpoints, especially with async sessions
- Configuring Pydantic v2 models, validators, or serializers
- Writing Alembic migrations (especially with asyncpg + JSONB)
- Auditing multi-tenant isolation or auth flows
- Debugging race conditions in state transitions
- Reviewing error handling in service-to-service calls
Related Skills
- python-backend-skill: Project scaffolding. This skill covers the runtime patterns python-backend-skill references.
- database-migration-skill: Migration workflow patterns. This skill covers the asyncpg-specific pitfalls.
- security-audit-skill: Security auditing. This skill covers the FastAPI-specific auth/encryption patterns.
A. Pydantic v2 Conventions
A1. Canonical Checklist
Use V2 APIs exclusively — the V1 compatibility layer is deprecated and hides bugs.
| Concern | V2 Correct | V1 Legacy (reject) |
|---|---|---|
| Config | model_config = ConfigDict(...) |
class Config: |
| Extra fields | extra="forbid" on API boundary, "ignore" on embedded spec |
Extra.ignore |
| Validators | @field_validator, @model_validator |
@validator |
| Serialization | .model_dump(), .model_validate() |
.dict(), .parse_obj() |
| Computed | @computed_field |
@property only |
| Immutable | model_config = ConfigDict(frozen=True) |
custom __setattr__ |
| Serializer | @field_serializer / @model_serializer |
json_encoders |
| Type adapter | TypeAdapter[T] for non-model validation |
custom parse_* |
| Polymorphism | SerializeAsAny[Base] |
manual discriminated unions |
| Rebuild | model_rebuild() after forward refs |
silent failure |
| Name mode | validate_by_name=True (v2.11+) |
Config.allow_population_by_field_name |
| Init hook | model_post_init() |
__init__ override |
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.
- 2d ago First seen · 311 lines · 46 tokens per session scan A 1f3954a56ea4
fastapi-pydantic-orm-patterns-skill is a skill published in the GitHub repository darellchua2/opencode-config-template (6 stars, last pushed 5d ago), licensed Apache-2.0. It adds 46 tokens to every session and 2,395 once invoked, about $0.0002 per session on Opus 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-09-03.
Other skills, from other repositories
azure-postgres-ts
Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg client", "node-postgres", "Azure PostgreSQL…
butterbase
AI-native, open-source backend-as-a-service with a built-in Model Context Protocol server. Postgres, auth, storage, functions, AI gateway.
supabase
Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…
supabase-cli
This skill should be used when user asks to "use supabase CLI", "supabase init", "supabase start", "run migrations", "deploy edge functions", "manage Supabase project", or works with the supabase command-line tool for local development and project management.
supabase-js
This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the @supabase/supabase-js JavaScript/TypeScript SDK.
firebase-data-connect
Builds and deploys Firebase SQL Connect (aka Firebase Data Connect) backends with PostgreSQL securely. Use when designing schemas with tables and relations, writing authorized queries and mutations, configuring real-time data updates, or generating type-safe SDKs. Use when you need a relational database with Firebase…