← Back to list

debugging-orm-queries
by galihcitta
My collection of Claude Code skills for everyday development tasks
⭐ 4🍴 0📅 Jan 17, 2026
SKILL.md
name: debugging-orm-queries description: 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).
Debugging ORM Queries
References
| Language | ORMs | Reference |
|---|---|---|
| Node.js | Sequelize, Prisma, TypeORM | references/nodejs.md |
| Go | GORM, sqlc, sqlx, ent | references/golang.md |
| Python | SQLAlchemy, Django, Peewee | references/python.md |
| Anti-patterns | N+1, indexes, pagination | references/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/attributesWHERE→where/filterwith operatorsJOIN→include/preload/prefetch_relatedORDER BY→order/orderByLIMIT/OFFSET→limit/offsetor cursor-based
Performance issues: Run query_analyzer.py on logs, check anti_patterns.md for solutions
Score
Total Score
60/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon