Skip to content
cfircoo avatar

Sqlalchemy Postgres

Expert SQLAlchemy 2.0, Pydantic v2, and PostgreSQL guidance for async database layers, models, and migrations.

CCM score
44 of 100
skills.sh installs
517
GitHub stars
17
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers database layer setup, model definition, Alembic migrations, and async query patterns for PostgreSQL only
  • Includes reference docs on production patterns, repository and Unit of Work, and async session management with FastAPI
  • Enforces separate models/ (ORM) and schemas/ (Pydantic) layers, Mapped[] type annotations, and from_attributes=True on read schemas
  • Designed for FastAPI projects that use the asyncpg driver and need a repository pattern with session injection

Install

$ npx -y skills add cfircoo/claude-code-toolkit --skill sqlalchemy-postgres -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

<essential_principles>

SQLAlchemy 2.0 + Pydantic + PostgreSQL Best Practices

This skill provides expert guidance for building production-ready database layers.

Stack

  • SQLAlchemy 2.0 with async support (asyncpg driver)
  • Pydantic v2 for validation and serialization
  • Alembic for migrations
  • PostgreSQL only

Core Principles

1. Separation of Concerns

models/       # SQLAlchemy ORM models (database layer)
schemas/      # Pydantic schemas (API layer)
repositories/ # Data access patterns
services/     # Business logic

2. Type Safety First Always use SQLAlchemy 2.0 style with Mapped[] type annotations:

from sqlalchemy.orm import Mapped, mapped_column

class User(Base):
    __tablename__ = "users"
    id: Mapped[int] = mapped_column(primary_key=True)
    name: Mapped[str] = mapped_column(String(100))

3. Async by Default Use async engine and sessions for FastAPI:

from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
engine = create_async_engine("postgresql+asyncpg://...")

Details

Repository
github.com/cfircoo/claude-code-toolkit
Categories
Databases, Python, Backend & APIs
First seen
Jun 3, 2026

Questions

What does the sqlalchemy-postgres skill help with?

The sqlalchemy-postgres skill gives expert guidance for building database layers with SQLAlchemy 2.0, Pydantic v2 and PostgreSQL. It covers setting up the database layer, defining models, creating Alembic migrations, and async query patterns. It is activated automatically when database-related work comes up.

How do I install the sqlalchemy-postgres skill?

Run this command in a project: npx -y skills add cfircoo/claude-code-toolkit --skill sqlalchemy-postgres -y. After that, the agent can follow the skill's SQLAlchemy and PostgreSQL practices when you work on models, migrations or queries.

Who is the sqlalchemy-postgres skill for?

It is for developers building Python applications that use SQLAlchemy with PostgreSQL, especially async FastAPI services. It assumes the stack of SQLAlchemy 2.0 with asyncpg, Pydantic v2 and Alembic. The skill sets out a separate layout for models, schemas, repositories and services.

What does the sqlalchemy-postgres skill need to run?

The skill's own files list no separate tools, accounts or API keys. It expects a Python project using SQLAlchemy 2.0, Pydantic v2, Alembic and the asyncpg driver against a PostgreSQL database. The connection string format it shows is postgresql+asyncpg with user, password, host and database name.

Where does the sqlalchemy-postgres skill stand in the Databases category?

On Claude Marketplaces it sits in the Databases category, next to supabase-postgres-best-practices and several Prisma skills such as prisma-client-api and prisma-postgres. Its focus is the Python stack of SQLAlchemy, Pydantic and PostgreSQL rather than JavaScript or hosted database platforms.

Similar to Sqlalchemy Postgres

More Databases