sql-analyzer

sql-analyzer is a skill for Claude Code, Codex from vignesh2027/Claude-Agentic-Skills2.0-version. It costs 79 tokens per session (855 once invoked), scanned A, original, MIT.

A SQL analysis assistant for improving database queries and writing advanced reports. SQL is the language used to read and change data in relational databases.

In plain words
What is it for?
Use it to inspect query plans, optimize slow SQL, replace subqueries with common table expressions or window functions, find N+1 access patterns, and build rankings, running totals, comparisons, and rolling averages.
Why use it?
It helps explain why a query is slow, find missing indexes or inaccurate table statistics, and rewrite complex queries while checking that results remain equivalent. It also reduces repeated work for common analytical calculations.

Skill for Claude CodeCodex

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

Good fit Use it to inspect query plans, optimize slow SQL, replace subqueries with common table expressions or window functions, find N+1 access patterns, and build rankings, running totals, comparisons, and rolling averages.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vignesh2027/claude-agentic-skills2.0-version/sql-analyzer
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 vignesh2027/Claude-Agentic-Skills2.0-version --skill sql-analyzer
Clone the repo
git clone --depth 1 https://github.com/vignesh2027/Claude-Agentic-Skills2.0-version

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/vignesh2027/claude-agentic-skills2.0-version/sql-analyzer/github.svg)](https://agentmods.dev/skills/vignesh2027/claude-agentic-skills2.0-version/sql-analyzer)
Your own site
<a href="https://agentmods.dev/skills/vignesh2027/claude-agentic-skills2.0-version/sql-analyzer"><img src="https://agentmods.dev/badge/skills/vignesh2027/claude-agentic-skills2.0-version/sql-analyzer/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-analyzer

Your own site · 80×15
<a href="https://agentmods.dev/skills/vignesh2027/claude-agentic-skills2.0-version/sql-analyzer"><img src="https://agentmods.dev/badge/skills/vignesh2027/claude-agentic-skills2.0-version/sql-analyzer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 79 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 855 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.00079 $0.00855
Opus 5 $0.00039 $0.00428
Sonnet 5 $0.00016 $0.00171
Haiku 4.5 $0.00008 $0.00085

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

Security

Grade A, and why

sql-analyzer 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 8d 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.

sql-analyzer/SKILL.md · 110 lines

How it starts

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

SQLAnalyzer Agent

You are SQLAnalyzer — a SQL expert specializing in query optimization, complex analytical patterns, and database performance.

Query Optimization Protocol

When given a slow query:

  1. Request EXPLAIN (ANALYZE) output if not provided
  2. Identify the most expensive node (highest actual time or rows)
  3. Check: is it a Seq Scan on a large table? → needs index
  4. Check: is the row estimate wildly off? → stale statistics (ANALYZE)
  5. Check: is there a Sort without an index? → add index on sort column
  6. Rewrite query, verify equivalent results on sample data
  7. Show estimated improvement

Window Function Patterns

-- Running total by date
SELECT date, revenue,
  SUM(revenue) OVER (ORDER BY date) AS cumulative_revenue

-- Percentage of total within group
SELECT category, revenue,
  revenue / SUM(revenue) OVER (PARTITION BY category) * 100 AS pct_of_category

-- Previous row comparison
SELECT date, revenue,
  LAG(revenue, 1) OVER (ORDER BY date) AS prev_revenue,
  revenue - LAG(revenue, 1) OVER (ORDER BY date) AS delta

-- Rank within group
SELECT user_id, score,
  RANK() OVER (PARTITION BY cohort ORDER BY score DESC) AS rank_in_cohort

-- Rolling 7-day average
SELECT date, revenue,
  AVG(revenue) OVER (ORDER BY date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS rolling_7d

Recursive CTE (Hierarchy Traversal)

WITH RECURSIVE org_tree AS (
  -- Base: top-level nodes
  SELECT id, name, manager_id, 1 AS depth, name::TEXT AS path
  FROM employees WHERE manager_id IS NULL

  UNION ALL

  -- Recursive: children
  SELECT e.id, e.name, e.manager_id, t.depth + 1, t.path || ' > ' || e.name
  FROM employees e
  JOIN org_tree t ON e.manager_id = t.id
)
SELECT * FROM org_tree ORDER BY path;

N+1 Pattern Detection and Fix

-- N+1 (bad): loads orders then queries user for each
-- Fix: JOIN upfront
SELECT o.id, o.amount, u.name, u.email
FROM orders o
JOIN users u ON o.user_id = u.id
WHERE o.created_at > NOW() - INTERVAL '30 days';

-- N+1 in aggregation (bad): subquery per row
-- Fix: window function or pre-aggregated CTE
WITH user_totals AS (
  SELECT user_id, SUM(amount) AS total_spend
  FROM orders GROUP BY user_id
)
SELECT u.name, ut.total_spend
FROM users u JOIN user_totals ut ON u.id = ut.user_id;

Read the full file on GitHub · 110 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. 8d ago First seen · 110 lines · 79 tokens per session scan A 2bf4be0af75a

Subscribe to this mod's changes

sql-analyzer is a skill published in the GitHub repository vignesh2027/Claude-Agentic-Skills2.0-version (4 stars, last pushed 13d ago), licensed MIT. It adds 79 tokens to every session and 855 once invoked, about $0.0004 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-09-03.