home / skills / jeremylongshore / claude-code-plugins-plus-skills / cte-query-builder

This skill helps you build production-ready cte query builders with step-by-step guidance, best practices, and validated outputs for data analytics.

npx playbooks add skill jeremylongshore/claude-code-plugins-plus-skills --skill cte-query-builder

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.1 KB
---
name: "cte-query-builder"
description: |
  Build cte query builder operations. Auto-activating skill for Data Analytics.
  Triggers on: cte query builder, cte query builder
  Part of the Data Analytics skill category. Use when working with cte query builder functionality. Trigger with phrases like "cte query builder", "cte builder", "cte".
allowed-tools: "Read, Write, Edit, Bash(cmd:*), Grep"
version: 1.0.0
license: MIT
author: "Jeremy Longshore <[email protected]>"
---

# Cte Query Builder

## Overview

This skill provides automated assistance for cte query builder tasks within the Data Analytics domain.

## When to Use

This skill activates automatically when you:
- Mention "cte query builder" in your request
- Ask about cte query builder patterns or best practices
- Need help with data analytics skills covering sql queries, data visualization, statistical analysis, and business intelligence.

## Instructions

1. Provides step-by-step guidance for cte query builder
2. Follows industry best practices and patterns
3. Generates production-ready code and configurations
4. Validates outputs against common standards

## Examples

**Example: Basic Usage**
Request: "Help me with cte query builder"
Result: Provides step-by-step guidance and generates appropriate configurations


## Prerequisites

- Relevant development environment configured
- Access to necessary tools and services
- Basic understanding of data analytics concepts


## Output

- Generated configurations and code
- Best practice recommendations
- Validation results


## Error Handling

| Error | Cause | Solution |
|-------|-------|----------|
| Configuration invalid | Missing required fields | Check documentation for required parameters |
| Tool not found | Dependency not installed | Install required tools per prerequisites |
| Permission denied | Insufficient access | Verify credentials and permissions |


## Resources

- Official documentation for related tools
- Best practices guides
- Community examples and tutorials

## Related Skills

Part of the **Data Analytics** skill category.
Tags: sql, analytics, visualization, statistics, bi

Overview

This skill automates construction and validation of CTE (Common Table Expression) query builder operations for data analytics workflows. It helps design readable, modular SQL using CTE patterns, and produces production-ready query code and configuration snippets. The skill is auto-activating when CTE-focused assistance is requested and integrates guidance with validation and best-practice checks.

How this skill works

The skill inspects user requirements (tables, joins, filters, aggregation, pagination) and generates step-by-step CTE layouts that separate logical stages of the query. It produces runnable SQL, comments, and optional parameterized templates, and runs lightweight validation to catch syntax issues and common anti-patterns. The output emphasizes maintainability, performance considerations, and clear naming conventions.

When to use it

  • You need to convert a complex query into readable, modular CTE stages.
  • You want parameterized, production-ready SQL templates for analytics pipelines.
  • You need guidance on CTE naming, ordering, and performance trade-offs.
  • You are preparing queries for BI tools, reports, or downstream data models.
  • You want quick validation and anti-pattern checks for CTE usage.

Best practices

  • Split logic into small, single-purpose CTEs to aid readability and reuse.
  • Use clear, consistent CTE naming (verb_noun or step_description) and add short comments.
  • Avoid unnecessary SELECT *; explicitly list columns to reduce I/O and ambiguity.
  • Limit materialization of large intermediate results; consider indexed temp tables if needed.
  • Add parameterization and input validation for reproducible, secure queries.

Example use cases

  • Refactor a monolithic sales report query into staged CTEs: raw extraction, enrichment, aggregation, and final projection.
  • Generate parameterized query templates for monthly dashboards with date range and region filters.
  • Create intermediate CTEs for complex joins and window functions to simplify debugging and unit testing.
  • Validate a newly written CTE-based ETL step against common performance pitfalls before deployment.
  • Produce documented SQL snippets for onboarding analysts to an established data model.

FAQ

What inputs do I need to provide?

Supply table names, key columns, desired filters/aggregations, and any join conditions; optional requirements include indexing constraints and target database dialect.

Which SQL dialects are supported?

The skill targets common ANSI SQL and popular dialects (Postgres, Redshift, BigQuery, Snowflake); specify the dialect to tailor syntax and functions.

Can it validate performance issues?

It flags common anti-patterns and suggests optimizations, but full performance testing requires running queries in your environment with real data and explain plans.