sql-optimization-patterns

sql-optimization-patterns is a skill for Claude Code from sickn33/agentic-awesome-skills. It costs 28 tokens per session (434 once invoked), scanned A, original, MIT.

A set of methods for finding and improving slow SQL queries. SQL is the language used to request data from many databases; these methods use query plans, indexes, and result comparisons to check proposed changes.

In plain words
What is it for?
Use it to investigate slow queries, read EXPLAIN plans, fix inefficient indexes or joins, address N+1 queries, and reduce database load as data grows.
Why use it?
It reduces the risk of making a query faster while changing its results or harming production data. It also provides a careful process for testing changes with representative data and authorized access.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the agentic-awesome-skills plugin — 197 skills, 1 plugin shipped together

Good fit Use it to investigate slow queries, read EXPLAIN plans, fix inefficient indexes or joins, address N+1 queries, and reduce database load as data grows.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sickn33/agentic-awesome-skills/sql-optimization-patterns
About the project

AAS Core is a local control plane for coding agents that lets them search a large catalogue of skills, choose a stack, validate it, and create a reproducible plan. It is used to assemble and review agent workflows through its CLI, local MCP server, catalogue, plugins, and Workbench. The catalogue add-ons provide the skills, plugins, bundles, and workflows that AAS Core helps agents select and validate.

sickn33/agentic-awesome-skills · 49,668 stars · on GitHub · aaskills.tech

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 sickn33/agentic-awesome-skills --skill sql-optimization-patterns
Clone the repo
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills

Made for: Claude Code.

Or install agentic-awesome-skills, the plugin that ships this one along with the rest of its 197 skills, 1 plugin.

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-optimization-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/sickn33/agentic-awesome-skills/sql-optimization-patterns/github.svg)](https://agentmods.dev/skills/sickn33/agentic-awesome-skills/sql-optimization-patterns)
Your own site
<a href="https://agentmods.dev/skills/sickn33/agentic-awesome-skills/sql-optimization-patterns"><img src="https://agentmods.dev/badge/skills/sickn33/agentic-awesome-skills/sql-optimization-patterns/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-optimization-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/sickn33/agentic-awesome-skills/sql-optimization-patterns"><img src="https://agentmods.dev/badge/skills/sickn33/agentic-awesome-skills/sql-optimization-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 434 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.00028 $0.00434
Opus 5.5 $0.00011 $0.00174
Sonnet 5.5 $0.00006 $0.00087
Haiku 4.5 $0.00003 $0.00043

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

Security

Grade A, and why

sql-optimization-patterns 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/aasb-aas-data-analytics/skills/sql-optimization-patterns/SKILL.md · 49 lines

How it starts

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

SQL Optimization Patterns

Diagnose slow SQL with query plans, preserve query results, and verify indexing or query changes against representative data.

Use this skill when

  • Debugging slow-running queries
  • Designing performant database schemas
  • Optimizing application response times
  • Reducing database load and costs
  • Improving scalability for growing datasets
  • Analyzing EXPLAIN query plans
  • Implementing efficient indexes
  • Resolving N+1 query problems

Do not use this skill when

  • The task is unrelated to sql optimization patterns
  • You need a different domain or tool outside this scope

Instructions

  • Confirm database engine/version, query parameters, expected rows, data distribution and the permitted environment. Start read-only; obtain authorization before DDL, data changes, configuration changes or maintenance.
  • Compare result sets before comparing performance. EXPLAIN ANALYZE executes the statement: use approved representative data, account for functions and triggers, and do not assume a transaction rollback undoes every side effect.
  • Record the observed plan, timing conditions and correctness checks. Indexes and query rewrites are hypotheses, not universal speed improvements.
  • If detailed examples are required, open resources/implementation-playbook.md.

Resources

  • resources/implementation-playbook.md for detailed patterns and examples.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Worked example

The playbook includes an executable SQLite batch-loading example with bound values and an empty-input case. The repository test exercises it alongside pagination ties and aggregation equivalence. SQLite correctness checks do not establish PostgreSQL performance or production safety.

Read the full file on GitHub · 49 lines

Files

What ships with it

1 file 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. 2d ago First seen · 49 lines · 28 tokens per session scan A c86f12c6631a

Subscribe to this mod's changes

sql-optimization-patterns is a skill published in the GitHub repository sickn33/agentic-awesome-skills (49,668 stars, last pushed today), licensed MIT. It adds 28 tokens to every session and 434 once invoked, about $0.0001 per session on Opus 5.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-11-12.

Related

sql-optimization-patterns compared with skills from other repositories

sql-optimization-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
sql-optimization-patternssickn33/agentic-awesome-skillsSkill50ktodayMITA28Claude Code
redis-masterAtulPurohit/Antigravity-Awesome-SkillsSkill54mo agononeA32Claude Code, Codex
mysql-expertAtulPurohit/Antigravity-Awesome-SkillsSkill54mo agononeA30Claude Code, Codex
postgresql-expertAtulPurohit/Antigravity-Awesome-SkillsSkill54mo agononeA35Claude Code, Codex
cdc-streamsAtulPurohit/Antigravity-Awesome-SkillsSkill54mo agononeA27Claude Code, Codex
redis-cache-masterAtulPurohit/Antigravity-Awesome-SkillsSkill54mo agononeA24Claude Code, Codex
data-archiverAtulPurohit/Antigravity-Awesome-SkillsSkill54mo agononeA27Claude Code, Codex