{"id":"1e61fac9-083a-4427-8310-20986a3cbc34","shortId":"LTHKWy","kind":"skill","title":"advanced-alchemy","tagline":"Auto-activate for alembic/, alembic.ini, advanced_alchemy imports, SQLAlchemyAsyncRepositoryService, SQLAlchemyAsyncConfig, UUIDAuditBase, repository_type, service_class, or web framework Advanced Alchemy extensions. Use when working with Advanced Alchemy ORM models, repositories","description":"# Advanced Alchemy\n\n## Match-Your-Framework — read first\n\nadvanced-alchemy ships first-party extensions for five web frameworks. If your project uses one of these, **jump directly to the matching integration guide and skip the others**:\n\n- **Litestar** — `SQLAlchemyPlugin` with full DI, session store, CLI. The rest of this SKILL.md covers Litestar by default; also see [`references/litestar_plugin.md`](references/litestar_plugin.md).\n- **FastAPI** → [`references/fastapi-integration.md`](references/fastapi-integration.md) — `AdvancedAlchemy(config=..., app=app)`, `Depends(alchemy.provide_session())` DI, `provide_service()`/`provide_filters()`, Alembic CLI via `assign_cli_group`.\n- **Flask** → [`references/flask-integration.md`](references/flask-integration.md) — `AdvancedAlchemy(config=..., app=app)` or `init_app()` factory, pull-based `alchemy.get_sync_session()`, async-via-portal.\n- **Sanic** → [`references/sanic-integration.md`](references/sanic-integration.md) — `AdvancedAlchemy(sqlalchemy_config=..., sanic_app=app)` (note: `sqlalchemy_config=` kwarg, not `config=`), sanic-ext DI, `request.ctx` sessions.\n- **Starlette** → [`references/starlette-integration.md`](references/starlette-integration.md) — `AdvancedAlchemy(config=..., app=app)`, `request.state` session access, lifespan wrapping.\n\nShared topics that apply to every framework live in [`references/commit-modes.md`](references/commit-modes.md) (`commit_mode=\"manual\"` / `\"autocommit\"` / `\"autocommit_include_redirect\"`) and [`references/multi-database.md`](references/multi-database.md) (bind-key pattern). Read the framework guide first, then those for depth.\n\nThe rest of this SKILL.md covers framework-agnostic topics: base classes, repositories, services, filters, custom types, caching, replicas, operations, and Alembic migrations.\n\n## Overview\n\nAdvanced Alchemy is NOT a raw ORM — it is a **service/repository layer** built on top of SQLAlchemy 2.0+ with opinionated base classes, audit mixins, and deep framework integrations (Litestar, FastAPI, Flask, Sanic). It provides:\n\n- **Base models** with automatic `id`, `created_at`, `updated_at` fields\n- **Repository pattern** for type-safe async CRUD\n- **Service layer** with lifecycle hooks (`to_model_on_create`, `to_model_on_update`)\n- **Framework plugins** for automatic session/transaction management\n- **Custom types**: `EncryptedString`, `FileObject`, `DateTimeUTC`, `GUID`\n- **Alembic integration** for migrations via CLI\n\n## Quick Reference\n\n### Base Classes\n\n| Base Class | PK Type | Audit Columns | When to Use |\n| --- | --- | --- | --- |\n| `UUIDAuditBase` | UUID v4 | `created_at`, `updated_at` | Default choice for most models |\n| `UUIDBase` | UUID v4 | None | Lookup tables, tags, no audit needed |\n| `UUIDv7AuditBase` | UUID v7 | `created_at`, `updated_at` | Time-sortable IDs (preferred over v6) |\n| `BigIntAuditBase` | BigInt auto-increment | `created_at`, `updated_at` | Legacy systems, integer PKs |\n| `NanoidAuditBase` | Nanoid string | `created_at`, `updated_at` | URL-friendly short IDs |\n| `DeclarativeBase` | None (define yourself) | None | Full schema control |\n\n### Repository Pattern\n\n| Repository | Purpose |\n| --- | --- |\n| `SQLAlchemyAsyncRepository[Model]` | Standard async CRUD |\n| `SQLAlchemyAsyncSlugRepository[Model]` | CRUD + automatic slug generation |\n| `SQLAlchemyAsyncQueryRepository` | Complex read-only queries (no model_type) |\n\n### Service Layer\n\n| Service | Purpose |\n| --- | --- |\n| `SQLAlchemyAsyncRepositoryService[Model]` | Full CRUD with lifecycle hooks |\n| `SQLAlchemyAsyncRepositoryReadService[Model]` | Read-only (list, get, count, exists) |\n\nKey lifecycle hooks: `to_model_on_create`, `to_model_on_update`, `to_model_on_upsert`.\n\n## Custom Types\n\n| Type | Purpose | Notes |\n| --- | --- | --- |\n| `FileObject` | Object storage with lifecycle hooks | Tracks file state across session; auto-deletes on row delete via `StoredObject` tracker |\n| `PasswordHash` | Hashed password storage | Supports Argon2, Passlib, and Pwdlib backends; hashes on assignment |\n| `EncryptedString` | Transparent AES encryption at rest | Requires `ENCRYPTION_KEY` in config |\n| `UUID6` / `UUID7` | Time-sortable UUID variants | UUID7 preferred — monotonic ordering with millisecond timestamp prefix |\n| `DateTimeUTC` | Timezone-aware UTC datetime | Stores as UTC; raises on naive datetimes |\n\n## Repository Service Layer\n\n`SQLAlchemyAsyncRepositoryService` is the primary service base class. Key behaviors:\n\n- **Dict-to-model conversion**: pass raw `dict` to `create()`, `update()`, `upsert()` — the service converts via `to_model_on_create` / `to_model_on_update` lifecycle hooks before persistence\n- **Bulk operations**: `add_many(data)`, `update_many(data)`, `delete_many(filters)` — batched in a single transaction; prefer over calling single-row methods in a loop\n- **Lifecycle hooks**: `to_model_on_create`, `to_model_on_update`, `to_model_on_upsert` — override to transform input data, hash passwords, normalize strings, etc.\n\n## Mixins\n\n| Mixin | Fields Added | When to Use |\n| --- | --- | --- |\n| `AuditMixin` | `created_at`, `updated_at`, `created_by`, `updated_by` | Any model needing a full audit trail (who + when) |\n| `SlugMixin` | `slug` (auto-generated) | URL-friendly identifiers derived from another field |\n| `UniqueMixin` | `get_or_create` class method | Idempotent inserts for lookup/reference tables |\n| `SentinelMixin` | `_sentinel` version column | Optimistic locking; raises `ConflictError` on stale writes |\n\n## Litestar Integration\n\nUse `SQLAlchemyPlugin` (composite of `SQLAlchemyInitPlugin` + `SQLAlchemySerializationPlugin`) for full integration:\n\n- **`SQLAlchemyPlugin`**: registers session provider, transaction middleware, and ORM type encoders in one call\n- **`SQLAlchemyDTO`**: generates Litestar DTOs directly from ORM models with `include`/`exclude` field control\n- **Type encoders**: automatic serialization of `datetime`, `UUID`, `Decimal`, `Enum`, and custom column types\n- **Exception handling**: `RepositoryError`, `ConflictError`, and `NotFoundError` map to HTTP 409/404 via built-in exception handlers — register with `app.exception_handlers`\n\n## Code Style\n\n- `__slots__` on non-model classes, `Mapped[]` typing for all columns\n- `T | None` for optional fields (PEP 604 unions, never `Optional[T]`)\n- Full type annotations on all function signatures\n- Inner `Repo` class pattern inside service definitions\n- Prefer `advanced_alchemy.*` imports; avoid deprecated `litestar.plugins.sqlalchemy` paths\n- **`from __future__ import annotations` rule** — Advanced Alchemy model modules **avoid** `from __future__ import annotations` because SQLAlchemy 2.0 `Mapped[...]` columns are introspected at class-creation time. Consumer application modules (handlers, services, tests) MAY and typically SHOULD use it — canonical Litestar apps use it in 100+ files.\n\n<workflow>\n\n## Workflow\n\n### Step 1: Define the Model\n\nChoose the appropriate base class from the quick reference table. Use `UUIDAuditBase` unless you have a specific reason not to. Define columns with `Mapped[]` typing.\n\n### Step 2: Create the Repository\n\nCreate a repository class with `model_type` set to your model. Use `SQLAlchemyAsyncRepository` for standard CRUD, `SQLAlchemyAsyncSlugRepository` if the model uses `SlugKey`.\n\n### Step 3: Build the Service\n\nCreate a service class with an inner `Repo` class. Set `match_fields` for upsert logic. Add lifecycle hooks (`to_model_on_create`, `to_model_on_update`) for business logic transformations.\n\n### Step 4: Wire into Framework\n\nUse the framework plugin (Litestar, FastAPI, Flask, Sanic) to inject sessions and register the service as a dependency.\n\n### Step 5: Generate Migration\n\nRun `alembic revision --autogenerate -m \"description\"` to create the migration, then review and apply with `alembic upgrade head`.\n\n</workflow>\n\n<guardrails>\n\n## Guardrails\n\n- **Always use the service layer for business logic** — never put validation, hashing, or transformation logic directly in route handlers or repositories\n- **Repositories are for data access only** — no business rules, no side effects beyond database operations\n- **Never bypass the service layer** to call repository methods directly from handlers\n- **Always set `match_fields`** on services that use `upsert()` to avoid duplicate-key errors\n- **Use `schema_dump()` to convert DTOs** (Pydantic/msgspec/attrs) before passing to service methods\n- **Prefer `UUIDAuditBase`** as default base class — only deviate when you have a concrete reason\n- **Use `advanced_alchemy.*` imports** — the old `litestar.plugins.sqlalchemy` paths are deprecated\n- **Model modules avoid `from __future__ import annotations`** — SQLAlchemy 2.0 needs the real `Mapped[...]` type at class-creation time. Consumer modules (handlers, services, tests) MAY use it.\n\n</guardrails>\n\n<validation>\n\n### Validation Checkpoint\n\nBefore delivering code, verify:\n\n- [ ] Model inherits from an Advanced Alchemy base class (not raw `DeclarativeBase` from SQLAlchemy)\n- [ ] All columns use `Mapped[]` type annotations\n- [ ] Service has an inner `Repo` class with `model_type` set\n- [ ] Business logic lives in service lifecycle hooks, not in route handlers\n- [ ] Imports come from `advanced_alchemy.*`, not deprecated paths\n- [ ] Model module does NOT use `from __future__ import annotations` (consumer modules may)\n\n</validation>\n\n<example>\n\n## Example\n\nA complete `Tag` entity with model, repository, and service:\n\n```python\n\"\"\"Tag domain — model, repository, and service.\"\"\"\n\nfrom advanced_alchemy.base import UUIDAuditBase\nfrom advanced_alchemy.repository import SQLAlchemyAsyncRepository\nfrom advanced_alchemy.service import SQLAlchemyAsyncRepositoryService\nfrom sqlalchemy.orm import Mapped, mapped_column\n\n\nclass Tag(UUIDAuditBase):\n    \"\"\"Tag model with audit trail.\"\"\"\n\n    __tablename__ = \"tag\"\n\n    name: Mapped[str] = mapped_column(unique=True)\n    description: Mapped[str | None] = mapped_column(default=None)\n\n\nclass TagRepository(SQLAlchemyAsyncRepository[Tag]):\n    \"\"\"Data access for tags.\"\"\"\n\n    model_type = Tag\n\n\nclass TagService(SQLAlchemyAsyncRepositoryService[Tag]):\n    \"\"\"Business logic for tags.\"\"\"\n\n    class Repo(SQLAlchemyAsyncRepository[Tag]):\n        model_type = Tag\n\n    repository_type = Repo\n    match_fields = [\"name\"]\n\n    async def to_model_on_create(self, data):\n        \"\"\"Normalize tag name before creation.\"\"\"\n        if isinstance(data, dict) and \"name\" in data:\n            data[\"name\"] = data[\"name\"].strip().lower()\n        return data\n```\n\n</example>\n\n---\n\n## References Index\n\n> **Choosing between `advanced-alchemy` and `sqlspec`:** `advanced-alchemy` (this skill) gives you an opinionated ORM service layer with `UUIDAuditBase`, lifecycle hooks, repository / service / Alembic integration, and `OffsetPagination[T]` out of the box — pick it when you want a complete CRUD surface with attribute-style row access and you're happy inside the SQLAlchemy ecosystem. `sqlspec` gives you direct SQL control, 15+ driver adapters (asyncpg, oracledb, DuckDB, BigQuery, SQLite, and more), Arrow-native result streams for analytics, and a builder API when you need it — pick it when you want explicit SQL, heterogeneous database backends, or Arrow integration. Both skills integrate with Litestar via first-party plugins; see [`../sqlspec/SKILL.md`](../sqlspec/SKILL.md) for the raw-SQL / multi-adapter path.\n\nFor detailed guides and code examples, refer to the following documents in `references/`:\n\n- **[Models](references/models.md)**\n  Base classes, mixins, special types, relationships, PII tracking, and deferred loading.\n- **[Repositories](references/repositories.md)**\n  Async repository variants, configuration, slug repos, and query repos.\n- **[Services](references/services.md)**\n  Service layer, lifecycle hooks, composite services, filtering, and pagination.\n- **[Litestar Plugin](references/litestar_plugin.md)**\n  SQLAlchemy plugin config, DTOs, dependency injection, and session management.\n- **[Migrations](references/migrations.md)**\n  Alembic integration, CLI commands, metadata registry, and multi-database support.\n- **[Types](references/types.md)**\n  Complete catalog of custom column types: EncryptedString, FileObject, DateTimeUTC, GUID, PasswordHash, ColorType, and more.\n- **[Base Classes](references/bases.md)**\n  Declarative base classes, UUID/BigInt/Nanoid variants, audit mixins, SlugKey, UniqueMixin, metadata registry, and custom base creation.\n- **[Filters](references/filters.md)**\n  Filter system, pagination, SearchFilter, CollectionFilter, BeforeAfter, OrderBy, LimitOffset, and frontend integration patterns.\n- **[Framework Integrations](references/frameworks.md)**\n  FastAPI, Flask, Starlette, and Sanic plugin setup, session management, and feature comparison across frameworks.\n- **[Caching](references/caching.md)**\n  Dogpile.cache integration, CacheConfig, CacheManager API, automatic cache invalidation via session events, version-based list cache keys, singleflight stampede protection, and serialization.\n- **[Read Replicas](references/replicas.md)**\n  Read/write routing, RoutingConfig, engine groups, RoundRobinSelector/RandomSelector, sticky-after-write consistency, context managers for explicit routing, and RoutingAsyncSessionMaker.\n- **[Storage (obstore)](references/storage.md)**\n  FileObject and StoredObject types, ObstoreBackend and FSSpecBackend configuration (S3, GCS, Azure, local), StorageRegistry, presigned URL generation, automatic file lifecycle via session tracker, and Pydantic integration.\n- **[Operations, Listeners, Serialization](references/operations.md)**\n  `OnConflictUpsert` / `MergeStatement` dialect-aware upsert building blocks, session event listeners (FileObject, cache invalidation, `touch_updated_timestamp`), and the msgspec-first `encode_json` / `decode_json` used across the library.\n\n---\n\n## Official References\n\n- <https://advanced-alchemy.litestar.dev/latest/>\n- <https://advanced-alchemy.litestar.dev/latest/usage/services.html>\n- <https://advanced-alchemy.litestar.dev/latest/usage/cli.html>\n- <https://advanced-alchemy.litestar.dev/latest/usage/modeling/types.html>\n- <https://advanced-alchemy.litestar.dev/latest/reference/types.html>\n- <https://advanced-alchemy.litestar.dev/latest/changelog.html>\n- <https://docs.litestar.dev/2/release-notes/changelog.html>\n- <https://docs.sqlalchemy.org/en/20/orm/quickstart.html>\n\n## Shared Styleguide Baseline\n\n- Use shared styleguides for generic language/framework rules to reduce duplication in this skill.\n- [General Principles](../litestar-styleguide/references/general.md)\n- [Python](../litestar-styleguide/references/python.md)\n- [Litestar](../litestar-styleguide/references/litestar.md)\n- Keep this skill focused on tool-specific workflows, edge cases, and integration details.","tags":["advanced","alchemy","litestar","skills","litestar-org","advanced-alchemy","agent-skills","agentskills","ai-agents","claude-code-plugin","claude-code-skills","gemini-cli-extension"],"capabilities":["skill","source-litestar-org","skill-advanced-alchemy","topic-advanced-alchemy","topic-agent-skills","topic-agentskills","topic-ai-agents","topic-claude-code-plugin","topic-claude-code-skills","topic-gemini-cli-extension","topic-htmx","topic-inertia","topic-litestar","topic-mcp","topic-python"],"categories":["litestar-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/litestar-org/litestar-skills/advanced-alchemy","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add litestar-org/litestar-skills","source_repo":"https://github.com/litestar-org/litestar-skills","install_from":"skills.sh"}},"qualityScore":"0.453","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (14,789 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:13:53.072Z","embedding":null,"createdAt":"2026-05-18T13:20:56.179Z","updatedAt":"2026-05-18T19:13:53.072Z","lastSeenAt":"2026-05-18T19:13:53.072Z","tsv":"'/2/release-notes/changelog.html':1684 '/en/20/orm/quickstart.html':1687 '/latest/':1666 '/latest/changelog.html':1681 '/latest/reference/types.html':1678 '/latest/usage/cli.html':1672 '/latest/usage/modeling/types.html':1675 '/latest/usage/services.html':1669 '/litestar-styleguide/references/general.md':1706 '/litestar-styleguide/references/litestar.md':1710 '/litestar-styleguide/references/python.md':1708 '/sqlspec/skill.md':1406,1407 '1':842 '100':838 '15':1357 '2':872 '2.0':244,810,1086 '3':899 '4':934 '409/404':737 '5':957 '604':767 'access':166,1004,1236,1342 'across':465,1553,1659 'activ':6 'ad':621 'adapt':1359,1415 'add':570,918 'advanc':2,10,23,30,35,44,227,787,799,1069,1115,1154,1297,1302 'advanced-alchemi':1,43,1296,1301 'advanced-alchemy.litestar.dev':1665,1668,1671,1674,1677,1680 'advanced-alchemy.litestar.dev/latest/':1664 'advanced-alchemy.litestar.dev/latest/changelog.html':1679 'advanced-alchemy.litestar.dev/latest/reference/types.html':1676 'advanced-alchemy.litestar.dev/latest/usage/cli.html':1670 'advanced-alchemy.litestar.dev/latest/usage/modeling/types.html':1673 'advanced-alchemy.litestar.dev/latest/usage/services.html':1667 'advanced_alchemy.base':1189 'advanced_alchemy.repository':1193 'advanced_alchemy.service':1197 'advancedalchemi':97,118,139,160 'ae':491 'agnost':211 'alchemi':3,11,24,31,36,45,228,788,800,1070,1116,1155,1298,1303 'alchemy.get':129 'alchemy.provide':102 'alemb':8,109,224,304,961,975,1319,1479 'alembic.ini':9 'also':90 'alway':979,1027 'analyt':1373 'annot':774,797,807,1084,1129,1167 'anoth':654 'api':1377,1561 'app':99,100,120,121,124,143,144,162,163,834 'app.exception':746 'appli':172,973 'applic':821 'appropri':848 'argon2':481 'arrow':1368,1393 'arrow-n':1367 'assign':112,488 'async':133,277,399,1263,1445 'async-via-port':132 'asyncpg':1360 'attribut':1339 'attribute-styl':1338 'audit':249,318,343,639,1212,1514 'auditmixin':625 'auto':5,362,468,646 'auto-activ':4 'auto-delet':467 'auto-gener':645 'auto-incr':361 'autocommit':183,184 'autogener':963 'automat':264,295,404,717,1562,1619 'avoid':790,803,1037,1080 'awar':518,1636 'azur':1613 'backend':485,1391 'base':128,213,247,261,312,314,536,849,1058,1117,1432,1506,1510,1522,1570 'baselin':1690 'batch':579 'beforeaft':1531 'behavior':539 'beyond':1012 'bigint':360 'bigintauditbas':359 'bigqueri':1363 'bind':191 'bind-key':190 'block':1639 'box':1327 'build':900,1638 'builder':1376 'built':239,740 'built-in':739 'bulk':568 'busi':930,985,1007,1140,1246 'bypass':1016 'cach':220,1555,1563,1572,1644 'cacheconfig':1559 'cachemanag':1560 'call':586,701,1021 'canon':832 'case':1721 'catalog':1493 'checkpoint':1106 'choic':331 'choos':846,1294 'class':19,214,248,313,315,537,660,755,781,817,850,879,906,911,1059,1094,1118,1135,1206,1231,1242,1250,1433,1507,1511 'class-creat':816,1093 'cli':80,110,113,309,1481 'code':748,1109,1421 'collectionfilt':1530 'colortyp':1503 'column':319,670,726,760,812,867,1125,1205,1220,1228,1496 'come':1152 'command':1482 'commit':180 'comparison':1552 'complet':1173,1334,1492 'complex':408 'composit':682,1460 'concret':1066 'config':98,119,141,147,150,161,499,1470 'configur':1448,1610 'conflicterror':674,731 'consist':1592 'consum':820,1097,1168 'context':1593 'control':391,714,1356 'convers':544 'convert':554,1046 'count':434 'cover':86,208 'creat':266,287,326,348,364,375,442,549,559,599,626,630,659,873,876,903,924,967,1268 'creation':818,1095,1275,1523 'crud':278,400,403,423,891,1335 'custom':218,298,451,725,1495,1521 'data':572,575,612,1003,1235,1270,1278,1283,1284,1286,1291 'databas':1013,1390,1488 'datetim':520,527,720 'datetimeutc':302,515,1500 'decim':722 'declar':1509 'declarativebas':384,1121 'decod':1656 'deep':252 'def':1264 'default':89,330,1057,1229 'defer':1441 'defin':386,843,866 'definit':785 'delet':469,472,576 'deliv':1108 'depend':101,955,1472 'deprec':791,1077,1157 'depth':202 'deriv':652 'descript':965,1223 'detail':1418,1724 'deviat':1061 'di':77,104,154 'dialect':1635 'dialect-awar':1634 'dict':541,547,1279 'dict-to-model':540 'direct':63,706,994,1024,1354 'docs.litestar.dev':1683 'docs.litestar.dev/2/release-notes/changelog.html':1682 'docs.sqlalchemy.org':1686 'docs.sqlalchemy.org/en/20/orm/quickstart.html':1685 'document':1427 'dogpile.cache':1557 'domain':1183 'driver':1358 'dtos':705,1047,1471 'duckdb':1362 'dump':1044 'duplic':1039,1700 'duplicate-key':1038 'ecosystem':1350 'edg':1720 'effect':1011 'encod':698,716,1654 'encrypt':492,496 'encryptedstr':300,489,1498 'engin':1585 'entiti':1175 'enum':723 'error':1041 'etc':617 'event':1567,1641 'everi':174 'exampl':1171,1422 'except':728,742 'exclud':712 'exist':435 'explicit':1387,1596 'ext':153 'extens':25,50 'factori':125 'fastapi':94,256,943,1541 'featur':1551 'field':270,620,655,713,765,914,1030,1261 'file':463,839,1620 'fileobject':301,456,1499,1603,1643 'filter':108,217,578,1462,1524,1526 'first':42,48,198,1402,1653 'first-parti':47,1401 'five':52 'flask':115,257,944,1542 'focus':1714 'follow':1426 'framework':22,40,54,175,196,210,253,292,937,940,1538,1554 'framework-agnost':209 'friend':381,650 'frontend':1535 'fsspecbackend':1609 'full':76,389,422,638,687,772 'function':777 'futur':795,805,1082,1165 'gcs':1612 'general':1704 'generat':406,647,703,958,1618 'generic':1695 'get':433,657 'give':1306,1352 'group':114,1586 'guardrail':978 'guid':68,197,303,1419,1501 'handl':729 'handler':743,747,823,997,1026,1099,1150 'happi':1346 'hash':477,486,613,990 'head':977 'heterogen':1389 'hook':283,426,438,461,565,595,920,1146,1316,1459 'http':736 'id':265,355,383 'idempot':662 'identifi':651 'import':12,789,796,806,1071,1083,1151,1166,1190,1194,1198,1202 'includ':185,711 'increment':363 'index':1293 'inherit':1112 'init':123 'inject':947,1473 'inner':779,909,1133 'input':611 'insert':663 'insid':783,1347 'integ':370 'integr':67,254,305,679,688,1320,1394,1397,1480,1536,1539,1558,1627,1723 'introspect':814 'invalid':1564,1645 'isinst':1277 'json':1655,1657 'jump':62 'keep':1711 'key':192,436,497,538,1040,1573 'kwarg':148 'language/framework':1696 'layer':238,280,417,530,983,1019,1312,1457 'legaci':368 'librari':1661 'lifecycl':282,425,437,460,564,594,919,1145,1315,1458,1621 'lifespan':167 'limitoffset':1533 'list':432,1571 'listen':1629,1642 'litestar':73,87,255,678,704,833,942,1399,1465,1709 'litestar.plugins.sqlalchemy':792,1074 'live':176,1142 'load':1442 'local':1614 'lock':672 'logic':917,931,986,993,1141,1247 'lookup':339 'lookup/reference':665 'loop':593 'lower':1289 'm':964 'manag':297,1476,1549,1594 'mani':571,574,577 'manual':182 'map':734,756,811,869,1090,1127,1203,1204,1217,1219,1224,1227 'match':38,66,913,1029,1260 'match-your-framework':37 'may':826,1102,1170 'mergestat':1633 'metadata':1483,1518 'method':590,661,1023,1053 'middlewar':694 'migrat':225,307,959,969,1477 'millisecond':512 'mixin':250,618,619,1434,1515 'mode':181 'model':33,262,285,289,334,397,402,414,421,428,440,444,448,543,557,561,597,601,605,635,709,754,801,845,881,886,895,922,926,1078,1111,1137,1159,1177,1184,1210,1239,1254,1266,1430 'modul':802,822,1079,1098,1160,1169 'monoton':509 'msgspec':1652 'msgspec-first':1651 'multi':1414,1487 'multi-adapt':1413 'multi-databas':1486 'naiv':526 'name':1216,1262,1273,1281,1285,1287 'nanoid':373 'nanoidauditbas':372 'nativ':1369 'need':344,636,1087,1380 'never':769,987,1015 'non':753 'non-model':752 'none':338,385,388,762,1226,1230 'normal':615,1271 'note':145,455 'notfounderror':733 'object':457 'obstor':1601 'obstorebackend':1607 'offici':1662 'offsetpagin':1322 'old':1073 'onconflictupsert':1632 'one':59,700 'oper':222,569,1014,1628 'opinion':246,1309 'optimist':671 'option':764,770 'oracledb':1361 'order':510 'orderbi':1532 'orm':32,233,696,708,1310 'other':72 'overrid':608 'overview':226 'pagin':1464,1528 'parti':49,1403 'pass':545,1050 'passlib':482 'password':478,614 'passwordhash':476,1502 'path':793,1075,1158,1416 'pattern':193,272,393,782,1537 'pep':766 'persist':567 'pick':1328,1382 'pii':1438 'pk':316 'pks':371 'plugin':293,941,1404,1466,1469,1546 'portal':135 'prefer':356,508,584,786,1054 'prefix':514 'presign':1616 'primari':534 'principl':1705 'project':57 'protect':1576 'provid':105,107,260,692 'pull':127 'pull-bas':126 'purpos':395,419,454 'put':988 'pwdlib':484 'pydant':1626 'pydantic/msgspec/attrs':1048 'python':1181,1707 'queri':412,1452 'quick':310,853 'rais':524,673 'raw':232,546,1120,1411 'raw-sql':1410 're':1345 'read':41,194,410,430,1579 'read-on':409,429 'read/write':1582 'real':1089 'reason':863,1067 'redirect':186 'reduc':1699 'refer':311,854,1292,1423,1429,1663 'references/bases.md':1508 'references/caching.md':1556 'references/commit-modes.md':178,179 'references/fastapi-integration.md':95,96 'references/filters.md':1525 'references/flask-integration.md':116,117 'references/frameworks.md':1540 'references/litestar_plugin.md':92,93,1467 'references/migrations.md':1478 'references/models.md':1431 'references/multi-database.md':188,189 'references/operations.md':1631 'references/replicas.md':1581 'references/repositories.md':1444 'references/sanic-integration.md':137,138 'references/services.md':1455 'references/starlette-integration.md':158,159 'references/storage.md':1602 'references/types.md':1491 'regist':690,744,950 'registri':1484,1519 'relationship':1437 'replica':221,1580 'repo':780,910,1134,1251,1259,1450,1453 'repositori':16,34,215,271,392,394,528,875,878,999,1000,1022,1178,1185,1257,1317,1443,1446 'repositoryerror':730 'request.ctx':155 'request.state':164 'requir':495 'rest':82,204,494 'result':1370 'return':1290 'review':971 'revis':962 'roundrobinselector/randomselector':1587 'rout':996,1149,1583,1597 'routingasyncsessionmak':1599 'routingconfig':1584 'row':471,589,1341 'rule':798,1008,1697 'run':960 's3':1611 'safe':276 'sanic':136,142,152,258,945,1545 'sanic-ext':151 'schema':390,1043 'searchfilt':1529 'see':91,1405 'self':1269 'sentinel':668 'sentinelmixin':667 'serial':718,1578,1630 'servic':18,106,216,279,416,418,529,535,553,784,824,902,905,952,982,1018,1032,1052,1100,1130,1144,1180,1187,1311,1318,1454,1456,1461 'service/repository':237 'session':78,103,131,156,165,466,691,948,1475,1548,1566,1623,1640 'session/transaction':296 'set':883,912,1028,1139 'setup':1547 'share':169,1688,1692 'ship':46 'short':382 'side':1010 'signatur':778 'singl':582,588 'single-row':587 'singleflight':1574 'skill':1305,1396,1703,1713 'skill-advanced-alchemy' 'skill.md':85,207 'skip':70 'slot':750 'slug':405,644,1449 'slugkey':897,1516 'slugmixin':643 'sortabl':354,504 'source-litestar-org' 'special':1435 'specif':862,1718 'sql':1355,1388,1412 'sqlalchemi':140,146,243,809,1085,1123,1349,1468 'sqlalchemy.orm':1201 'sqlalchemyasyncconfig':14 'sqlalchemyasyncqueryrepositori':407 'sqlalchemyasyncrepositori':396,888,1195,1233,1252 'sqlalchemyasyncrepositoryreadservic':427 'sqlalchemyasyncrepositoryservic':13,420,531,1199,1244 'sqlalchemyasyncslugrepositori':401,892 'sqlalchemydto':702 'sqlalchemyinitplugin':684 'sqlalchemyplugin':74,681,689 'sqlalchemyserializationplugin':685 'sqlite':1364 'sqlspec':1300,1351 'stale':676 'stamped':1575 'standard':398,890 'starlett':157,1543 'state':464 'step':841,871,898,933,956 'sticki':1589 'sticky-after-writ':1588 'storag':458,479,1600 'storageregistri':1615 'store':79,521 'storedobject':474,1605 'str':1218,1225 'stream':1371 'string':374,616 'strip':1288 'style':749,1340 'styleguid':1689,1693 'support':480,1489 'surfac':1336 'sync':130 'system':369,1527 'tabl':340,666,855 'tablenam':1214 'tag':341,1174,1182,1207,1209,1215,1234,1238,1241,1245,1249,1253,1256,1272 'tagrepositori':1232 'tagservic':1243 'test':825,1101 'time':353,503,819,1096 'time-sort':352,502 'timestamp':513,1648 'timezon':517 'timezone-awar':516 'tool':1717 'tool-specif':1716 'top':241 'topic':170,212 'topic-advanced-alchemy' 'topic-agent-skills' 'topic-agentskills' 'topic-ai-agents' 'topic-claude-code-plugin' 'topic-claude-code-skills' 'topic-gemini-cli-extension' 'topic-htmx' 'topic-inertia' 'topic-litestar' 'topic-mcp' 'topic-python' 'touch':1646 'track':462,1439 'tracker':475,1624 'trail':640,1213 'transact':583,693 'transform':610,932,992 'transpar':490 'true':1222 'type':17,219,275,299,317,415,452,453,697,715,727,757,773,870,882,1091,1128,1138,1240,1255,1258,1436,1490,1497,1606 'type-saf':274 'typic':828 'union':768 'uniqu':1221 'uniquemixin':656,1517 'unless':858 'updat':268,291,328,350,366,377,446,550,563,573,603,628,632,928,1647 'upgrad':976 'upsert':450,551,607,916,1035,1637 'url':380,649,1617 'url-friend':379,648 'use':26,58,322,624,680,830,835,856,887,896,938,980,1034,1042,1068,1103,1126,1163,1658,1691 'utc':519,523 'uuid':324,336,346,505,721 'uuid/bigint/nanoid':1512 'uuid6':500 'uuid7':501,507 'uuidauditbas':15,323,857,1055,1191,1208,1314 'uuidbas':335 'uuidv7auditbase':345 'v4':325,337 'v6':358 'v7':347 'valid':989,1105 'variant':506,1447,1513 'verifi':1110 'version':669,1569 'version-bas':1568 'via':111,134,308,473,555,738,1400,1565,1622 'want':1332,1386 'web':21,53 'wire':935 'work':28 'workflow':840,1719 'wrap':168 'write':677,1591","prices":[{"id":"178f9b9b-66bd-434b-a7b7-0e74162e33df","listingId":"1e61fac9-083a-4427-8310-20986a3cbc34","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"litestar-org","category":"litestar-skills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:20:56.179Z"}],"sources":[{"listingId":"1e61fac9-083a-4427-8310-20986a3cbc34","source":"github","sourceId":"litestar-org/litestar-skills/advanced-alchemy","sourceUrl":"https://github.com/litestar-org/litestar-skills/tree/main/skills/advanced-alchemy","isPrimary":false,"firstSeenAt":"2026-05-18T13:20:56.179Z","lastSeenAt":"2026-05-18T19:13:53.072Z"}],"details":{"listingId":"1e61fac9-083a-4427-8310-20986a3cbc34","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"litestar-org","slug":"advanced-alchemy","github":{"repo":"litestar-org/litestar-skills","stars":7,"topics":["advanced-alchemy","agent-skills","agentskills","ai-agents","claude-code-plugin","claude-code-skills","gemini-cli-extension","htmx","inertia","litestar","mcp","python","sqlspec"],"license":"mit","html_url":"https://github.com/litestar-org/litestar-skills","pushed_at":"2026-05-13T16:04:09Z","description":"Opinionated first-party agent skills, plugins, subagents, slash commands, and MCP servers for the Litestar framework ecosystem — publishable to Claude Code, Gemini CLI, Codex CLI, Cursor, OpenCode, and VS Code/Copilot from a single repo.","skill_md_sha":"67faade78e96bb0c8697dc28eaa2da3e568e17d7","skill_md_path":"skills/advanced-alchemy/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/litestar-org/litestar-skills/tree/main/skills/advanced-alchemy"},"layout":"multi","source":"github","category":"litestar-skills","frontmatter":{"name":"advanced-alchemy","description":"Auto-activate for alembic/, alembic.ini, advanced_alchemy imports, SQLAlchemyAsyncRepositoryService, SQLAlchemyAsyncConfig, UUIDAuditBase, repository_type, service_class, or web framework Advanced Alchemy extensions. Use when working with Advanced Alchemy ORM models, repositories, services, Alembic migrations, filters, pagination, framework session wiring, custom types, caching, replicas, or file storage. Not for raw SQLAlchemy without Advanced Alchemy abstractions."},"skills_sh_url":"https://skills.sh/litestar-org/litestar-skills/advanced-alchemy"},"updatedAt":"2026-05-18T19:13:53.072Z"}}