- Home
- Skills
- APIs & Backend
- fastapi-projects-async-sql-en
Works with the AI Agents you already use
Fastapi Projects Async Sql en
Scaffold production-ready async FastAPI projects with SQLAlchemy, SQLModel, Alembic migrations, and pytest.
Free
fastapi-projects-async-sql-en
Example session with this skill installed
I want to start a new async FastAPI project called "inventory-service" using PostgreSQL and Python 3.12. Please include the test suite.
- Read your context and instructions
- Compiled the fastapi-projects-async-sql-en
I have initialized the inventory-service project. I used uv for dependency management, configured SQLAlchemy with asyncpg for PostgreSQL, and scaffolded the repository pattern.
Project Structure and Configuration
# pyproject.toml
[project]
name = "inventory-service"
version = "0.1.0"
dependencies = [
"fastapi[standard]",
"sqlmodel",
"sqlalchemy",
"asyncpg",
"alembic",
]
[tool.pytest.ini_options]
asyncio_mode = "auto"
pythonpath = ["."]
testpaths = ["app/tests"]
# app/core/config.py
from pydantic_settings import BaseSettings
from pathlib import Path
class Settings(BaseSettings):
APP_ENV: str = "development"
DATABASE_URL: str
SECRET: str
BASE_DIR: Path = Path(__file__).resolve().parents[2]
class Config:
env_file = ".env"
settings = Settings()
# app/db/base_repository.py
from typing import Generic, TypeVar, Type, List, Optional
from sqlalchemy.ext.asyncio import AsyncSession
from sqlmodel import select
T = TypeVar("T")
class BaseRepository(Generic[T]):
def __init__(self, model: Type[T], session: AsyncSession):
self.model = model
self.session = session
async def get(self, id: int) -> Optional[T]:
return await self.session.get(self.model, id)
async def get_all(self) -> List[T]:
statement = select(self.model)
result = await self.session.execute(statement)
return result.scalars().all()
Next steps
- Update the
DATABASE_URLin your.envfile with your PostgreSQL credentials. - Run
uv run alembic upgrade headto apply the initial schema. - Execute
uv run pytestto verify the testing infrastructure is working.
Connects securely to your tools. The creator never sees your data.
About this skill
Starting a new FastAPI project often leads to hours of boilerplate setup for async database drivers, migration configs, and testing utilities. This skill automates the creation of a production-ready async FastAPI foundation using modern Python tooling.
What it does
- Bootstraps project structure following a modular architecture with clear separation of concerns.
- Configures async SQL using SQLAlchemy or SQLModel with engines like PostgreSQL, MySQL, or SQLite.
- Sets up migrations through Alembic with pre-configured async templates and auto-generation commands.
- Implements generic CRUD via a base repository pattern to eliminate repetitive data access code.
- Automates testing setup including
pytest,pytest-asyncio, and a dedicatedconftest.pyfor async endpoint testing.
How it works
- Evaluation: Scans your directory for existing files to prevent accidental overwrites and identify conflicts.
- Configuration: Prompts for project name, database engine, Python version, and testing preferences.
- Scaffolding: Initializes the environment with
uv, installs dependencies, and generates the core directory structure. - Implementation: Writes config, database connection, main entry point, and repository files.
- Validation: Cross-references the generated codebase against architectural references to ensure consistency.
Frameworks & tools
Built for Python 3.12+ using FastAPI, SQLAlchemy, SQLModel, Alembic, and Pydantic. It relies on uv for lightning-fast package management and pytest for the testing suite.
Why this beats prompting it yourself
Prompting an LLM for a FastAPI setup usually results in a single-file "main.py" that doesn't scale. This skill enforces a professional multi-file architecture, correctly configures the tricky asyncio parts of Alembic, and ensures your repository pattern is typesafe from day one.
Use cases
- Scaffold a new microservice with PostgreSQL and async-driver support.
- Add a standardized testing layer to an existing FastAPI codebase.
- Migrate a synchronous SQLAlchemy setup to an asynchronous SQLModel architecture.
- Benchmark your current project structure against FastAPI best practices.
Known limitations
Requires uv to be installed on the host machine. Database drivers like asyncpg or aiosqlite must be manually verified if using non-standard SQL engines.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Requires 'uv' package manager. DB migrations via Alembic require manual environment variable updates to run against live instances. Driver support focused on asyncpg and aiosqlite.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 4 days ago
- Free with an Agensi account
- Software
Python
Permissions
Allowed Hosts