query-builder_skill

This skill converts natural language questions into SQL queries by analyzing schema, intents, and joins to deliver accurate data results.
  • Go

4.5k

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill clidey/whodb --skill query-builder

  • SKILL.md3.3 KB

Overview

This skill converts plain-English data questions into safe, runnable SQL (and equivalent query patterns) using your database schema. It maps user intent—filters, joins, aggregations, sorting, and limits—into well-formed queries for Postgres, MySQL, SQLite, ClickHouse, ElasticSearch, MongoDB, Redis and MariaDB. It prioritizes exploratory safety by defaulting to LIMIT and avoiding destructive statements.

How this skill works

The skill inspects the schema by listing tables and columns, then parses the natural language request to identify subject, filters, aggregations, grouping, ordering, and limits. It matches mentioned entities and attributes to actual table and column names, infers required joins, and assembles a parameterized SQL statement following best practices. It can emit dialect-specific date and interval expressions, add table aliases, and warn when results may be large.

When to use it

  • User asks a data question in plain English (e.g., "show me users who signed up last week").
  • You need a translation from intent to SQL for reporting or ad-hoc analysis.
  • You want dialect-aware date and aggregation patterns (Postgres, MySQL, SQLite, ClickHouse, etc.).
  • You need safe, read-only exploratory queries with sensible defaults like LIMIT 100.
  • When you want join logic inferred from foreign key–like phrasing (e.g., products with order totals).

Best practices

  • Always check available tables and columns before generating SQL (whodb_tables / whodb_columns).
  • Default to LIMIT 100 for exploratory queries and warn if filters are missing or too broad.
  • Never generate DELETE/UPDATE/DROP unless explicitly requested and confirmed.
  • Use explicit table aliases for multi-table joins and fully qualify ambiguous columns.
  • Translate natural-language date ranges to dialect-specific expressions (e.g., DATE_TRUNC for Postgres).

Example use cases

  • "Show me all users who signed up last month" → SELECT with date filter and ORDER BY created_at DESC LIMIT 100.
  • "Find orders greater than $100" → WHERE total > 100 and optional joins to customer data.
  • "Top 10 customers by total spend" → GROUP BY customer, SUM(order_total) ORDER BY sum DESC LIMIT 10.
  • "Which products have low inventory?" → WHERE stock <= threshold and optionally JOIN suppliers.
  • "How many orders per customer?" → COUNT(*) grouped by customer_id, ordered by count DESC.

FAQ

The skill targets Postgres, MySQL, SQLite, ClickHouse, MariaDB, MongoDB, ElasticSearch and Redis patterns and emits dialect-appropriate date and aggregation syntax.

How does it avoid dangerous queries?

It defaults to read-only SELECT, adds LIMIT 100 for exploration, warns on broad scopes, and will not produce DELETE/UPDATE/DROP without explicit user consent.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
query-builder skill by clidey/whodb | VeilStrat