# SQLAlchemy ORM Expert

A SQLAlchemy 2.0+ skill for customer support backends: ticket models, sessions, async queries and PostgreSQL. Useful when you build on FastAPI.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 470 installs · ★ 62
- Author: Customer Support Tech Enablement Team
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-database-pro/skills/sqlalchemy/SKILL.md
- Updated: 2026-06-13
- HTML: https://affpapa.org/en/nevibecode/skills/sqlalchemy-orm-expert

## What it does

The skill walks through data models for a support system: users, tickets, comments, attachments, tags. Declarative mapping with type hints, enums for status and priority, soft delete via `deleted_at`, one-to-many and many-to-many relationships through an association table. Every piece comes with code the agent can drop into your project.

Sessions, query optimisation, async operations and PostgreSQL integration follow. FastAPI, Flask and Django are listed as supported frameworks. Async needs `asyncpg`; synchronous PostgreSQL access uses `psycopg2-binary`, migrations run on `alembic`, tests on `pytest` and `pytest-asyncio`. SQLAlchemy itself must be 2.0 or newer — the `Mapped` and `mapped_column` examples break on 1.x.

The examples target support workflows: ticket handling, authentication, bulk data operations, reporting, audit trails. On an unrelated project you can still reuse the patterns, but the model layout will need rework.

## Requirements
- Works with: PostgreSQL

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill sqlalchemy-orm-expert -a claude-code
```
```bash
npx skills add manutej/luxor-claude-marketplace --skill sqlalchemy -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/sqlalchemy/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/sqlalchemy/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill sqlalchemy -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/sqlalchemy/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill sqlalchemy -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/sqlalchemy/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install manutej/luxor-claude-marketplace sqlalchemy
```

2. **Manually: put the files in place**
- File: `.github/skills/sqlalchemy/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill sqlalchemy -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/manutej/luxor-claude-marketplace --path plugins/luxor-database-pro/skills/sqlalchemy
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/sqlalchemy/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill sqlalchemy -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-database-pro/skills/sqlalchemy/SKILL.md

## When to use it
- model tickets, users and comments in one place
- wire up relationships without hand-written joins
- move sync queries to async under FastAPI
- speed up heavy PostgreSQL selects
- add soft delete and an audit trail

## Example prompts
- Write User, Ticket and Comment models with SQLAlchemy 2.0 type annotations
- Rewrite this query as an async session with asyncpg
- Check my model relationships and tell me where selectinload belongs

## Similar
- [sqlalchemy](https://affpapa.org/en/nevibecode/rules/sqlalchemy.md) — rule · ★ 3579
- [prisma-orm-setup](https://affpapa.org/en/nevibecode/skills/prisma-orm-setup.md) — skill · 67900 installs
- [prisma-postgres](https://affpapa.org/en/nevibecode/skills/prisma-postgres.md) — skill · 382300 installs
- [prisma-patterns](https://affpapa.org/en/nevibecode/skills/prisma-patterns.md) — skill · 4500 installs
- [drizzle-orm](https://affpapa.org/en/nevibecode/skills/drizzle-orm.md) — skill · 1000 installs
- [django-patterns](https://affpapa.org/en/nevibecode/skills/django-patterns.md) — skill · 5200 installs

From the same set: [manutej/luxor-claude-marketplace](https://affpapa.org/en/nevibecode/by/manutej/luxor-claude-marketplace.md) — 31 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
