query-builder

query-builder is a skill for Claude Code, Codex from clidey/whodb. It costs 40 tokens per session (892 once invoked), scanned A, original, Apache-2.0.

A tool that turns plain-English data questions into SQL queries, using the database tables and columns to build the query.

In plain words
What is it for?
Use it for requests such as finding recent sign-ups, filtering expensive orders, counting records, or ranking customers by spending.
Why use it?
It reduces the need to remember table names, column names, joins, filters, grouping, and sorting when asking for database results.

Skill for Claude CodeCodex

Part of the whodb plugin — 2 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/clidey/whodb/query-builder
Any agent
npx skills add clidey/whodb --skill query-builder
Clone the repo
git clone --depth 1 https://github.com/clidey/whodb

Made for: Claude Code, Codex.

Or install whodb, the plugin that ships this one along with the rest of its 2 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for query-builder

README.md
[![agentmods](https://agentmods.dev/badge/skills/clidey/whodb/query-builder.svg)](https://agentmods.dev/skills/clidey/whodb/query-builder)
Your own site
<a href="https://agentmods.dev/skills/clidey/whodb/query-builder"><img src="https://agentmods.dev/badge/skills/clidey/whodb/query-builder.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 892 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00040 $0.00892
Opus 5 $0.00020 $0.00446
Sonnet 5 $0.00008 $0.00178
Haiku 4.5 $0.00004 $0.00089

Measured 4d ago against content hash 747b7b9166a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

query-builder scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cli/external-plugin/whodb/skills/query-builder/SKILL.md · 131 lines

How it starts

The opening of the file, as written. The whole thing — 131 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Query Builder

Convert natural language questions into SQL queries using the database schema.

When to Use

Activate when user asks questions like:

  • "Show me all users who signed up last month"
  • "Find orders greater than $100"
  • "Which products have low inventory?"
  • "Get the top 10 customers by total spend"

Workflow

1. Understand the Schema

Before generating SQL, always check the table structure:

whodb_tables(connection="...") → Get available tables
whodb_columns(table="relevant_table") → Get column names and types

2. Identify Intent

Parse the natural language request:

  • Subject: What entity? (users, orders, products)
  • Filter: What conditions? (last month, > $100, active)
  • Aggregation: Count, sum, average, max, min?
  • Grouping: By what dimension?
  • Ordering: Sort by what? Ascending/descending?
  • Limit: How many results?

3. Map to Schema

  • Match entities to table names
  • Match attributes to column names
  • Identify foreign key joins needed

4. Generate SQL

Build the query following SQL best practices:

SELECT columns
FROM table
[JOIN other_table ON condition]
WHERE filters
[GROUP BY columns]
[HAVING aggregate_condition]
ORDER BY column [ASC|DESC]
LIMIT n;

5. Execute and Present

whodb_query(query="generated SQL")

Translation Patterns

Natural Language SQL Pattern
"last week/month/year" WHERE date_col >= DATE_SUB(NOW(), INTERVAL 1 WEEK)
"more than X" / "greater than X" WHERE col > X
"top N" ORDER BY col DESC LIMIT N
"how many" SELECT COUNT(*)
"total" / "sum of" SELECT SUM(col)
"average" SELECT AVG(col)
"for each" / "by" GROUP BY col
"between X and Y" WHERE col BETWEEN X AND Y
"contains" / "like" WHERE col LIKE '%term%'
"starts with" WHERE col LIKE 'term%'
"is empty" / "is null" WHERE col IS NULL
"is not empty" WHERE col IS NOT NULL

Date Handling by Database

Read the full file on GitHub · 131 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 131 lines · 40 tokens per session scan A 747b7b9166a3

Subscribe to this mod's changes

query-builder is a skill published in the GitHub repository clidey/whodb (5,018 stars, last pushed today), licensed Apache-2.0. It adds 40 tokens to every session and 892 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories