- Home
- Skills
- Data & Databases
- sql query architect
Works with the AI tools you already use
sql query architect
Translates natural language business questions into optimized, schema-verified SQL for major data warehouses.
$19.99
sql query architect
Example session with this skill installed
Write a Snowflake query for monthly logo churn in 2024. Use the subscriptions table. I need to see the SQL and an explanation of the logic.
- Read your context and instructions
- Compiled the sql query architect
- Generated the document
I will generate a Snowflake-optimized query for monthly logo churn.
Assumptions & Logic:
*
Logo Churn: Defined as the count of unique customers whose subscription ended (end_date) within a given month.
- Timeframe: Limited to the calendar year 2024.
Schema: Based on the subscriptions table. I am assuming columns customer_id, start_date, and end_date exist based on standard patterns.
Monthly Logo Churn Query (Snowflake)
WITH monthly_spine AS (
-- Generate a spine of months for 2024 to ensure we see months with zero churn
SELECT
DATE_TRUNC('MONTH', DATEADD('MONTH', SEQ4(), '2024-01-01')) AS report_month
FROM TABLE(GENERATOR(ROWCOUNT => 12))
),
churned_customers AS (
SELECT
DATE_TRUNC('MONTH', end_date) AS churn_month,
COUNT(DISTINCT customer_id) AS churned_count
FROM subscriptions
WHERE end_date >= '2024-01-01'
AND end_date <= '2024-12-31'
GROUP BY 1
)
SELECT
s.report_month,
COALESCE(c.churned_count, 0) AS logo_churn
FROM monthly_spine s
LEFT JOIN churned_customers c ON s.report_month = c.churn_month
ORDER BY 1 ASC;
Explanation:
1.
monthly_spine: Creates a list of all 12 months in 2024. This ensures that if a month has zero churn, it still appears in your report.
2.
churned_customers: Filters the subscriptions table for rows where the end_date falls in 2024, then groups them by month to count unique customers.
3.
Final Join: Combines the month list with the churn counts. I used a LEFT JOIN and COALESCE to turn missing data into a 0 for cleaner reporting.
Next steps
- Verify if
end_dateis the correct column for churn (vs. astatuscolumn). - Run this in your Snowflake worksheet to confirm results.
- Provide your DDL if you want me to adjust for specific column names like
sub_idortermination_dt.
sql-query-architect.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
The problem
Translating business questions into SQL often leads to broken queries due to guessed column names or misunderstood metric definitions like "churn" and "active user." Non-technical stakeholders struggle to verify if the logic matches their intent, while developers waste time fixing syntax for specific warehouse dialects.
What it does
- Introspects real database schemas to ensure table and column names are 100% accurate before writing a single line of code.
- Resolves business ambiguity by defining metrics (e.g., logo vs. revenue churn) and time grains before generating SQL.
- Generates optimized, read-only SQL queries using CTEs, defensive aggregation, and dialect-specific functions for Snowflake, BigQuery, Postgres, and more.
- Explains technical query logic in plain English for non-technical stakeholders to review and approve.
- Optionally executes queries against connected warehouses to return cited, verifiable results.
Frameworks & tools
Supports Snowflake, BigQuery, Databricks, PostgreSQL, MySQL, and standard ANSI SQL. Integrates with database connectors and semantic layers for schema discovery.
Why this beats prompting it yourself
Generic LLMs often hallucinate schema details or use incorrect date functions for your specific warehouse. This skill enforces a "schema-first" workflow, running discovery queries on string values and using defensive math like NULLIF to prevent runtime errors that manual prompts frequently overlook.
Use cases
- Generating complex MRR movement and cohort retention queries for finance teams.
- Building funnel conversion reports from raw event logs without manual schema mapping.
- Converting legacy SQL queries from one dialect to another, such as Postgres to BigQuery.
- Providing a self-service data interface for PMs that outputs both the answer and the verifiable code.
Known limitations
Strictly read-only; will not perform DDL, DML, or data migrations. Requires an active connector or provided DDL to function without hallucinations.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 5 days ago
- Passed all security checks, Safe to install