data-sql

Provide SQL optimization patterns covering CTEs, upserts, window functions, indexing strategies, schema design, and explicit column selection for analytics workloads.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/AlexanderStephenThompson/claude-hub --skill data-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-sql
Source: https://github.com/AlexanderStephenThompson/claude-hub/tree/main/data/skills/data-sql
Command: npx skills add https://github.com/AlexanderStephenThompson/claude-hub --skill data-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps data teams avoid SQL anti-patterns by providing practical patterns for query optimization, schema design, and data modeling.

Core Features & Use Cases

  • CTE-driven query organization to improve readability and maintainability.
  • Upsert patterns and window function examples for common analytics workloads.
  • Use Case: optimize a reporting query on a star schema to compute daily revenue per region.

Quick Start

Provide a sample table schema and a poorly performing query, and the Skill will generate an optimized version using CTEs, explicit column lists, and indexing considerations.

Frequently Asked Questions about data-sql

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

FAQPage Schema
How do I optimize slow SQL queries using CTEs and window functions?

To optimize slow SQL queries, this Skill refactors inefficient code into clear structures using CTEs for readability and window functions for analytics workloads, ensuring explicit column selection and idempotent operations to improve overall performance.

What is the best way to write idempotent SQL upserts for data warehousing?

The best way to write idempotent SQL upserts is by applying specific patterns for schema design and data modeling. This Skill provides upsert examples that enforce clear query structures, preventing duplicate data insertion during repeated analytics workloads.

How do I structure a star schema query to compute daily revenue per region?

To structure a star schema query for daily revenue per region, provide a sample table schema and poorly performing query. The Skill generates an optimized version using CTEs, explicit column lists, and indexing considerations for fast data modeling.

When do I need indexing strategies for SQL query optimization?

You need indexing strategies for SQL query optimization when your reporting queries perform poorly on large datasets. This Skill provides indexing patterns alongside schema design techniques to solve inefficient SQL coding and accelerate data analytics workloads.

Can I use these SQL patterns for application SQL work and not just data warehousing?

Yes, you can use these SQL patterns for application SQL work, data analytics, and data warehousing. The patterns cover CTEs, upserts, window functions, and indexing strategies applicable across multiple environments to enforce explicit column selection and clear query structures.