Sql Query Optimizer

by cornmanwtf

skill

Analyze plans and improve query performance.

Skill Details

Repository Files

1 file in this skill directory


name: sql-query-optimizer category: data-analytics description: Analyze plans and improve query performance.

Sql Query Optimizer

Purpose

  • Analyze plans and improve query performance.

Preconditions

  • Access to system context (repos, infra, environments)
  • Confirmed requirements and constraints
  • Required approvals for security, compliance, or governance

Inputs

  • Problem statement and scope
  • Current architecture or system constraints
  • Non-functional requirements (performance, security, compliance)
  • Target stack and environment

Outputs

  • Design or implementation plan
  • Required artifacts (diagrams, configs, specs, checklists)
  • Validation steps and acceptance criteria

Detailed Step-by-Step Procedures

  1. Clarify scope, constraints, and success metrics.
  2. Review current system state, dependencies, and integration points.
  3. Select patterns, tools, and architecture options that match constraints.
  4. Produce primary artifacts (docs/specs/configs/code stubs).
  5. Validate against requirements and known risks.
  6. Provide rollout and rollback guidance.

Decision Trees and Conditional Logic

  • If compliance or regulatory scope applies -> add required controls and audit steps.
  • If latency budget is strict -> choose low-latency storage and caching.
  • Else -> prefer cost-optimized storage and tiering.
  • If data consistency is critical -> prefer transactional boundaries and strong consistency.
  • Else -> evaluate eventual consistency or async processing.

Error Handling and Edge Cases

  • Partial failures across dependencies -> isolate blast radius and retry with backoff.
  • Data corruption or loss risk -> enable backups and verify restore path.
  • Limited access to systems -> document gaps and request access early.
  • Legacy dependencies with limited change tolerance -> use adapters and phased rollout.

Tool Requirements and Dependencies

  • CLI and SDK tooling for the target stack
  • Credentials or access tokens for required environments
  • Diagramming or spec tooling when producing docs

Stack Profiles

  • Use Profile A, B, or C from skills/STACK_PROFILES.md.
  • Note selected profile in outputs for traceability.

Validation

  • Requirements coverage check
  • Security and compliance review
  • Performance and reliability review
  • Peer or stakeholder sign-off

Rollback Procedures

  • Revert config or deployment to last known good state.
  • Roll back database migrations if applicable.
  • Verify service health, data integrity, and error rates after rollback.

Success Metrics

  • Measurable outcomes (latency, error rate, uptime, cost)
  • Acceptance thresholds defined with stakeholders

Example Workflows and Use Cases

  • Minimal: apply the skill to a small service or single module.
  • Production: apply the skill to a multi-service or multi-tenant system.

Related Skills

Attack Tree Construction

Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.

skill

Grafana Dashboards

Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.

skill

Matplotlib

Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.

skill

Scientific Visualization

Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.

skill

Seaborn

Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.

skill

Shap

Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Query Writing

For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Scientific Visualization

Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.

skill

Skill Information

Category:Skill
Last Updated:1/16/2026