# sqlmodel-expert

sqlmodel-expert is a Claude Code skill that guides SQLModel schema design and Alembic migrations. It helps configure table relationships and resolve N+1 query latency issues.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 159 installs · ★ 1 repo stars
- Author: bilalmk
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/bilalmk/todo_correct/tree/HEAD/.claude/skills/custom/sqlmodel-expert/SKILL.md
- Updated: 2026-01-27
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/sqlmodel-expert

## What it does

The skill guides the assistant through SQLModel architecture patterns. It covers relational definitions, table inheritance, and timestamp mixins. Many-to-many links require intermediate association models. The guides provide explicit patterns for them.

Query optimization is another focal area. The instructions fix N+1 query bottlenecks by applying eager loading via `selectinload`. The project also supplies utility scripts: `scripts/migrate.sh` for Alembic tasks and `scripts/init_db.py` for database bootstrapping.

Testing the generated migrations requires an active database connection and installed Alembic packages.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add bilalmk/todo_correct --skill sqlmodel-expert -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add bilalmk/todo_correct --skill sqlmodel-expert -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add bilalmk/todo_correct --skill sqlmodel-expert -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install bilalmk/todo_correct .claude/skills/custom/sqlmodel-expert
```

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

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add bilalmk/todo_correct --skill sqlmodel-expert -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/bilalmk/todo_correct --path .claude/skills/custom/sqlmodel-expert
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add bilalmk/todo_correct --skill sqlmodel-expert -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/bilalmk/todo_correct/tree/HEAD/.claude/skills/custom/sqlmodel-expert/SKILL.md

## When to use it
- define many-to-many table relationships with link models
- eliminate N+1 query bottlenecks using selectinload
- autogenerate and apply Alembic schema revisions
- configure composite keys and database indexes

## Example prompts
- Set up a one-to-many relationship between `Author` and `Book` models in SQLModel
- Fix N+1 query latency in this endpoint by adding eager loading with `selectinload`
- Generate an Alembic migration script to add a unique constraint on user slugs

## Similar
- [supabase-python](https://affpapa.org/en/nevibecode/skills/supabase-python.md) — skill · 298 installs
- [fastapi-backend-template](https://affpapa.org/en/nevibecode/skills/fastapi-backend-template.md) — skill · 244 installs
- [sqlalchemy](https://affpapa.org/en/nevibecode/skills/sqlalchemy.md) — skill · 322 installs
- [sqlalchemy-alembic-expert-best-practices-code-review](https://affpapa.org/en/nevibecode/skills/sqlalchemy-alembic-expert-best-practices-code-review.md) — skill · 2200 installs
- [alembic](https://affpapa.org/en/nevibecode/skills/alembic.md) — skill · 645 installs
- [sqlalchemy-postgres](https://affpapa.org/en/nevibecode/skills/sqlalchemy-postgres.md) — skill · 510 installs

From the same set: [bilalmk/todo_correct](https://affpapa.org/en/nevibecode/by/bilalmk/todo_correct.md) — 3 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
