sqlalchemy-code-review

Analyze SQLAlchemy 2.0 codebases for performance bottlenecks and session errors.

Updated Jul 18, 2026
One-click install
npx skills add https://github.com/arthrod/conejo-skills --skill sqlalchemy-code-review-arthrod
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqlalchemy-code-review
Source: https://github.com/arthrod/conejo-skills/tree/main/skills/sqlalchemy-code-review
Command: npx skills add https://github.com/arthrod/conejo-skills --skill sqlalchemy-code-review-arthrod

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses common performance bottlenecks and architectural anti-patterns in SQLAlchemy 2.0, such as N+1 query issues, improper session management, and inefficient migration strategies.

Core Features & Use Cases

  • Performance Optimization: Identifies N+1 query patterns and suggests eager loading strategies like joinedload or selectinload.
  • Session Lifecycle Management: Enforces correct usage of context managers and request-scoped sessions to prevent connection leaks.
  • Migration Safety: Validates Alembic migration patterns, ensuring reversibility and preventing production database locks.

Quick Start

Use the sqlalchemy-code-review skill to analyze the provided database model and query logic for potential N+1 issues and session management errors.

Frequently Asked Questions about sqlalchemy-code-review

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

FAQPage Schema
How do I fix N+1 query issues in SQLAlchemy 2.0?

To fix N+1 query issues in SQLAlchemy 2.0, analyze your codebase to identify lazy-loading patterns and apply explicit eager loading strategies like joinedload or selectinload for optimized database interaction.

What is the proper way to manage SQLAlchemy session lifecycles?

Proper SQLAlchemy session lifecycle management requires using context managers and request-scoped sessions to prevent connection leaks and ensure safe concurrent transaction handling.

How do I ensure Alembic migrations are reversible and safe for production?

To ensure Alembic migrations are safe, validate your migration patterns to guarantee reversibility and prevent production database locks during concurrent transaction handling and schema evolution.

Does this code review approach work for concurrent transaction handling in SQLAlchemy?

Yes, analyzing SQLAlchemy 2.0 codebases targets concurrent transaction handling by enforcing proper context management and request-scoped sessions to satisfy production-grade database interaction requirements.

What are common performance bottlenecks in SQLAlchemy ORM queries?

Common SQLAlchemy ORM performance bottlenecks include N+1 query issues, improper session management, and inefficient migration strategies, which require query optimization and architectural anti-pattern identification to resolve.