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 nWave-ai/nWave --skill nw-query-optimizationgit clone --depth 1 https://github.com/nWave-ai/nWaveWrote 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/nwave-ai/nwave/nw-query-optimization)<a href="https://agentmods.dev/skills/nwave-ai/nwave/nw-query-optimization"><img src="https://agentmods.dev/badge/skills/nwave-ai/nwave/nw-query-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/nwave-ai/nwave/nw-query-optimization"><img src="https://agentmods.dev/badge/skills/nwave-ai/nwave/nw-query-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.00032 | $0.01278 |
| Opus 5.5 | $0.00013 | $0.00511 |
| Sonnet 5.5 | $0.00006 | $0.00256 |
| Haiku 4.5 | $0.00003 | $0.00128 |
Grade A, and why
nw-query-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 2mo 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 — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Query Optimization
Cost-Based Optimization
Modern relational DBs use cost-based optimizers (CBO): generate plan candidates -> estimate cost via statistics (row counts, distributions, selectivity) -> select lowest I/O/CPU/memory plan. Stale statistics lead to suboptimal plans.
Execution Plan Analysis
Validate optimization with EXPLAIN before and after changes.
-- PostgreSQL (add ANALYZE for actual runtime stats)
EXPLAIN ANALYZE SELECT order_id, total FROM orders WHERE customer_id = 12345;
-- MySQL: EXPLAIN FORMAT=JSON ... | SQL Server: SET STATISTICS IO ON
Key indicators: Seq Scan/Table Scan = missing index | Index Scan/Seek = efficient | Hash Join = large equality joins | Nested Loop = small/indexed inner | Merge Join = pre-sorted inputs | Sort = watch disk spills
Indexing Strategies
B-Tree (Default)
Supports: equality, range, sorting, prefix matching | O(log n) lookup | General-purpose, all major DBs default
Hash
Equality only | O(1) lookup | High-cardinality exact-match | No range/sorting/pattern support
Covering Indexes
Include all query columns in index -> eliminates table access (index-only scan) | Trade-off: larger index, slower writes
-- Covering index for: SELECT name, email FROM users WHERE status = 'active'
CREATE INDEX idx_users_status_covering ON users(status) INCLUDE (name, email);
PostgreSQL Specialized
- GiST: Geometric data, full-text search, nearest-neighbor
- GIN: Arrays, full-text search, JSONB queries
- BRIN: Large tables with physically correlated data (timestamps), minimal storage
- SP-GiST: Non-balanced structures, point-based geometric queries
Compound Index Design
Order by: 1. Equality conditions first (highest selectivity) | 2. Sort columns second | 3. Range conditions last
MongoDB ESR Rule
Equality-Sort-Range ordering for compound indexes:
// Query: status = "A", qty > 20, sorted by item
// Optimal index:
db.collection.createIndex({ status: 1, item: 1, qty: 1 })
// E(quality) S(ort) R(ange)
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.
- 2mo ago First seen · 116 lines · 32 tokens per session scan A 6738e287f7db
nw-query-optimization is a skill published in the GitHub repository nWave-ai/nWave (636 stars, last pushed 11d ago), licensed MIT. It adds 32 tokens to every session and 1,278 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-09-03.
nw-query-optimization compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| nw-query-optimizationnWave-ai/nWave | Skill | 636 | 11d ago | MIT | A | 32 | Claude Code |
| test-database-seedingmakifbaysal/tasktrooper | Skill | 123 | today | Apache-2.0 | A | 37 | Claude Code, Codex |
| flux-recontonone-ai/tonone | Skill | 84 | 2d ago | MIT | A | 48 | Claude Code |
| V3 Memory Unificationruvnet/ruflo | Skill | 83k | today | MIT | A | 51 | Claude Code |
| tdd-workflowDVNghiem/FlowDeck | Skill | 44 | 15d ago | MIT | A | 39 | Claude Code, Codex |
| matt-tdddeepklarity/harness-kit | Skill | 108 | 20d ago | MIT | A | 51 | Claude Code |
| api-baas-neonagents-inc/skills | Skill | 28 | 1mo ago | MIT | A | 20 | Claude Code, Codex |