write-query

Generate optimized SQL queries from natural language for multiple dialects.

1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/ilove323/comlan-skills --skill write-query-ilove323
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-query
Source: https://github.com/ilove323/comlan-skills/tree/main/data/skills/write-query
Command: npx skills add https://github.com/ilove323/comlan-skills --skill write-query-ilove323

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the friction of turning ambiguous natural language data requests into correct, performant, and dialect-specific SQL queries ready for analytics and reporting.

Core Features & Use Cases

  • Natural language to SQL: Translate user descriptions into SELECTs, JOINs, aggregations, and multi-CTE pipelines.
  • Dialect-aware optimization: Produce syntax and function usage tailored for Snowflake, BigQuery, PostgreSQL, Redshift, Databricks, MySQL, DuckDB, and others.
  • Schema discovery & performance guidance: When connected to a data warehouse, locate tables and fields, respect partitions/cluster keys, and recommend filters, JOIN strategies, and EXISTS vs IN optimizations.
  • Use Case: Build a retention cohort analysis, generate top-N user queries over large partitioned event tables, or craft multi-CTE financial rollups optimized for the target database.

Quick Start

Ask the assistant: /write-query Find the top 100 users by event count in the past 7 days using BigQuery and include each user's most recent event type.

Frequently Asked Questions about write-query

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

FAQPage Schema
How do I generate optimized SQL from natural language for BigQuery?

Generate optimized SQL from natural language by translating your data requests into dialect-specific SELECTs, JOINs, and aggregations tailored for BigQuery, ensuring correct syntax and performance-aware query structures.

Can I use natural language to write complex CTE transformations in Snowflake?

Write complex CTE transformations in Snowflake using natural language to build multi-CTE pipelines. The Skill translates requirements into dialect-specific syntax, handling appropriate partition filtering and JOIN strategies for analytics.

Does this SQL query generation tool support PostgreSQL and Redshift?

This SQL query generation tool supports PostgreSQL and Redshift, along with Snowflake, BigQuery, Databricks, MySQL, and DuckDB. It produces dialect-specific syntax and function usage tailored to each supported data warehouse.

What's the best way to optimize SQL queries for partitioned event tables?

Optimize SQL queries for partitioned event tables by applying recommended partition filtering, appropriate JOIN types, and using EXISTS instead of IN. The Skill provides performance-aware recommendations for large-scale analytics.

How do I generate a retention cohort analysis query in Databricks?

Generate a retention cohort analysis query in Databricks by translating your analytical requirements into optimized multi-CTE pipelines. The Skill respects schema discovery and provides dialect-specific syntax for Databricks.

When should I use EXISTS vs IN for SQL query optimization?

Use EXISTS instead of IN for SQL query optimization when checking for row existence across large datasets. The Skill provides performance-aware recommendations, suggesting EXISTS and appropriate JOIN strategies to improve query execution.