Sql Query Builder
Generate optimized SQL queries from natural language descriptions
- Type
- Slash Command
- Repository
- jeremylongshore/tons-of-skills-marketplace
- GitHub stars
- 2.8k
- License
- MIT
- Repo last updated
- Sep 27, 2026
What Sql Query Builder is
Sql Query Builder is a slash command published in the jeremylongshore/tons-of-skills-marketplace repository on GitHub, which has about 2.8k stars. The repository describes itself as: “Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.”
A slash command is a reusable prompt saved as a markdown file and run by typing its name after a slash. In Claude Code, custom commands have been merged into skills: a file in .claude/commands/ and a skill folder in .claude/skills/ both create the same kind of command, and existing command files keep working.
Sql Query Builder gives you a repeatable way to run the same instructions without retyping them, optionally with arguments.
How to install Sql Query Builder
Claude Code
- Download sql-query-builder.md from the repository.
- Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md.
- Run it by typing / followed by its name.
Claude Cowork
- Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it.
- In Customize → Skills, click +, then upload the ZIP.
- Run it from any task with / and the skill name.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from plugins/packages/fullstack-starter-pack/commands/sql-query-builder.md, shared under the repository's MIT license. Read the full file on GitHub.
Generates optimized SQL queries from natural language descriptions, supporting SELECT, INSERT, UPDATE, DELETE with JOINs, indexes, and best practices.
What This Command Does
Generated Queries:
- SELECT queries with JOINs
- INSERT, UPDATE, DELETE operations
- Aggregations and GROUP BY
- Subqueries and CTEs
- Indexes and optimization tips
- PostgreSQL, MySQL, SQLite syntax
Output: Production-ready SQL queries
Time: 2-3 minutes
Usage
# Generate query from description
/sql-query-builder "Get all users with their posts"
# Shortcut
/sqb "Find top 10 products by sales"
# Complex query
/sqb "Get users who have made purchases in last 30 days, grouped by country"
# Specific database
/sqb "List orders with customer info" --database postgresqlExample Output
Input:
/sqb "Get all blog posts with author info and comment count, ordered by recent"Generated SQL:
-- Query: Get all blog posts with author info and comment count
-- Database: PostgreSQL
-- Optimized for performance with proper indexes
-- Main query
SELECT
p.id,
p.title,
p.slug,
p.content,
p.published,
p.created_at,
p.updated_at,
-- Author information
u.id AS author_id,
u.name AS author_name,
u.email AS author_email,
-- Comment count (calculated)
…Query Examples
1. Simple SELECT
Request: "Get all active users"
SELECT
id,
email,
name,
created_at
FROM users
WHERE active = true
ORDER BY created_at DESC;
-- Index recommendation
CREATE INDEX idx_users_active ON users(active, created_at DESC);2. JOIN Queries
Request: "Get orders with customer and product information"
SELECT
o.id AS order_id,
o.order_date,
o.total,
o.status,
-- Customer info
c.id AS customer_id,
c.name AS customer_name,
c.email AS customer_email,
-- Order items
oi.quantity,
oi.price AS unit_price,
-- Product info
p.id AS product_id,
p.name AS product_name
FROM orders o
INNER JOIN customers c ON o.customer_id = c.id
INNER JOIN order_items oi ON o.id = oi.order_id
…3. Aggregations
Request: "Get total sales by product category"
SELECT
c.name AS category,
COUNT(DISTINCT o.id) AS order_count,
SUM(oi.quantity) AS units_sold,
SUM(oi.quantity * oi.price) AS total_revenue,
AVG(oi.price) AS avg_price
FROM categories c
INNER JOIN products p ON c.id = p.category_id
INNER JOIN order_items oi ON p.id = oi.product_id
INNER JOIN orders o ON oi.order_id = o.id
WHERE o.status = 'completed'
AND o.created_at >= CURRENT_DATE - INTERVAL '1 year'
GROUP BY c.id, c.name
HAVING SUM(oi.quantity * oi.price) > 1000
ORDER BY total_revenue DESC;4. Subqueries
Request: "Get users who have never made a purchase"
SELECT
u.id,
u.email,
u.name,
u.created_at
FROM users u
WHERE NOT EXISTS (
SELECT 1
FROM orders o
WHERE o.customer_id = u.id
)
ORDER BY u.created_at DESC;
-- Alternative using LEFT JOIN (often faster)
SELECT
u.id,
u.email,
u.name,
…5. Common Table Expressions (CTEs)
Request: "Get top customers by purchase amount with their order history"
WITH customer_totals AS (
SELECT
c.id,
c.name,
c.email,
COUNT(o.id) AS order_count,
SUM(o.total) AS total_spent
FROM customers c
INNER JOIN orders o ON c.id = o.customer_id
WHERE o.status = 'completed'
GROUP BY c.id, c.name, c.email
HAVING SUM(o.total) > 500
)
SELECT
ct.*,
o.id AS order_id,
o.order_date,
o.total AS order_total
…6. Window Functions
Request: "Rank products by sales within each category"
SELECT
p.id,
p.name AS product_name,
c.name AS category_name,
SUM(oi.quantity * oi.price) AS total_sales,
RANK() OVER (
PARTITION BY p.category_id
ORDER BY SUM(oi.quantity * oi.price) DESC
) AS rank_in_category
FROM products p
INNER JOIN categories c ON p.category_id = c.id
INNER JOIN order_items oi ON p.id = oi.product_id
INNER JOIN orders o ON oi.order_id = o.id
WHERE o.status = 'completed'
GROUP BY p.id, p.name, p.category_id, c.name
ORDER BY c.name, rank_in_category; Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is Sql Query Builder?
Sql Query Builder is a slash command for Claude Code and Claude Cowork from the jeremylongshore/tons-of-skills-marketplace repository on GitHub. Generate optimized SQL queries from natural language descriptions
How do I install Sql Query Builder in Claude Code?
Download sql-query-builder.md from the repository. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md. Run it by typing / followed by its name.
Can I use Sql Query Builder in Claude Cowork?
Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it. In Customize → Skills, click +, then upload the ZIP. Run it from any task with / and the skill name.
Is Sql Query Builder safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- Shopify Pack Claude Code skill pack for Shopify (38 skills) Plugin · jeremylongshore/tons-of-skills-marketplace
- Skill Auditor Audit and fix Claude Code SKILL.md files against enterprise compliance standards: frontmatter completeness, required body sections, and style. Use when validating or repairing skills in a plugin directory. Trigger with "audit skill", "fix skill compliance". Subagent · jeremylongshore/tons-of-skills-marketplace
- Sla Sli Tracker Track SLAs, SLIs, and SLOs for service reliability Plugin · jeremylongshore/tons-of-skills-marketplace
- Slop Remover Identifies and removes AI-generated comment noise — restating comments, obvious JSDoc, filler section markers, and preamble boilerplate — while preserving every comment that explains why, documents a workaround, or captures business logic. Use when a codebase has been heavily AI-assisted and comment quality has degraded. Trigger with \"remove slop comments\", \"clean up AI-generated comments\". Subagent · jeremylongshore/tons-of-skills-marketplace
- Stored Proc Generate production-ready stored procedures and database functions Slash Command · jeremylongshore/tons-of-skills-marketplace
- Sprint Run the autonomous multi-agent sprint workflow with spec-driven development Slash Command · jeremylongshore/tons-of-skills-marketplace
- Subtitles Generate animated subtitles in popular creator styles (Mr Beast, Ali Abdaal, Slash Command · jeremylongshore/tons-of-skills-marketplace
- Sop 003 Backup Setup Guide through SOP-003 Backup System Setup & Verification with pgBackRest Slash Command · jeremylongshore/tons-of-skills-marketplace