query-builder
Convert natural language questions into SQL queries. Activates when users ask data questions in plain English like "show me users who signed up last week" or "find orders over $100".
Install
mkdir -p .claude/skills/query-builder && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2660" && unzip -o skill.zip -d .claude/skills/query-builder && rm skill.zipInstalls to .claude/skills/query-builder
About this skill
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
PostgreSQL
WHERE created_at >= NOW() - INTERVAL '7 days'
WHERE created_at >= DATE_TRUNC('month', CURRENT_DATE)
MySQL
WHERE created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
WHERE created_at >= DATE_FORMAT(NOW(), '%Y-%m-01')
SQLite
WHERE created_at >= DATE('now', '-7 days')
WHERE created_at >= DATE('now', 'start of month')
Examples
"Show me users who signed up this month"
SELECT * FROM users
WHERE created_at >= DATE_TRUNC('month', CURRENT_DATE)
ORDER BY created_at DESC;
"Find the top 5 products by sales"
SELECT p.name, SUM(oi.quantity) as total_sold
FROM products p
JOIN order_items oi ON p.id = oi.product_id
GROUP BY p.id, p.name
ORDER BY total_sold DESC
LIMIT 5;
"How many orders per customer?"
SELECT customer_id, COUNT(*) as order_count
FROM orders
GROUP BY customer_id
ORDER BY order_count DESC;
Safety Rules
- Always use LIMIT for exploratory queries (default: 100)
- Never generate DELETE, UPDATE, or DROP unless explicitly requested
- Warn if query might return large result sets
- Use table aliases for readability in JOINs
More by clidey
View all skills by clidey →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversAgentQL lets you scrape any website and extract structured data to JSON easily—no custom web scraping code needed.
Organize projects using leading project track software. Convert tasks with dependency tracking for optimal time manageme
Convert natural language queries into regex patterns and run Python regular expression search with Grep. Easily use pyth
The Coupler.io MCP Server is a Model Context Protocol (MCP) server that provides seamless integration with Coupler.io AP
Create modern React UI components instantly with Magic AI Agent. Integrates with top IDEs for fast, stunning design and
Empower your workflows with Perplexity Ask MCP Server—seamless integration of AI research tools for real-time, accurate
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.