sql-query-writer

sql-query-writer is a skill for Claude Code, Codex from Jignesh-Ponamwar/skills-mcp. It costs 67 tokens per session (1,406 once invoked), scanned A, original, Apache-2.0.

A SQL-writing assistant for querying databases. SQL is the language used to retrieve, combine, summarize, and modify data in databases.

In plain words
What is it for?
Use it for multi-table joins, totals and other summaries, window functions, common table expressions, subqueries, query-plan analysis, schema design, and performance improvements in PostgreSQL, MySQL, SQLite, BigQuery, or DuckDB.
Why use it?
It helps turn complex data requirements into correct, readable queries and investigate slow queries across several database systems.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for multi-table joins, totals and other summaries, window functions, common table expressions, subqueries, query-plan analysis, schema design, and performance improvements in PostgreSQL, MySQL, SQLite, BigQuery, or DuckDB.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jignesh-ponamwar/skills-mcp/sql-query-writer
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.

Any agent
npx skills add Jignesh-Ponamwar/skills-mcp --skill sql-query-writer
Clone the repo
git clone --depth 1 https://github.com/Jignesh-Ponamwar/skills-mcp

Made for: Claude Code, Codex.

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 sql-query-writer

README.md
[![agentmods](https://agentmods.dev/badge/skills/jignesh-ponamwar/skills-mcp/sql-query-writer/github.svg)](https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/sql-query-writer)
Your own site
<a href="https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/sql-query-writer"><img src="https://agentmods.dev/badge/skills/jignesh-ponamwar/skills-mcp/sql-query-writer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql-query-writer

Your own site · 80×15
<a href="https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/sql-query-writer"><img src="https://agentmods.dev/badge/skills/jignesh-ponamwar/skills-mcp/sql-query-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,406 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00067 $0.01406
Opus 5 $0.00034 $0.00703
Sonnet 5 $0.00013 $0.00281
Haiku 4.5 $0.00007 $0.00141

Measured 9d ago against content hash c955d4b1f142, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

sql-query-writer 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 9d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/validate_sql.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skill_mcp/skills_data/sql-query-writer/SKILL.md · 183 lines

How it starts

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

SQL Query Writer Skill

Overview

Write correct, readable, and performant SQL queries. Covers SELECT fundamentals through advanced window functions, CTEs, and performance optimization. Dialect-aware: PostgreSQL, MySQL, SQLite, BigQuery.

Step-by-Step Process

Step 1: Understand the Data Model

Before writing a query, confirm:

  • Tables involved and their primary keys
  • Join relationships (1:1, 1:many, many:many via junction table)
  • Data types of filter and join columns
  • Approximate row counts (affects optimization strategy)
  • Target dialect (PostgreSQL, MySQL, SQLite, BigQuery, DuckDB)

Step 2: Start with the Simplest Correct Query

-- Start simple, then optimize
SELECT
    u.id,
    u.name,
    u.email,
    COUNT(o.id) AS order_count,
    SUM(o.total_amount) AS total_spent
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at >= '2024-01-01'
GROUP BY u.id, u.name, u.email
ORDER BY total_spent DESC
LIMIT 100;

Step 3: Common Query Patterns

Top N per group (window function)

SELECT *
FROM (
    SELECT
        product_id,
        category,
        revenue,
        ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) AS rank
    FROM product_sales
) ranked
WHERE rank <= 5;

Running totals and moving averages

SELECT
    date,
    revenue,
    SUM(revenue) OVER (ORDER BY date) AS cumulative_revenue,
    AVG(revenue) OVER (ORDER BY date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS revenue_7d_avg
FROM daily_sales
ORDER BY date;

Year-over-year comparison

SELECT
    DATE_TRUNC('month', order_date) AS month,
    SUM(total) AS revenue,
    LAG(SUM(total), 12) OVER (ORDER BY DATE_TRUNC('month', order_date)) AS revenue_prev_year,
    ROUND(
        (SUM(total) - LAG(SUM(total), 12) OVER (ORDER BY DATE_TRUNC('month', order_date)))
        / NULLIF(LAG(SUM(total), 12) OVER (ORDER BY DATE_TRUNC('month', order_date)), 0) * 100,
        1
    ) AS yoy_pct_change
FROM orders
GROUP BY 1
ORDER BY 1;

Read the full file on GitHub · 183 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 9d ago First seen · 183 lines · 67 tokens per session scan A c955d4b1f142

Subscribe to this mod's changes

sql-query-writer is a skill published in the GitHub repository Jignesh-Ponamwar/skills-mcp (7 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 67 tokens to every session and 1,406 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

deprecation-and-migration

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset…

addyosmani/agent-skills · 69 tokens

database-migration

Execute database migrations across ORMs and platforms with zero-downtime strategies, data transformation, and rollback procedures. Use when migrating databases, changing schemas, performing data transformations, or implementing zero-downtime deployment strategies.

rmyndharis/antigravity-skills · 47 tokens

database-migrations-migration-observability

Migration monitoring, CDC, and observability infrastructure.

rmyndharis/antigravity-skills · 18 tokens

database-architect

Expert database architect specializing in data layer design from scratch, technology selection, schema modeling, and scalable database architectures. Masters SQL/NoSQL/TimeSeries database selection, normalization strategies, migration planning, and performance-first design. Handles both greenfield architectures and…

rmyndharis/antigravity-skills · 78 tokens

baserow-automation

Automate Baserow tasks via Rube MCP (Composio). Always search tools first for current schemas.

ComposioHQ/awesome-claude-skills · 29 tokens

database-admin

Expert database administrator specializing in modern cloud databases, automation, and reliability engineering. Masters AWS/Azure/GCP database services, Infrastructure as Code, high availability, disaster recovery, performance optimization, and compliance. Handles multi-cloud strategies, container databases, and cost…

rmyndharis/antigravity-skills · 70 tokens