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 vasilyu1983/AI-Agents-public --skill data-sql-optimizationgit clone --depth 1 https://github.com/vasilyu1983/AI-Agents-publicWrote 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/vasilyu1983/ai-agents-public/data-sql-optimization)<a href="https://agentmods.dev/skills/vasilyu1983/ai-agents-public/data-sql-optimization"><img src="https://agentmods.dev/badge/skills/vasilyu1983/ai-agents-public/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/vasilyu1983/ai-agents-public/data-sql-optimization"><img src="https://agentmods.dev/badge/skills/vasilyu1983/ai-agents-public/data-sql-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00041 | $0.03922 |
| Opus 5.5 | $0.00016 | $0.01569 |
| Sonnet 5.5 | $0.00008 | $0.00784 |
| Haiku 4.5 | $0.00004 | $0.00392 |
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 14d 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 — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SQL Optimization
Out of scope: OLAP engines and lakehouse tuning. Use data-lake-platform for ClickHouse, DuckDB, Doris, StarRocks, Iceberg, Delta Lake, or Hudi.
Quick Reference
Scripts
| Script | What it does | Usage |
|---|---|---|
| scripts/pg_slow_query_triage.sql | Six-section triage report from pg_stat_statements: total time, mean time, I/O, variance, cache-hit ratio, and spills/planning/WAL |
Copy-paste into psql or any SQL client; requires pg_stat_statements extension |
| scripts/explain_collector.py | Collects estimated JSON plans via psql; --analyze opts into query execution |
DATABASE_URL=postgresql://... python explain_collector.py --queries slow.txt |
| scripts/test_explain_collector.py | Offline input, execution-mode and JSON-envelope regressions | python scripts/test_explain_collector.py |
# Triage: paste directly into psql
psql "$DATABASE_URL" -f skills/universal/data-sql-optimization/scripts/pg_slow_query_triage.sql
# Collect estimated plans for reviewed queries (default):
python scripts/explain_collector.py --queries queries.txt --no-analyze --output plans.jsonl
# Collect actual plans (executes queries — review side effects first):
DATABASE_URL=postgresql://user:pass@test-db:5432/db \
python scripts/explain_collector.py --queries queries.txt --analyze --output plans.jsonl
| Need | Start Here | Use When |
|---|---|---|
| Slow query triage | template-slow-query.md | You need a safe intake before changing anything |
| Plan review | references/explain-analysis.md | You already have EXPLAIN, EXPLAIN ANALYZE, Query Store, or Performance Schema evidence |
| Index design or index removal | references/index-patterns.md | You are deciding whether to add, reshape, make invisible, or drop an index |
| Query rewrite | references/query-tuning-patterns.md | A query shape or estimation problem is the likely bottleneck |
| Connection saturation | references/connection-pooling-patterns.md | App pools, PgBouncer, RDS Proxy, Supavisor, or Cloud SQL pooling are involved |
| Monitoring and alerting | references/monitoring-alerting-patterns.md | You need dashboards, baselines, or alerts for database performance |
| Locking / deadlocks | template-lock-analysis.md | The issue is blocking, deadlocks, or long transactions rather than raw query cost |
| Partitioning | references/partition-strategies.md | Retention, pruning, or table growth is driving the change |
| Backup and recovery design | references/recovery-strategy-design.md | You need a recovery capability mapped to failure scenarios, not just a backup job |
| Security or RLS review | template-security-audit.md | You are reviewing least privilege, SQL injection controls, or tenant isolation |
What ships with it
41 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.
- agents/openai.yaml 341 B
- assets/cross-platform/template-backup-restore.md 5.9 KB
- assets/cross-platform/template-diagnostics.md 5.5 KB
- assets/cross-platform/template-explain-analysis.md 3.2 KB
- assets/cross-platform/template-index.md 3.9 KB
- assets/cross-platform/template-lock-analysis.md 6.2 KB
- assets/cross-platform/template-migration.md 5.5 KB
- assets/cross-platform/template-performance-tuning-worksheet.md 7.5 KB
- assets/cross-platform/template-query-tuning.md 3.4 KB
- assets/cross-platform/template-schema-design.md 6.3 KB
- assets/cross-platform/template-security-audit.md 5.7 KB
- assets/cross-platform/template-slow-query.md 4.7 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.4 KB
- assets/mysql/template-replication-ha.md 14 KB
- assets/oracle/template-oracle-explain.md 10 KB
- assets/postgres/template-pg-explain.md 3.3 KB
- assets/postgres/template-pg-index.md 3.6 KB
- assets/postgres/template-pg-rls.md 32 KB
- assets/postgres/template-replication-ha.md 15 KB
- assets/sqlite/template-sqlite-optimization.md 10 KB
- data/sources.json 20 KB
- data/versions.json 2.3 KB
- learnings.consolidated.md 597 B
- learnings.md 357 B
- references/connection-pooling-patterns.md 10 KB
- references/explain-analysis.md 12 KB
- references/index-patterns.md 10 KB
- references/monitoring-alerting-patterns.md 3.5 KB
- references/operational-patterns.md 15 KB
- references/partition-strategies.md 16 KB
- references/query-optimization-research-runtime.md 5.4 KB
- references/query-tuning-patterns.md 18 KB
- references/recovery-strategy-design.md 16 KB
- references/sql-antipatterns.md 14 KB
- references/sql-best-practices.md 2.7 KB
- scripts/explain_collector.py 14 KB runs code
- scripts/pg_slow_query_triage.sql 13 KB
- scripts/test_explain_collector.py 3.4 KB runs code
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.
- 14d ago Changed · -41 lines 78792caffc32
- 26d ago Changed · +13 lines 48b51ea8c7d0
- 1mo ago Changed · +2 lines 79a673987aa2
- 1mo ago First seen · 254 lines · 41 tokens per session scan A 4480c554aab3
data-sql-optimization is a skill published in the GitHub repository vasilyu1983/AI-Agents-public (101 stars, last pushed 4d ago), licensed MIT. It adds 41 tokens to every session and 3,922 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-30.
Other skills, from other repositories
postgresql-table-design
Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.
dev-supabase
Backend development with Supabase. Trigger when the user wants to configure auth, the database, or Supabase storage.
ops-database
Database schema design. Trigger when the user wants to create tables, migrations, or optimize queries.
postgres-patterns
PostgreSQL database patterns for query optimization, schema design, indexing, and security. Quick reference for common patterns, index types, data types, and anti-pattern detection. Based on Supabase best practices.
event-store-design
Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.
cqrs-implementation
Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.