sql-expert

A coding aid for writing and improving SQL, the language used to read and change data in databases. It works with PostgreSQL, MySQL, and SQLite.

In plain words
What is it for?
Use it to write queries, review execution plans, design database tables, diagnose query errors, and prepare schema-change migrations.
Why use it?
It helps turn plain-language data requests into queries and makes slow or failing queries easier to understand and fix.

Skill for Claude CodeCodex

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/techgangboss/agentstore/sql-expert
Any agent
npx skills add techgangboss/agentstore --skill sql-expert
Clone the repo
git clone --depth 1 https://github.com/techgangboss/agentstore

Made for: Claude Code, Codex.

Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 800 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.00070 $0.00800
Opus 5 $0.00035 $0.00400
Sonnet 5 $0.00014 $0.00160
Haiku 4.5 $0.00007 $0.00080

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

Security

Grade A, and why

sql-expert 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 2d 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.

plugins/sql-expert/skills/sql-expert/SKILL.md · 104 lines

How it starts

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

SQL Expert

Write optimized SQL queries and explain execution plans. Supports PostgreSQL, MySQL, and SQLite.

Capabilities

  • Write complex SQL queries from natural language descriptions
  • Optimize slow queries with index and structure suggestions
  • Explain execution plans in plain English
  • Design normalized database schemas
  • Debug query errors and suggest fixes
  • Generate migrations for schema changes

Instructions

Writing Queries

When the user describes what data they need:

  1. Ask clarifying questions if the schema is unclear
  2. Check for existing schema files (.sql, migrations, ORM models) in the project
  3. Write the query with:
    • Clear aliases and formatting
    • Appropriate JOINs (prefer explicit JOIN syntax over implicit)
    • WHERE clauses with proper indexing considerations
    • LIMIT for potentially large result sets
  4. Explain what the query does and any assumptions made

Optimizing Queries

When the user shares a slow query:

  1. Analyze the query structure
  2. Check for common performance issues:
    • Missing indexes on JOIN/WHERE columns
    • SELECT * when only specific columns needed
    • Correlated subqueries that could be JOINs
    • Missing LIMIT on large tables
    • Unnecessary ORDER BY on unindexed columns
    • N+1 query patterns in application code
  3. Suggest specific improvements with before/after
  4. Recommend indexes to create: CREATE INDEX idx_name ON table(column);

Explaining Execution Plans

When the user shares an EXPLAIN output:

  1. Walk through each step of the plan
  2. Identify the most expensive operations
  3. Flag sequential scans on large tables
  4. Explain estimated vs actual rows discrepancies
  5. Suggest indexes or query restructuring to improve the plan

Schema Design

When the user needs a new schema:

  1. Identify entities and relationships
  2. Apply normalization (typically 3NF for OLTP)
  3. Choose appropriate data types (prefer specific types: timestamptz over text)
  4. Add primary keys, foreign keys, and constraints
  5. Suggest indexes for expected query patterns
  6. Generate CREATE TABLE statements
  7. Generate a migration file if the project uses migrations

Read the full file on GitHub · 104 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. 2d ago First seen · 104 lines · 70 tokens per session scan A fa5a34fb5345

Subscribe to this mod's changes

sql-expert is a skill published in the GitHub repository techgangboss/agentstore (4 stars, last pushed 6mo ago), licensed MIT. It adds 70 tokens to every session and 800 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

agent-skills-system

Route and operate software, product, research, and agent tasks through one phase-appropriate execution mode. Use when choosing how an agent should approach a task, resolving speed-versus-quality tradeoffs, planning mode transitions, designing agent workflows, or improving an agent harness. Do not use for a routine…

johnvouros/skillmaxxing · 76 tokens

clawlabor

The autonomous marketplace where AI agents discover, purchase, and sell specialized AI capabilities. Use when the user needs to find, hire, buy, sell, or outsource AI capabilities through UAT escrow.

Reinforce-Omega/clawlabor-skill · 43 tokens

agent-skills-system

Route and operate software, product, research, and agent tasks through one phase-appropriate execution mode. Use when choosing how an agent should approach a task, resolving speed-versus-quality tradeoffs, planning mode transitions, designing agent workflows, or improving an agent harness. Do not use for a routine…

johnvouros/skillmaxxing · 76 tokens

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens