advanced-alchemy

Generate SQLAlchemy models, repositories, and services for Python web frameworks.

13|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/litestar-org/litestar-skills --skill advanced-alchemy-litestar-org
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: advanced-alchemy
Source: https://github.com/litestar-org/litestar-skills/tree/main/plugins/litestar/skills/advanced-alchemy
Command: npx skills add https://github.com/litestar-org/litestar-skills --skill advanced-alchemy-litestar-org

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the tedious, error-prone work of manually implementing SQLAlchemy boilerplate (repository patterns, service layers, session management, and migration setup) for web applications, especially when integrating with frameworks like Litestar, FastAPI, Flask, Sanic, or Starlette.

Core Features & Use Cases

  • Opinionated Base Models: Auto-generated IDs, audit timestamps, and mixins for slugs, unique constraints, and optimistic locking, reducing model definition boilerplate.
  • Built-in Repository & Service Layers: Async CRUD operations with lifecycle hooks for business logic, eliminating repetitive data access code.
  • Multi-Framework Integration: First-party plugins for Litestar, FastAPI, Flask, Sanic, and Starlette with automatic session management, dependency injection, and Alembic CLI support.
  • Use Case: A developer building a Litestar e-commerce API can use this Skill to instantly generate model, repository, and service code for orders and products, with automatic session handling and migration support, cutting development time significantly.

Quick Start

Use the advanced-alchemy skill to generate a complete UUIDAuditBase model, async repository, and service layer for a new 'Product' entity with slug support and Alembic migration setup for your Litestar application.

Frequently Asked Questions about advanced-alchemy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up async SQLAlchemy CRUD operations in a FastAPI or Litestar application?

You can use built-in repository and service layers to implement async SQLAlchemy CRUD operations, which provide lifecycle hooks for business logic and eliminate repetitive data access boilerplate across FastAPI, Litestar, and other frameworks.

What is the best way to implement the repository pattern and service layer in SQLAlchemy?

The best way to implement the repository pattern and service layer is by using opinionated base models and async CRUD operations with lifecycle hooks, which automatically handle data access code and business logic separation for SQLAlchemy-backed web applications.

Can I use advanced-alchemy to manage Alembic migrations and database sessions automatically?

Yes, you can automatically manage Alembic migrations and database sessions, as the Skill provides first-party plugins with automatic session and transaction management for Litestar, FastAPI, Flask, Sanic, and Starlette.

Does this SQLAlchemy service layer support multiple Python web frameworks besides Litestar?

Yes, the SQLAlchemy service layer supports multiple Python web frameworks besides Litestar, offering first-party plugins with dependency injection and session management for FastAPI, Flask, Sanic, and Starlette.

How do I generate SQLAlchemy models with audit trails and UUID primary keys?

You can generate SQLAlchemy models with audit trails and UUID primary keys by using opinionated base models, which provide auto-generated IDs, audit timestamps, and mixins for slugs, unique constraints, and optimistic locking.

What are the limitations of using built-in repository and service layers for async CRUD operations?

The limitations of using built-in repository and service layers for async CRUD operations are not explicitly documented, but the approach is highly opinionated, meaning developers must adapt to its specific base models, lifecycle hooks, and cross-database compatibility constraints.