write-query

Convert ambiguous business questions into executable SQL queries with CTE-based architecture.

Updated Apr 1, 2026
One-click install
npx skills add https://github.com/hpsgd/claude-marketplace --skill write-query-hpsgd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: write-query
Source: https://github.com/hpsgd/claude-marketplace/tree/main/plugins/engineering/data-engineer/skills/write-query
Command: npx skills add https://github.com/hpsgd/claude-marketplace --skill write-query-hpsgd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Translates ambiguous business questions into precise, executable SQL queries, reducing guesswork and ensuring reproducible analytics.

Core Features & Use Cases

  • Stepwise query construction with explicit metric definitions, data-source mapping, and a robust, CTE-based architecture.
  • Supports complex analytics workflows such as cohort analysis, funnel analysis, and period-over-period comparisons.
  • Enforces best practices like de-duplication, explicit inclusion/exclusion criteria, and built-in sanity checks.

Quick Start

Provide a business question in natural language, and the tool will generate a structured SQL query following the formal steps.

Frequently Asked Questions about write-query

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

FAQPage Schema
How do I write a SQL query for a complex business question?▼

To write a SQL query for a complex business question, you must decompose the request into explicit metric definitions, identify the correct data sources, and construct the query using a CTE-based architecture for reproducible analytics.

What is the best way to structure SQL for cohort analysis and period-over-period comparisons?▼

The best way to structure SQL for cohort analysis and period-over-period comparisons is using a CTE-based architecture, which enforces stepwise query construction, explicit inclusion criteria, and built-in sanity checks to ensure accurate results.

Can I translate natural language into executable SQL for data warehouse analysis?▼

Yes, you can translate natural language into executable SQL for data warehouse analysis by applying a formal workflow that maps ambiguous business questions to precise data-source selections and structured query outputs.

How does CTE-based architecture improve data analysis query construction?▼

CTE-based architecture improves data analysis query construction by enforcing a formal step-by-step process, ensuring de-duplication, explicit metric definitions, and built-in sanity checks that reduce guesswork in complex analytics workflows.

Why do my SQL queries return inconsistent analytics results?▼

SQL queries return inconsistent analytics results when they lack explicit metric definitions and built-in sanity checks; enforcing a formal workflow with question decomposition and a CTE-based architecture ensures reproducible queries.

Does this SQL query generation method support complex analytics workflows like funnel analysis?▼

Yes, this SQL query generation method supports complex analytics workflows like funnel analysis by enforcing de-duplication, explicit inclusion and exclusion criteria, and robust stepwise query construction.