What problem does it solve? SQLAlchemy code often fails in production due to misused Sessions, leaked connections, N+1 queries, and confused transaction boundaries. This Skill provides structured guidance for writing, reviewing, debugging, migrating, and testing SQLAlchemy 2.x Core and ORM code with correct resource ownership and concurrency rules. ## Core Features & Use Cases - Resource and Transaction Ownership: Clear rules for Engine, Connection, Session, and Result lifecycles, including commit/rollback scoping with context managers. - Core vs ORM Decision Guidance: Criteria for choosing explicit relational statements versus identity-map and unit-of-work patterns, plus relationship loading strategies to avoid N+1 queries. - Concurrency and Async Safety: Rules for Session/AsyncSession isolation per task, async driver usage, and avoiding sync calls in the event loop. - Use Case: When reviewing a FastAPI endpoint that shares a global Session across requests, use this Skill to restructure it into per-request Session factories with deterministic commit/rollback and proper eager loading. ## Quick Start Ask the assistant to review or write SQLAlchemy 2.x code for your task, specifying whether it uses Core or ORM, the database, and the expected concurrency and scale.