Claude-skill-registry debugging-orm-queries

Converts ORM calls to raw SQL and analyzes query performance. Detects N+1 queries, missing indexes, and other anti-patterns. Use when debugging slow queries, tracing ORM-generated SQL, or optimizing database performance for Sequelize, Prisma, TypeORM (Node.js), GORM, sqlc, sqlx, ent (Go), or SQLAlchemy, Django ORM, Peewee (Python).

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/debugging-orm-queries" ~/.claude/skills/majiayu000-claude-skill-registry-debugging-orm-queries && rm -rf "$T"
manifest: skills/data/debugging-orm-queries/SKILL.md
source content

Debugging ORM Queries

References

LanguageORMsReference
Node.jsSequelize, Prisma, TypeORMreferences/nodejs.md
GoGORM, sqlc, sqlx, entreferences/golang.md
PythonSQLAlchemy, Django, Peeweereferences/python.md
Anti-patternsN+1, indexes, paginationreferences/anti_patterns.md

Scripts

# Pretty-print SQL
python scripts/sql_formatter.py "SELECT..."

# Detect N+1, missing WHERE, duplicates from log file
python scripts/query_analyzer.py queries.log [--json]

# Parse EXPLAIN output (PostgreSQL or MySQL)
psql -c "EXPLAIN ANALYZE ..." | python scripts/explain_parser.py --postgres
mysql -e "EXPLAIN FORMAT=JSON ..." | python scripts/explain_parser.py --mysql

# Node.js request-scoped query tracking (see script for setup)
# Integrates with Sequelize, Prisma, TypeORM

Quick Patterns

Enable logging: Check reference for ORM-specific config (usually

logging: true
or
echo=True
)

ORM → SQL: Enable logging, run query, capture output

SQL → ORM: Map clauses to methods:

  • SELECT columns
    → specify fields/attributes
  • WHERE
    where/filter
    with operators
  • JOIN
    include/preload/prefetch_related
  • ORDER BY
    order/orderBy
  • LIMIT/OFFSET
    limit/offset
    or cursor-based

Performance issues: Run

query_analyzer.py
on logs, check
anti_patterns.md
for solutions