query-expert

Optimize SQL and NoSQL queries with EXPLAIN plans and indexing strategies.

194|26|Updated Oct 20, 2025
One-click install
npx skills add https://github.com/jamesrochabrun/skills --skill query-expert
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-expert
Source: https://github.com/jamesrochabrun/skills/tree/main/skills/query-expert
Command: npx skills add https://github.com/jamesrochabrun/skills --skill query-expert

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Writing efficient, cross-datastore queries is error-prone and time-consuming. This Skill helps you generate optimized queries, analyze performance, and troubleshoot bottlenecks across SQL and NoSQL systems.

Core Features & Use Cases

  • Generate Queries: SQL, MongoDB, GraphQL queries tailored to data needs.
  • Optimize Queries: Refactor for performance and readability.
  • Design Indexes: Strategies to accelerate access patterns.
  • Analyze Performance: Explain plans and query analysis to locate bottlenecks.
  • Troubleshoot: Debug slow queries and common pitfalls.
  • Best Practices: Reusable patterns and anti-patterns for reliable data access.

Quick Start

Ask for a suggested query: "Show me an efficient search on the orders collection with a compound index." Then apply indexing and optimization recommendations.

Frequently Asked Questions about query-expert

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

FAQPage Schema
How do I optimize slow database queries across SQL and NoSQL?

Query optimization involves analyzing execution plans, refactoring inefficient patterns, and designing targeted indexes. This Skill generates optimized queries for PostgreSQL, MySQL, MongoDB, and other engines, then provides actionable guidance to eliminate bottlenecks and improve performance.

What indexing strategies work best for MongoDB and SQL databases?

Indexing strategies depend on your access patterns and query structure. This Skill designs compound indexes, covering indexes, and database-specific strategies for MongoDB, PostgreSQL, MySQL, and SQL Server to accelerate common queries and reduce scan overhead.

Can I use EXPLAIN plans to debug query performance issues?

Yes. EXPLAIN plans reveal how databases execute queries—scan types, join orders, and cost estimates. This Skill analyzes these plans across SQL and NoSQL systems to pinpoint slow operations, identify missing indexes, and suggest concrete refactoring steps.

How do I write efficient queries with JOINs, GROUP BY, and window functions?

Efficient queries use appropriate join strategies, avoid unnecessary grouping, and leverage window functions for ranking and cumulative operations. This Skill generates and optimizes these SQL patterns while showing best practices to prevent common performance pitfalls.

Does this work with GraphQL and NoSQL query languages like Cypher?

Yes. This Skill supports GraphQL query optimization, MongoDB query patterns, and Cypher for graph databases, alongside traditional SQL. It generates optimized queries and indexing strategies across all these query languages and datastores.

What's the difference between query optimization for SQL versus MongoDB?

SQL optimization focuses on join strategies, normalization, and relational indexes; MongoDB optimization emphasizes document structure, embedded data, and query filters. This Skill addresses both paradigms—query generation, index design, and performance analysis tailored to each datastore type.