jeremylongshore/tons-of-skills-marketplace / plugins/database/sql-query-optimizer/skills/optimizing-sql-queries
optimizing-sql-queries
VerifiedExecute use when you need to work with query optimization. This skill provides query performance analysis with comprehensive guidance and automation. Trigger with phrases like "optimize queries", "analyze performance", or "improve query speed".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.8 KB |
| assets/README.md | markdown | 153 B |
| references/README.md | markdown | 62 B |
| scripts/README.md | markdown | 429 B |
| scripts/analyze_query.pyexecutable | script | 4.6 KB |
| scripts/explain_query.pyexecutable | script | 2.7 KB |
scripts/explain_query.py
View on GitHub#!/usr/bin/env python3
"""
sql-query-optimizer - explain_query.sh
Executes the EXPLAIN command and formats the output for analysis.
Generated: 2025-12-10 03:48:17
"""
import sys
import json
import argparse
from pathlib import Path
def process_file(file_path: Path) -> bool:
"""Process individual file."""
if not file_path.exists():
print(f"β File not found: {file_path}")
return False
print(f"π Processing: {file_path}")
# Add processing logic here based on skill requirements
# This is a template that can be customized
try:
if file_path.suffix == ".json":
with open(file_path) as f:
data = json.load(f)
print(f" β Valid JSON with {len(data)} keys")
else:
size = file_path.stat().st_size
print(f" β File size: {size:,} bytes")
return True
except Exception as e:
print(f" β Error: {e}")
return False
def process_directory(dir_path: Path) -> int:
"""Process all files in directory."""
processed = 0
failed = 0
for file_path in dir_path.rglob("*"):
if file_path.is_file():
if process_file(file_path):
processed += 1
else:
failed += 1
return processed, failed
def main():
parser = argparse.ArgumentParser(description="Executes the EXPLAIN command and formats the output for analysis.")
parser.add_argument("input", help="Input file or directory")
parser.add_argument("--output", "-o", help="Output directory")
parser.add_argument("--verbose", "-v", action="store_true", help="Verbose output")
parser.add_argument("--config", "-c", help="Configuration file")
args = parser.parse_args()
input_path = Path(args.input)
print("π sql-query-optimizer - explain_query.sh")
print(" Category: database")
print(" Plugin: sql-query-optimizer")
print(f" Input: {input_path}")
if args.config:
if Path(args.config).exists():
with open(args.config) as f:
json.load(f)
print(f" Config: {args.config}")
# Process input
if input_path.is_file():
success = process_file(input_path)
result = 0 if success else 1
elif input_path.is_dir():
processed, failed = process_directory(input_path)
print("\nπ SUMMARY")
print(f" β
Processed: {processed}")
print(f" β Failed: {failed}")
result = 0 if failed == 0 else 1
else:
print(f"β Invalid input: {input_path}")
result = 1
if result == 0:
print("\nβ
Completed successfully")
else:
print("\nβ Completed with errors")
return result
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |