data-sql-optimization

data-sql-optimization is a skill for Claude Code from joaoguirunas/team-os. It costs 55 tokens per session (4,764 once invoked), scanned A, original, MIT.

A set of methods for improving SQL database performance and design in OLTP systems, which support frequent transactional reads and writes.

In plain words
What is it for?
Use it to analyze EXPLAIN output, design indexes and schemas, plan migrations, and address availability or security issues across major SQL databases.
Why use it?
It helps find slow queries and avoid design problems involving execution plans, indexes, schemas, migrations, high availability, and security.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions Codex.

Good fit Use it to analyze EXPLAIN output, design indexes and schemas, plan migrations, and address availability or security issues across major SQL databases.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/joaoguirunas/team-os/data-sql-optimization
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 joaoguirunas/team-os --skill data-sql-optimization
Clone the repo
git clone --depth 1 https://github.com/joaoguirunas/team-os

Made for: Claude Code.

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 data-sql-optimization

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/joaoguirunas/team-os/data-sql-optimization"><img src="https://agentmods.dev/badge/skills/joaoguirunas/team-os/data-sql-optimization.svg" alt="Reviewed on agentmods" width="80" 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 4,764 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.00055 $0.04764
Opus 5.5 $0.00022 $0.01906
Sonnet 5.5 $0.00011 $0.00953
Haiku 4.5 $0.00006 $0.00476

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

Security

Grade A, and why

data-sql-optimization 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 27d 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.

.claude/skills/data-sql-optimization/SKILL.md · 396 lines

How it starts

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

SQL Optimization — Comprehensive Reference

This skill provides actionable checklists, patterns, and templates for transactional (OLTP) SQL optimization: measurement-first triage, EXPLAIN/plan interpretation, balanced indexing (avoiding over-indexing), performance monitoring, schema evolution, migrations, backup/recovery, high availability, and security.

Supported Platforms: PostgreSQL, MySQL, SQL Server, Oracle, SQLite

For OLAP/Analytics: See data-lake-platform (ClickHouse, DuckDB, Doris, StarRocks)


Quick Reference

Task Tool/Framework Command When to Use
Query Performance Analysis EXPLAIN ANALYZE EXPLAIN (ANALYZE, BUFFERS) SELECT ... (PG) / EXPLAIN ANALYZE SELECT ... (MySQL) Diagnose slow queries, identify missing indexes
Find Slow Queries pg_stat_statements / slow query log SELECT * FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 10; Identify performance bottlenecks in production
Index Analysis pg_stat_user_indexes / SHOW INDEX SELECT * FROM pg_stat_user_indexes WHERE idx_scan = 0; Find unused indexes, validate index coverage
Schema Migration Flyway / Liquibase flyway migrate / liquibase update Version-controlled database changes
Backup & Recovery pg_dump / mysqldump pg_dump -Fc dbname > backup.dump Point-in-time recovery, disaster recovery
Replication Setup Streaming / GTID Configure postgresql.conf / my.cnf High availability, read scaling
Safe Tuning Loop Measure -> Explain -> Change -> Verify Use tuning worksheet template Reduce latency/cost without regressions

Decision Tree: Choosing the Right Approach

Query performance issue?
    ├─ Identify slow queries first?
    │   ├─ PostgreSQL -> pg_stat_statements (top queries by total_exec_time)
    │   └─ MySQL -> Performance Schema / slow query log
    │
    ├─ Analyze execution plan?
    │   ├─ PostgreSQL -> EXPLAIN (ANALYZE, BUFFERS, VERBOSE)
    │   ├─ MySQL -> EXPLAIN FORMAT=JSON or EXPLAIN ANALYZE
    │   └─ SQL Server -> SET STATISTICS IO ON; SET STATISTICS TIME ON;
    │
    ├─ Need indexing strategy?
    │   ├─ PostgreSQL -> B-tree (default), GIN (JSONB), GiST (spatial), partial indexes
    │   ├─ MySQL -> BTREE (default), FULLTEXT (text search), SPATIAL
    │   └─ Check: Table >10k rows AND selectivity <10% AND 10x+ speedup verified
    │
    ├─ Schema changes needed?
    │   ├─ New database -> template-schema-design.md
    │   ├─ Modify schema -> template-migration.md (Flyway/Liquibase)
    │   └─ Large tables (MySQL) -> gh-ost / pt-online-schema-change (avoid locks)
    │
    ├─ High availability setup?
    │   ├─ PostgreSQL -> Streaming replication (template-replication-ha.md)
    │   └─ MySQL -> GTID-based replication (template-replication-ha.md)
    │
    ├─ Backup/disaster recovery?
    │   └─ template-backup-restore.md (pg_dump, mysqldump, PITR)
    │
    └─ Analytics on large datasets (OLAP)?
        └─ See data-lake-platform (ClickHouse, DuckDB, Doris, StarRocks)

Read the full file on GitHub · 396 lines

Files

What ships with it

32 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. 27d ago Changed · +21 tokens per session 5df0bd66e3b5
  2. 1mo ago Changed · -6 lines d14576dc2659
  3. 1mo ago First seen · 402 lines · 34 tokens per session scan A 3c5ad0daad07

Subscribe to this mod's changes

data-sql-optimization is a skill published in the GitHub repository joaoguirunas/team-os (5 stars, last pushed 3d ago), licensed MIT. It adds 55 tokens to every session and 4,764 once invoked, about $0.0002 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-08-31.