Codexkit Sql Query Builder logo

Codexkit Sql Query Builder

Community
hoavdc
codexkit-sql-query-builder

Build production-ready analytical SQL queries using CTEs, window functions, aggregations, and data transformations. Translates business questions into well-documented, performant queries. Use when writing reporting queries, building data pipelines, or answering ad-hoc business questions with SQL.

Overview

Publisherhoavdc
RepositoryCodexKit
Skill namecodexkit-sql-query-builder
Stars
27
Forks
12
Bundled files
5
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by hoavdc on GitHub. Read the source before you install it.

Installation

Install the Codexkit Sql Query Builder AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/hoavdc/CodexKit/tree/main/skills/codexkit-sql-query-builder
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hoavdc/CodexKit.git /tmp/CodexKit
mkdir -p .claude/skills
cp -r /tmp/CodexKit/skills/codexkit-sql-query-builder .claude/skills/codexkit-sql-query-builder
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Codexkit Sql Query Builder in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Codexkit Sql Query Builder on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Codexkit Sql Query Builder is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

SQL Query Builder

When to Use

  • When a business question needs to be answered with data
  • When building reporting queries or data pipeline transformations
  • When optimizing slow queries or refactoring complex SQL
  • When translating stakeholder requirements into analytical SQL

Procedure

Step 1 — Clarify the Question

Translate the business question into a precise data question:

  • Business: "How are our sales trending?"
  • Data: "Monthly revenue by product category for the last 12 months, with month-over-month growth rate"

Document:

  • Expected output columns and format
  • Filters and date ranges
  • Granularity (daily, weekly, monthly)
  • Sort order

Step 2 — Identify Tables & Joins

Map the data model:

TableRoleKey ColumnsJoin
ordersFactorder_id, customer_id, order_date, totalPrimary
productsDimensionproduct_id, category, nameorders.product_id = products.id
customersDimensioncustomer_id, region, segmentorders.customer_id = customers.id

Join type selection:

  • INNER when both sides must exist
  • LEFT when the left side may have no match (preserve all orders even without customer data)
  • Never use RIGHT JOIN — rewrite as LEFT JOIN for clarity

Step 3 — Build CTE Pipeline

Structure complex queries as a pipeline of CTEs:

sql
WITH
-- Step 1: Filter and clean base data
base AS (
    SELECT ...
    FROM orders
    WHERE order_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '12 months')
),

-- Step 2: Aggregate to desired granularity
monthly AS (
    SELECT
        DATE_TRUNC('month', order_date) AS month,
        category,
        SUM(total) AS revenue,
        COUNT(DISTINCT customer_id) AS unique_customers
    FROM base
    JOIN products USING (product_id)
    GROUP BY 1, 2
),

-- Step 3: Add calculations (window functions)
with_growth AS (
    SELECT *,
        LAG(revenue) OVER (PARTITION BY category ORDER BY month) AS prev_revenue,
        ROUND(100.0 * (revenue - LAG(revenue) OVER (PARTITION BY category ORDER BY month))
              / NULLIF(LAG(revenue) OVER (PARTITION BY category ORDER BY month), 0), 1) AS mom_growth_pct
    FROM monthly
)

-- Final output
SELECT month, category, revenue, unique_customers, mom_growth_pct
FROM with_growth
ORDER BY category, month;

Step 4 — Common Patterns Reference

PatternWhen to UseSQL
Running totalCumulative metricsSUM(x) OVER (ORDER BY date ROWS UNBOUNDED PRECEDING)
Rank within groupTop N per categoryROW_NUMBER() OVER (PARTITION BY cat ORDER BY val DESC)
Period comparisonYoY, MoMLAG(val, 12) OVER (ORDER BY month)
DeduplicationRemove exact dupesROW_NUMBER() OVER (PARTITION BY key ORDER BY updated DESC)
Cohort analysisRetention / engagementFirst-action date as cohort, then activity by period
PivotRows to columnsCASE WHEN + SUM or database-specific PIVOT

Step 5 — Performance Notes

Add comments for production queries:

  • Estimated row counts at each CTE stage
  • Index usage hints
  • Known limitations or edge cases
  • Data freshness assumptions

Inputs

InputRequiredFormat
Business questionYesPlain language
Table schemaYesTable names, columns, types
Database dialectRecommendedPostgreSQL / MySQL / BigQuery / Snowflake
Sample dataRecommendedTo validate output
Performance requirementsOptionalMax execution time

Output

markdown
## Query — [Business Question]

### Question
"What is the monthly revenue by category for the last 12 months with growth rates?"

### Query
[SQL with CTEs, comments, and formatting]

### Output Schema

| Column | Type | Description |
|--------|------|-------------|
| month | DATE | First day of month |
| category | VARCHAR | Product category |
| revenue | DECIMAL | Total revenue |
| unique_customers | INT | Distinct customers |
| mom_growth_pct | DECIMAL | Month-over-month growth % |

### Performance Notes
- Base table ~2M rows, filtered to ~200K
- Index on orders(order_date) recommended
- Runs in ~3s on PostgreSQL 15

Definition of Done

  • Business question clearly translated to data question
  • Tables and joins documented
  • Query uses CTE pipeline (no nested subqueries)
  • Window functions used where appropriate
  • Output columns described
  • Performance notes included

Quality Criteria

  • Data sources and assumptions are explicitly stated
  • Calculations are reproducible from provided inputs
  • Visualizations or tables have clear labels, units, and time ranges
  • Caveats and confidence levels are documented for estimates

Verification (4C)

CheckQuestion
CorrectnessAre formulas, aggregations, and statistical methods applied correctly?
CompletenessDoes the analysis cover all requested metrics and time ranges?
Context-fitAre the chosen metrics relevant to the business question being answered?
ConsequenceIf this data were used for a decision today, what blind spots remain?

Edge Cases

  • Missing or incomplete data — Document gaps and their potential impact on conclusions. Provide ranges instead of point estimates.
  • Outliers skewing results — Report with and without outliers. Document the decision to include or exclude.
  • Changing data definitions mid-period — Split analysis at the change boundary and note the schema difference.

Changelog

  • v1.1.0 — Added Tier 2 verification checklist and examples for query safety.
  • v1.0.0 — Initial release

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Codexkit Sql Query Builder AI skill do?

Build production-ready analytical SQL queries using CTEs, window functions, aggregations, and data transformations. Translates business questions into well-documented, performant queries. Use when writing reporting queries, building data pipelines, or answering ad-hoc business questions with SQL.

Why use Codexkit Sql Query Builder on TypingMind?

Because you install it once and use it with any model. Codexkit Sql Query Builder is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Codexkit Sql Query Builder in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/hoavdc/CodexKit/tree/main/skills/codexkit-sql-query-builder. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Codexkit Sql Query Builder?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Codexkit Sql Query Builder?

As many as you like. As long as a model supports skills, you can use Codexkit Sql Query Builder with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Codexkit Sql Query Builder AI skill free?

Yes. It is published on GitHub by hoavdc under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇