What it does
FastCRUD is a Python package for FastAPI, offering robust async CRUD operations and flexible endpoint creation utilities.
- Connects Instruction files the AI reads
- Account or key No key found in README or SKILL.md
- Category Coding
For makers: add a badge to your README
If you made this, paste this code into your README. The badge links back to this page.
[](https://mcp.popnx.com/en/skills/benavlabs-fastcrud)Use together with
MCP servers that connect the AI to services for the same work
Fallow
Codebase intelligence for TypeScript and JavaScript, exposed as structured MCP analysis tools.
Desktop Commander
MCP server for terminal commands, file operations, and process management
Similar Skills
Same kind of work, ordered like the Skills list
| This one fastcrud | rea | andrej-karpathy-skills | graphify | MoneyPrinterTurbo | |
|---|---|---|---|---|---|
| Maker | benavlabs | morluto | multica-ai | Graphify-Labs | harry0703 |
| Skills | 1 | 1 | 1 | 1 | 1 |
| GitHub stars | 1,602 | 467,235 | 234,125 | 149,873 | 144,332 |
| Last code change | Oct 12, 2026 | Nov 18, 2026 | Apr 20, 2026 | Nov 18, 2026 | Nov 18, 2026 |
| License | MIT | MIT | – | Apache-2.0 | MIT |
1 skills (instruction sets) by benavlabs that an AI reads and follows · not an MCP server
How a Skill differs from MCP
MCP = the hands
Connects the AI to an outside service or data, such as reading Notion or creating an invoice. A program or server has to be running.
Skill = the manual
A text file that teaches the AI how to do a task. It connects to nothing.
Some overlap: a few Skills run scripts that call tools, and a few MCP servers only send knowledge. Start from the task you want done.
Works with
Claude CodeCodexCursorGitHub CopilotOpenCode
From the maker’s README and the folders in the repo
Install
Is it safe?
- Who made it
GitHub account benavlabs (organization), 1 years old
- Use and upkeep
★ 1,602 stars · code last changed Oct 12, 2026
- Any scripts?
No, plain text files the AI reads and follows
- Uses the internet?
No scripts, so it does not go online by itself
- Changes machine-wide settings?
No hooks or writes to machine settings found
Checked automatically from the repo files at commit 27f2cba (read only, nothing was run). Not a safety guarantee: read it and decide for yourself
First: which AI do you use?
Pick your app and this page shows only how to install it there
Option 1Upload to claude.ai (web and app)
Uploading to claude.ai would fail: the description is over 200 characters (622). Use "Let the AI install it" instead
Option 1Let Claude Code install it
Copy this sentence and paste it into a Claude Code chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Restart Claude Code, then type /fastcrud or ask for a matching task and Claude picks it up
Checked against official docs Nov 12, 2026 · Source: code.claude.com
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.claude/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/benavlabs/fastcrud.git /tmp/popnx-skill-benavlabs-fastcrud-27f2cba && mkdir -p ~/.claude/skills && cp -R '/tmp/popnx-skill-benavlabs-fastcrud-27f2cba/fastcrud/.agents/skills/fastcrud' ~/.claude/skills/fastcrudRestart Claude Code, then type /fastcrud or ask for a matching task and Claude picks it up
ChatGPT desktop app
The ChatGPT desktop app has Codex built in, and Codex reads skills from ~/.agents/skills
Option 1Let ChatGPT install it
Open Codex in the ChatGPT desktop app and paste this sentence into the chat
The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Option 2Put the folder there yourself
Put the fastcrud folder at ~/.agents/skills/fastcrud
~ is your home folder ($HOME)
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.agents/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/benavlabs/fastcrud.git /tmp/popnx-skill-benavlabs-fastcrud-27f2cba && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-benavlabs-fastcrud-27f2cba/fastcrud/.agents/skills/fastcrud' ~/.agents/skills/fastcrud
After installing
- ChatGPT desktop app: open Skills in the sidebar to see that the skill is there
- To use it: in ChatGPT type @ and pick the skill · in Codex CLI or the IDE extension run /skills or type $ and the skill name
- Codex picks up newly installed skills by itself; if one does not show up, restart Codex
Checked against official docs Nov 15, 2026 · Source: learn.chatgpt.com
ChatGPT on the web and mobile
Skills you install yourself do not work here; only skills that come with a plugin from the directory
To use this skill with ChatGPT, use the ChatGPT desktop app as above
Checked against official docs Nov 15, 2026 · Source: learn.chatgpt.com
Option 1Let Codex install it
Copy this sentence and paste it into a Codex chat · Works in Codex inside the ChatGPT desktop app, Codex CLI and the IDE extension
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Codex picks up newly installed skills by itself; if one does not show up, restart Codex · To use it: in ChatGPT type @ and pick the skill · in Codex CLI or the IDE extension run /skills or type $ and the skill name
Checked against official docs Nov 15, 2026 · Source: learn.chatgpt.com
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.agents/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/benavlabs/fastcrud.git /tmp/popnx-skill-benavlabs-fastcrud-27f2cba && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-benavlabs-fastcrud-27f2cba/fastcrud/.agents/skills/fastcrud' ~/.agents/skills/fastcrudRestart Codex, then ask for a matching task; Codex lists the skill
Option 1Let Cursor install it
Copy this sentence and paste it into a Cursor chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
In Cursor’s Agent chat, type / and pick fastcrud
Checked against official docs Nov 12, 2026 · Source: cursor.com
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.cursor/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/benavlabs/fastcrud.git /tmp/popnx-skill-benavlabs-fastcrud-27f2cba && mkdir -p ~/.cursor/skills && cp -R '/tmp/popnx-skill-benavlabs-fastcrud-27f2cba/fastcrud/.agents/skills/fastcrud' ~/.cursor/skills/fastcrudIn Cursor’s Agent chat, type / and pick fastcrud
Option 1Let the AI install it
For other apps that read skills. The sentence gives the paths for Claude Code, Codex and Cursor so the AI picks the one for your app · Copy this sentence into the app’s chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Checked against official docs Nov 12, 2026 · Source: code.claude.com, learn.chatgpt.com, cursor.com
For Terminal users
Other apps that support Agent Skills (such as Gemini CLI or GitHub Copilot) use different folders. Check that app’s guide, then copy the folder with the SKILL.md there.
Skill folders checked against the official Claude Code, Codex and Cursor guides on Nov 11, 2026
✓ Commands checked Nov 18, 2026
View the original SKILL.md
The text below comes from the maker’s repo, not from PopNx MCP
Showing the first 8,000 characters · Open the full file on GitHub
---
name: fastcrud
description: Use when building or modifying CRUD endpoints with FastCRUD (the `fastcrud` PyPI package) in a FastAPI project — covers `FastCRUD`, `crud_router`, `EndpointCreator`, `FilterConfig`, `JoinConfig`, auto-relationship detection, the filter operator syntax (`__gte`, `__in`, `__ilike`, etc.), cursor pagination, soft delete, and how to avoid N+1 queries when fetching related data. Activate when the user mentions FastCRUD, `crud_router`, `FastCRUD()`, `FilterConfig`, `JoinConfig`, or asks how to build CRUD endpoints / generate REST APIs from SQLAlchemy or SQLModel models, even if the user doesn't name the library directly.
license: MIT
metadata:
author: benav-labs
package: fastcrud
---
# FastCRUD
FastCRUD generates async CRUD methods (and optionally CRUD endpoints) for SQLAlchemy 2.0 models inside a FastAPI app. The two entry points are:
- **`FastCRUD(Model)`** — the data-access class. Use this for per-row CRUD operations (single-record get / create / update / delete, paginated lists, joins with relationships). Real codebases use this in services, workers, and custom endpoints.
- **`crud_router(...)`** — returns an `APIRouter` with create/read/update/delete endpoints auto-wired. Use this only when you want generated endpoints; many apps skip it and hand-roll FastAPI routes on top of `FastCRUD` instances.
This skill covers the public API across `fastcrud >= 0.22`; features marked (v0.23+) need `fastcrud >= 0.23`. SQLAlchemy is the default ORM in examples; SQLModel works the same way except where noted.
**Before reaching for FastCRUD, check the [When NOT to use FastCRUD](#when-not-to-use-fastcrud) section below.** Aggregate roll-ups, CTEs, `GROUP BY` projections, and bulk writes are SQLAlchemy's job — FastCRUD is for per-row CRUD.
---
## Canonical setup
The minimal viable pattern. Always start here, then add filters/joins/relationships as needed.
```python
# models.py
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import DeclarativeBase, relationship
class Base(DeclarativeBase): pass
class Tier(Base):
__tablename__ = "tier"
id = Column(Integer, primary_key=True)
name = Column(String, unique=True)
class User(Base):
__tablename__ = "user"
id = Column(Integer, primary_key=True)
name = Column(String)
email = Column(String, unique=True)
tier_id = Column(Integer, ForeignKey("tier.id"))
tier = relationship("Tier")
```
```python
# schemas.py
from pydantic import BaseModel, ConfigDict
class UserCreate(BaseModel):
name: str
email: str
tier_id: int
class UserRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
email: str
tier_id: int
class UserUpdate(BaseModel):
name: str | None = None
email: str | None = None
```
```python
# main.py
from fastapi import FastAPI
from fastcrud import crud_router
from .db import get_async_session
from .models import User
from .schemas import UserCreate, UserRead, UserUpdate
app = FastAPI()
user_router = crud_router(
session=get_async_session, # callable returning AsyncSession (FastAPI dependency)
model=User,
create_schema=UserCreate,
update_schema=UserUpdate,
select_schema=UserRead, # used for read responses
path="/users",
tags=["users"],
)
app.include_router(user_router)
```
This produces `POST /users`, `GET /users/{id}`, `PATCH /users/{id}`, `DELETE /users/{id}`, `DELETE /users/db_delete/{id}` (hard delete), and `GET /users` (paginated list).
---
## Choosing the right method
When using `FastCRUD(Model)` directly, pick the method that matches the data shape you actually need. **Do not loop over `get_multi()` and call `get_joined()` per row** — that's the canonical N+1.
| Need | Use |
|---------------------------------------------|------------------------------|
| Single row, no joins | `get(db, id=...)` |
| Single row with related data | `get_joined(db, id=...)` |
| Paginated list, no joins | `get_multi(db, offset, limit)` |
| **Paginated list with related data** | **`get_multi_joined(db, ...)`** |
| Cursor-paginated list (infinite scroll) | `get_multi_by_cursor(db, ...)` |
| Insert | `create(db, schema)` |
| Insert-or-update by unique constraint | `upsert(db, schema)` / `upsert_multi(db, list)` |
| Patch by filters | `update(db, schema, **kwargs)` |
| Soft delete (if configured) | `delete(db, **kwargs)` |
| Hard delete (always removes row) | `db_delete(db, **kwargs)` |
| Count | `count(db, **kwargs)` |
| Boolean existence check | `exists(db, **kwargs)` |
---
## Avoiding N+1 — the most common mistake
FastCRUD has two mechanisms to prevent N+1 when fetching related data. **Use one of them — never iterate.**
### 1. Auto-detect relationships (zero config, default for v0.21+)
Set `include_relationships=True` on `crud_router` (or `auto_detect_relationships=True` on the FastCRUD method directly). FastCRUD inspects the SQLAlchemy mapper, builds the joins, and threads them through a single query.
```python
crud_router(
session=get_async_session,
model=User,
create_schema=UserCreate,
update_schema=UserUpdate,
select_schema=UserWithTier, # schema includes nested tier field
include_relationships=True, # auto-include all relationships
path="/users",
)
```
Or pass a list to include only specific relationships:
```python
include_relationships=["tier", "department"] # whitelist
```
**Gotcha:** **One-to-many relationships are excluded by default** because they can return unbounded data. Opt in explicitly:
```python
include_relationships=True,
include_one_to_many=True,
default_nested_limit=10, # cap nested rows per parent (uses SQL window function)
```
`default_nested_limit` uses `row_number() OVER (PARTITION BY ...)` at the database level — it does **not** fetch everything and slice in Python.
### 2. Manual `JoinConfig` (when you need explicit control)
For self-joins, aliases, custom join conditions, or per-join schemas:
```python
from fastcrud import FastCRUD, JoinConfig
orders_with_user = await crud.get_multi_joined(
db=session,
joins_config=[
JoinConfig(
model=User,
join_on=Order.user_id == User.id,
join_prefix="user_", # avoid column collisions
schema_to_select=UserRead,
),
],
offset=0,
limit=20,
)
```
For one-to-many with per-parent capping:
```python
JoinConfig(
model=Article,
join_on=Article.author_id == Author.id,
relationship_type="one-to-many",
sort_columns="created_at",
sort_orders="desc",
nested_limit=5, # 5 most recent articles per author, computed in SQL
)
```
See `references/joins.md` for the full `JoinConfig` spec, polymorphic inheritance, and the auto-detection rules.
---
## `limit=None` — the second biggest footgun
`get_multi(...)` / `get_multi_joined(...)` accept `limit=None` to fetch **every matching row**. This is the single biggest cause of latency cliffs and OOMs in real-world FastCRUD code.
**Rule:** `limit=None` is only safe when a `WHERE` clause domain-bounds the result to a known-small set. Otherwise, always pass an explicit numeric `limit`.
### Safe — scoped by a WHERE clause
```python
# OK: scoped to a single project → bounded by N(clips per project)
clips = await crud_clips.get_multi(db, limit=None, project_id=project.id)
# OK: scoped to a small known set of IDs
tiers = await crud_tiers.get_multi(db, limit=None, id__in=tier_ids)
```
### Unsafe — unbounded growth
```python
# BAD: grows linearly with the user table forever
users = await crud_users.get_multi(db, limit=NoDiscussion
Ask, share a tip or report that it does not work. Sorted by what people marked helpful.
No posts yet. Be the first to ask or share.
Posts here are written by users, not the PopNx team.
From GitHub
- GitHub stars
- 1,602
- Maker
- benavlabs
- License
- MIT
- Last code change
- Oct 12, 2026
- SKILL.md files in the repo (including translated copies and templates)
- 1
- Topics
- async, backend, crud, fastapi, pydantic, pydantic-v2, python, sqlalchemy