SkillsLib.ai

Sql Query Optimizer

Analyze and rewrite SQL queries for peak database performance

4.5(47 reviews)
500+ downloads
Updated Sep 2026
Verified SafeSecurity VerifiedThis skill was analyzed by our AI security scanner for harmful content including data exfiltration, system manipulation, credential theft, and prompt injection. No threats were detected.

What You Can Do

You can submit any SQL query and receive a thoroughly optimized version with specific performance improvements. The skill analyzes query structure, recommends missing indexes with creation syntax for your database dialect, rewrites inefficient patterns, and provides estimated performance gains. It maintains semantic equivalence while transforming your queries into production-ready code.

Features

Query rewriting

transforms slow patterns into optimized equivalents while preserving logic

Index recommendations

identifies missing indexes with dialect-specific creation syntax

Correlated subquery elimination

converts dependent subqueries into efficient JOINs or window functions

JOIN optimization

restructures multi-table operations for minimal data scanning

CTE refactoring

improves readability and performance using Common Table Expressions

Multi-dialect support

optimizes for PostgreSQL, MySQL, and SQLite with dialect-specific syntax

Performance analysis

provides estimated improvement percentages and explains each optimization

EXPLAIN plan interpretation

analyzes execution plans to identify bottlenecks and sequential scans

Example Output

Input Query:

code
SELECT u.id, u.name, (SELECT COUNT(*) FROM orders WHERE orders.user_id = u.id) as order_count
FROM users u
WHERE u.created_at > '2024-01-01';

Optimized Output:

code
WITH user_orders AS (
  SELECT user_id, COUNT(*) as order_count
  FROM orders
  GROUP BY user_id
)
SELECT u.id, u.name, COALESCE(uo.order_count, 0) as order_count
FROM users u
LEFT JOIN user_orders uo ON u.id = uo.user_id
WHERE u.created_at > '2024-01-01';

Index Recommendation:

code
CREATE INDEX idx_users_created_at ON users(created_at);
CREATE INDEX idx_orders_user_id ON orders(user_id);

Performance Impact: ~65% faster execution time by eliminating correlated subquery (N+1 problem).

What's Included

  • SKILL.md: Complete optimization framework with dialect-specific syntax rules
  • Query optimization checklist: 15-point performance review template
  • Index recommendation template: Structured format for proposing database indexes
  • EXPLAIN plan decoder: Guide to interpreting execution plans across PostgreSQL, MySQL, and SQLite
  • Common anti-patterns guide: Quick reference for slow query patterns and their optimized alternatives

Who It's For

  • Database Administrators — optimizing production queries and capacity planning
  • Backend Engineers — improving application performance and reducing database load
  • Data Engineers — tuning ETL and data pipeline queries for efficiency
  • DevOps Engineers — troubleshooting slow database performance in CI/CD pipelines
  • Performance Specialists — analyzing and benchmarking query optimization efforts

Best For

  • Slow query analysis and rewriting for production systems
  • Index design and recommendation for large datasets
  • Converting legacy SQL patterns to modern, efficient syntax
  • Troubleshooting N+1 query problems and correlated subqueries
  • Preparing queries for high-traffic environments with strict latency requirements

You might also like

Injectable Formulation Development & Troubleshooting
$40
Injectable Formulation Development & Troubleshooting

You'll develop systematic approaches to injectable formulation design, from API selection through sterilization strategy. Claude helps you troubleshoot failed batches by analyzing root causes, recommends regulatory pathways (505(b)(2), ANDA, NDA), and provides science-backed solutions for stability, compatibility, and manufacturability challenges.

$50
Integration Architecture Assessor

This skill helps you systematically assess integration needs across your systems, design architecture patterns that scale with your organization, and identify technical and operational risks before implementation. You'll receive architecture recommendations aligned to your business constraints, clear integration roadmaps, and risk mitigation strategies that reduce deployment surprises. Get structured decision records suitable for architecture review boards and engineering teams.

Git Commit Message Writer
$45
CI/CD4.3(47)
Git Commit Message Writer

Claude analyzes your code diffs and generates standardized commit messages that follow the Conventional Commits specification. The skill automatically determines the correct commit type, scope, and description based on the changes you've made, ensuring your messages are parseable by automation tools while remaining human-readable for code reviewers.

Structured NLP Analysis and Annotation with Claude
$35
NLP3.3(6)
Structured NLP Analysis and Annotation with Claude

You can transform raw text into structured, labeled datasets for machine learning, analysis, and research. This skill performs named entity recognition, sentiment classification, part-of-speech tagging, and dependency parsing—generating consistent, validated annotations at scale. Use it to prepare corpora, extract entities, classify documents, or perform linguistic analysis without manual annotation.

Service Mesh Architecture & Troubleshooting
$25
Service Mesh Architecture & Troubleshooting

This skill helps you systematically analyze service mesh architectures, identify inter-service communication failures, and design optimal routing and security policies. You'll receive step-by-step troubleshooting guidance tailored to your mesh platform (Istio, Linkerd, Consul), configuration validation reports, and architectural recommendations that reduce latency, improve observability, and tighten security posture.

Production ML Deployment Validation & Runbook Automation
$25
Production ML Deployment Validation & Runbook Automation

This skill automates the creation of production-ready deployment validation checklists, infrastructure-as-code templates, and incident response runbooks tailored to your ML stack. You get comprehensive pre-deployment checks covering model validation, data pipeline integrity, infrastructure readiness, and monitoring setup—all customized for your specific models and cloud provider. The skill generates executable runbooks that teams can follow during incidents, including rollback procedures, failover strategies, and diagnostic commands.

Internal Developer Platform Architecture & Golden Paths
$15
Internal Developer Platform Architecture & Golden Paths

Build scalable internal developer platform architectures that reduce cognitive load and standardize workflows for your development organization. Document golden paths that guide developers through common tasks like onboarding, deployment, and troubleshooting. Map platform capabilities, integrations, and service topology to align with your engineering scale and technical strategy.

IoT Firmware Analysis & Device Debugger
$40
IoT Firmware Analysis & Device Debugger

Rapidly analyze firmware logs and diagnose hardware issues that cause device failures, connectivity problems, and performance degradation. You'll identify root causes from stack traces, crash dumps, and sensor data, then generate specific optimization recommendations. This skill transforms raw device logs into actionable debugging plans that reduce time-to-resolution from hours to minutes.

$24.00$30.00