Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

sqlmodel

Skill by fastapi

Gives an AI assistant SQLModel patterns for writing and reviewing Python code. It covers models, sessions, queries, relationships, FastAPI integration, and deletes. Aimed at developers who use SQLModel, especially in FastAPI projects.

  • Score 91
  • 19k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install sqlmodel

Built from the published package, never by AI.

git clone --depth 1 https://github.com/fastapi/sqlmodel /tmp/sqlmodel && mkdir -p ~/.claude/skills && cp -r /tmp/sqlmodel/sqlmodel/.agents/skills/sqlmodel ~/.claude/skills/sqlmodel

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install sqlmodel in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This agent skill gives an AI assistant SQLModel coding patterns for Python. It tells the assistant to use SQLModel's own API first and not to default to raw SQLAlchemy patterns, unless a task needs a SQLAlchemy-only feature. The guidance covers table models, datetimes, sessions and queries, relationships, creates and updates, metadata setup, and deletes.

The skill includes code examples for each area, such as a split model pattern for FastAPI with separate base, table, create, update, and public models. It also covers SQLite setup for tests and FastAPI, and when SQLAlchemy escape hatches are appropriate. It is aimed at developers writing or reviewing Python code that uses SQLModel, especially in FastAPI projects.

Written from the project's SKILL.md and checked against it.

What it can do

  • Model definitionsShows how to define table models with SQLModel, table=True and Field().
  • Datetime handlingExplains UTC datetime behavior in SQLModel 0.0.45 and newer and when to use aware values.
  • Sessions and queriesShows session.exec(select(...)), session.get, and result methods like .all() and .one().
  • RelationshipsCovers one-to-many and many-to-many relationships, including link models and TYPE_CHECKING imports.
  • Creates and updatesShows model_validate for creates and partial updates with exclude_unset and sqlmodel_update.
  • FastAPI integrationDescribes a split model pattern with HeroBase, HeroCreate, HeroUpdate, and HeroPublic models.
  • Deletes and cascadesCovers cascade_delete, ondelete options, and passive_deletes on relationships.
  • Metadata and SQLite setupExplains create_all ordering and SQLite connect_args for FastAPI.

What you need

  • Python
  • SQLModel 0.0.45 or newer for automatic UTC datetime handling

Try asking

  • Write a SQLModel Hero model with a team relationship and a foreign key
  • Review my FastAPI SQLModel endpoints for create, update, and delete logic
  • Add a many-to-many link model between Hero and Team in SQLModel

Good to know

  • Changing a model does not alter existing columns or convert historical data.
  • Direct table-model construction currently skips Pydantic validation.
  • Naive datetimes are rejected when the statement executes unless the model is set up for naive storage.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: sqlmodel/.agents/skills/sqlmodel/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md8 KB

Alternatives to sqlmodel

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

sqlmodel: common questions

Should SQLModel code use session.query or session.exec?

The skill says to use session.exec(select(...)) and not session.execute or session.query. It notes that exec() handles scalar results for model selects.

How should timestamps be stored with SQLModel?

Use datetime fields with aware values, and SQLModel selects UTCDateTime automatically in 0.0.45 and newer. The skill advises against adding sa_type=DateTime(timezone=True) to enable timezone support.

How are many-to-many relationships modeled?

The skill uses a link model table with primary key fields for both sides and Relationship(link_model=...) on each model. If the link table has extra fields, it should be a full SQLModel table.

How do I install sqlmodel?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is sqlmodel free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is sqlmodel safe to use?

It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to sqlmodel?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

sqlmodel Install

Add to stack

Loading.