sql-queries

sql-queries is a skill for Claude Code, Codex from phuryn/pm-skills. It costs 55 tokens per session (784 once invoked), scanned A, original, MIT.

A tool that turns plain-language data questions into SQL, the language used to retrieve and analyze information in databases. It can work across database dialects such as BigQuery, PostgreSQL, MySQL, and others when the needed details are provided.

In plain words
What is it for?
Use it to write queries for reports, data exploration, business questions, and database analysis from a schema and a description of the information needed.
Why use it?
It removes much of the manual SQL syntax work and uses a supplied schema to reference tables, columns, and relationships more accurately. It also explains the query and suggests ways to validate or improve it.

Skill for Claude CodeCodex

Part of the pm-data-analytics plugin — 3 skills, 3 commands 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/phuryn/pm-skills/sql-queries
Any agent
npx skills add phuryn/pm-skills --skill sql-queries
Clone the repo
git clone --depth 1 https://github.com/phuryn/pm-skills

Made for: Claude Code, Codex.

Or install pm-data-analytics, the plugin that ships this one along with the rest of its 3 skills, 3 commands.

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-queries

README.md
[![agentmods](https://agentmods.dev/badge/skills/phuryn/pm-skills/sql-queries.svg)](https://agentmods.dev/skills/phuryn/pm-skills/sql-queries)
Your own site
<a href="https://agentmods.dev/skills/phuryn/pm-skills/sql-queries"><img src="https://agentmods.dev/badge/skills/phuryn/pm-skills/sql-queries.svg" alt="Measured on agentmods" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 784 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.00055 $0.00784
Opus 5 $0.00028 $0.00392
Sonnet 5 $0.00011 $0.00157
Haiku 4.5 $0.00006 $0.00078

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

Security

Grade A, and why

sql-queries 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

pm-data-analytics/skills/sql-queries/SKILL.md · 88 lines

How it starts

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

SQL Query Generator

Purpose

Transform natural language requirements into optimized SQL queries across multiple database platforms. This skill helps product managers, analysts, and engineers generate accurate queries without manual syntax work.

How It Works

Step 1: Understand Your Database Schema

  • If you provide a schema file (SQL, documentation, or diagram description), I will read and analyze it
  • Extract table names, column definitions, data types, and relationships
  • Identify primary keys, foreign keys, and indexing strategies

Step 2: Process Your Request

  • Clarify the exact data you need to retrieve or analyze
  • Confirm the SQL dialect (BigQuery, PostgreSQL, MySQL, Snowflake, etc.)
  • Ask for any additional requirements (filters, aggregations, sorting)

Step 3: Generate Optimized Query

  • Write efficient SQL that leverages your database structure
  • Include comments explaining complex logic
  • Add performance considerations for large datasets
  • Provide alternative approaches if applicable

Step 4: Explain and Test

  • Explain the query logic in plain English
  • Suggest how to test or validate results
  • Offer tips for performance optimization
  • If you want, generate a test script or sample data

Usage Examples

Example 1: Query from Schema File

Upload your database_schema.sql file and say:
"Generate a query to find users who signed up in the last 30 days
and had at least 5 active sessions"

Example 2: Query from Diagram Description

"Here's my database: Users table (id, email, created_at), Sessions table
(id, user_id, timestamp, duration). Generate a query for average session
duration per user in January 2026."

Example 3: Complex Analysis Query

"Create a BigQuery query to analyze our revenue by region and customer tier,
including year-over-year growth rates."

Key Capabilities

  • Multi-Dialect Support: Works with BigQuery, PostgreSQL, MySQL, Snowflake, SQL Server
  • File Reading: Reads schema files, SQL dumps, and data documentation
  • Query Optimization: Suggests indexes, partitioning, and performance improvements
  • Explanation: Breaks down queries for learning and documentation
  • Testing: Can generate test queries and sample data scripts
  • Script Execution: Create executable SQL scripts for your database

Read the full file on GitHub · 88 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 · 88 lines · 55 tokens per session scan A 18da062d5171

Subscribe to this mod's changes

sql-queries is a skill published in the GitHub repository phuryn/pm-skills (25,964 stars, last pushed 2mo ago), licensed MIT. It adds 55 tokens to every session and 784 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-30.

Related

Other skills, from other repositories

sql-generation

Use this skill when the user asks to "write a SQL query", "help me query this data", "how do I get this metric from the database", "generate SQL for", "query for retention", "SQL to find churned users", "write a query for my analytics", or needs SQL to answer a specific product analytics question. This skill generates…

Productfculty-aipm/PM-Copilot-by-Product-Faculty · 92 tokens

pmm-resume

Resume reviewer and tailoring engine for Product Marketing Managers (IC to VP, including AI PMM roles). Takes baseline resume + job description → dissects JD → ranks bullets by impact fit → rebuilds complete resume in one pass. Trigger on: resume + JD paste, "tailor this", "which bullets for this role", "rebuild for…

stefanoskarakasis/Product-Marketing-Skills · 103 tokens

prd

Guides Product Managers and Product Marketing Managers to co-create complete Product Requirements Documents with embedded Solution Stories. Reads brain context (positioning, ICP, Revenue Levers) to anchor PRDs in strategy. Outputs: structured Solution Story for GTM communications + full PRD for execution alignment.

stefanoskarakasis/Product-Marketing-Skills · 59 tokens

beachhead-segment

Identifies and scores your highest-priority beachhead segment using four-dimension scoring (Burning Pain, Willingness to Pay, Winnability, Referral Potential) with blocking gates. Reads brain context (ICP, positioning, competitive landscape, proof points) and, when available, guardrails from prior beachhead decisions…

stefanoskarakasis/Product-Marketing-Skills · 88 tokens

workflow-orchestrator

Orchestrates multi-skill PMM programs end-to-end — chains positioning, competitive, GTM strategy, campaign briefs, stakeholder maps, and retros into one coherent program with a master document and brain updates. Trigger on: "run full GTM workflow", "run a full launch", "launch [product] end to end", "positioning…

stefanoskarakasis/Product-Marketing-Skills · 117 tokens

positioning-messaging

Builds or audits positioning statements, messaging hierarchies, homepage copy, and persona cards using April Dunford's Obviously Awesome framework across five modes (build, audit, fletch, sales-enablement, homepage). Refuses to generate without a named primary persona and 3+ alternatives including status quo, and…

stefanoskarakasis/Product-Marketing-Skills · 79 tokens