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.
npx skills add joaoguirunas/team-os --skill data-sql-optimizationgit clone --depth 1 https://github.com/joaoguirunas/team-osWrote 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.
[](https://agentmods.dev/skills/joaoguirunas/team-os/data-sql-optimization)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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)
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.
- assets/cross-platform/template-backup-restore.md 5.3 KB
- assets/cross-platform/template-diagnostics.md 5.1 KB
- assets/cross-platform/template-explain-analysis.md 3.2 KB
- assets/cross-platform/template-index.md 3.8 KB
- assets/cross-platform/template-lock-analysis.md 6.2 KB
- assets/cross-platform/template-migration.md 5.4 KB
- assets/cross-platform/template-performance-tuning-worksheet.md 6.8 KB
- assets/cross-platform/template-query-tuning.md 3.4 KB
- assets/cross-platform/template-schema-design.md 6.4 KB
- assets/cross-platform/template-security-audit.md 5.9 KB
- assets/cross-platform/template-slow-query.md 4.9 KB
- assets/mssql/template-mssql-explain.md 11 KB
- assets/mssql/template-mssql-index.md 10 KB
- assets/mysql/template-mysql-explain.md 3.5 KB
- assets/mysql/template-mysql-index.md 3.5 KB
- assets/mysql/template-replication-ha.md 6.4 KB
- assets/oracle/template-oracle-explain.md 10 KB
- assets/postgres/template-pg-explain.md 3.4 KB
- assets/postgres/template-pg-index.md 3.7 KB
- assets/postgres/template-pg-rls.md 28 KB
- assets/postgres/template-replication-ha.md 6.4 KB
- assets/sqlite/template-sqlite-optimization.md 10 KB
- data/sources.json 5.0 KB
- references/connection-pooling-patterns.md 13 KB
- references/explain-analysis.md 4.4 KB
- references/index-patterns.md 6.1 KB
- references/monitoring-alerting-patterns.md 13 KB
- references/operational-patterns.md 18 KB
- references/partition-strategies.md 14 KB
- references/query-tuning-patterns.md 4.4 KB
- references/sql-antipatterns.md 6.1 KB
- references/sql-best-practices.md 6.3 KB
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.
- 27d ago Changed · +21 tokens per session 5df0bd66e3b5
- 1mo ago Changed · -6 lines d14576dc2659
- 1mo ago First seen · 402 lines · 34 tokens per session scan A 3c5ad0daad07
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.
Other skills, from other repositories
elasticsearch-best-practices
Elasticsearch development best practices for indexing, querying, and search optimization.
kysely
Guidelines for developing with Kysely, a type-safe TypeScript SQL query builder with autocompletion support.
pyspark-etl
Best practices for building performant, testable PySpark ETL pipelines with Spark SQL and Apache Iceberg. Use when writing or reviewing PySpark jobs, designing joins and window functions, working with map/array higher-order functions, or building idempotent cumulative/snapshot table merges.
drizzle-orm
Guidelines for developing with Drizzle ORM, a lightweight type-safe TypeScript ORM with SQL-like syntax.
mysql-best-practices
MySQL development best practices for schema design, query optimization, and database administration.
postgresql-best-practices
PostgreSQL development best practices for schema design, query optimization, and database administration.