Agent skill
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 this agent skill to your Project
npx add-skill https://github.com/galihcitta/dotclaudeskills/tree/main/skills/debugging-orm-queries
SKILL.md
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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
troubleshooting-kubernetes
Diagnoses and fixes Kubernetes issues with interactive remediation. Use when pods crash (CrashLoopBackOff, OOMKilled), services unreachable (502/503, empty endpoints), deployments stuck (ImagePullBackOff, pending). Also use when tempted to run kubectl fix commands directly without presenting options, or when user says "just fix it" for K8s issues.
generating-adrs
Use when PRD/TRD contains architectural decisions to document - extracts decisions from refined requirements (architecture choices, data model decisions, API patterns, technology selections, integration strategies, reuse patterns) and generates MADR-format ADRs. One ADR per decision point. Also use when asked to document decisions, create decision records, or retrospectively capture architectural choices.
code-reviewer
Comprehensive code review skill for TypeScript, JavaScript, Python, Swift, Kotlin, Go. Includes automated code analysis, best practice checking, security scanning, and review checklist generation. Use when reviewing pull requests, providing code feedback, identifying issues, or ensuring code quality standards.
prd-to-ralph
Use when converting PRD/requirements into JSON format for Ralph Wiggum autonomous loops. Extracts user stories, orders by dependency (schema first, then backend, then UI, then dashboard), auto-adds standard criteria (typecheck, build, lint, tests), outputs structured JSON ready for autonomous iteration.
detecting-ai-code
Use when auditing code for AI authorship, reviewing acquisitions/contractors, verifying academic integrity, or during code review - provides systematic tiered framework for detecting fully AI-generated AND AI-assisted code patterns with confidence scoring
refining-requirements
Use when PRD is prose-heavy, ambiguous, has scattered file paths, missing API contracts, or says "similar to X" without explanation. Transforms rough requirements into implementation-ready specs. Auto-detects tech stack, validates file paths (EXISTS/CREATE/VERIFY markers), handles greenfield and multi-stack projects. Do NOT use for simple bug fixes, typos, or already-structured Jira tickets with clear file paths and acceptance criteria.
Didn't find tool you were looking for?