SQL Query Builder

When the user needs help writing SQL queries, analyzing data, building reports, or says 'write a query,' 'SQL help,' 'pull this data,' 'how many users,' 'funnel analysis,' 'cohort analysis,' 'retention query,' or needs to extract insights from a database.

43 starsDatabases

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add 0xranx/agentbrief --skill sql-query-builder
Manual install
git clone --depth 1 https://github.com/0xranx/agentbrief.git /tmp/agentbrief
mkdir -p ~/.claude/skills
cp -r /tmp/agentbrief/briefs/data-analyst/skills/sql-query-builder ~/.claude/skills/sql-query-builder

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# SQL Query Builder

You write SQL that is correct, readable, and performant. You optimize for the human reading the query, not just the database executing it.

## Style Rules

1. **Use CTEs over subqueries** — Readable, debuggable, testable
2. **Explicit column names** — Never `SELECT *` in production queries
3. **Consistent formatting** — Keywords uppercase, one clause per line
4. **Comment the "why"** — Not what the code does, but why this approach

```sql
-- Good: CTEs with clear names
WITH active_users AS (
    SELECT user_id, COUNT(*) AS session_count
    FROM sessions
    WHERE created_at >= CURRENT_DATE - INTERVAL '30 days'
    GROUP BY user_id
    HAVING COUNT(*) >= 3
),
user_revenue AS (
    SELECT user_id, SUM(amount) AS total_revenue
    FROM payments
    WHERE status = 'completed'
    GROUP BY user_id
)
SELECT
    au.user_id,
    au.session_count,
    COALESCE(ur.total_revenue, 0) AS total_revenue
FROM active_users au
LEFT JOIN user_revenue ur ON au.user_id = ur.user_id
ORDER BY ur.total_revenue DESC NULLS LAST;
```

## Common Analysis Patterns

### Funnel Analysis
Read the full skill on GitHub

Details

Skill name
sql-query-builder
Path
briefs/data-analyst/skills/sql-query-builder/SKILL.md
License
MIT
Repo updated
28 March 2026

FAQ

What does the SQL Query Builder skill do?

When the user needs help writing SQL queries, analyzing data, building reports, or says 'write a query,' 'SQL help,' 'pull this data,' 'how many users,' 'funnel analysis,' 'cohort analysis,' 'retention query,' or needs to extract insights from a database.

How do I install the SQL Query Builder skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add 0xranx/agentbrief --skill sql-query-builder. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is SQL Query Builder popular?

It lives in 0xranx/agentbrief, which has 43 GitHub stars and 0 forks.

Related skills

Typescript Advanced Types

43

0xranx/agentbrief

Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.

Software Development

Analytics Setup

43

0xranx/agentbrief

When the user needs to set up product analytics, event tracking, or says 'set up analytics,' 'add tracking,' 'GA4,' 'Mixpanel,' 'PostHog,' 'Amplitude,' 'what events should we track,' 'conversion tracking,' 'funnel tracking,' or is launching a product and needs to instrument it for data collection.

Data & Analytics

API Documentation

43

0xranx/agentbrief

Create comprehensive API documentation for developers. Use when documenting REST APIs, GraphQL schemas, or SDK methods. Handles OpenAPI/Swagger, interactive docs, examples, and API reference guides.

Software Development

Audit Domain 03 Database

41

wolverin0/claude-skills

Audit the database and data layer — schema design, query patterns, migrations, indexing, RLS, soft-delete, transactions. Run as part of /audit Phase E.

Databases

Oracle Database Expert

48

frankxai/claude-skills-library

Expert Oracle Database engineering across Oracle Database 23ai, Autonomous Database, SQL/PLSQL tuning, AI Vector Search, JSON Relational Duality, partitioning, high availability, and security. Use when designing schemas, optimizing queries, or operating Oracle databases in production.

Databases

Collect Preserve Specimens

45

pjt222/agent-almanac

Collect and preserve insect specimens following museum-grade standards including legal compliance, collection methods, humane dispatch, dry pinning, wet preservation, labeling, storage, and curation. Covers permit requirements, protected species regulations, sweep nets, beating trays, pitfall traps, light traps, Malaise traps, aspirators, ethyl acetate killing jars, freezing, pin placement by order, wing spreading, ethanol preservation for soft-bodied specimens, specimen labeling with locality and date, storage with pest management, and database entry. Use when building a reference collection

DatabasesIn 1 list

Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.