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 cyperx84/claude-code-plugin-examples --skill query-optimizationgit clone --depth 1 https://github.com/cyperx84/claude-code-plugin-examplesWrote 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/cyperx84/claude-code-plugin-examples/query-optimization)<a href="https://agentmods.dev/skills/cyperx84/claude-code-plugin-examples/query-optimization"><img src="https://agentmods.dev/badge/skills/cyperx84/claude-code-plugin-examples/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/cyperx84/claude-code-plugin-examples/query-optimization"><img src="https://agentmods.dev/badge/skills/cyperx84/claude-code-plugin-examples/query-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.00019 | $0.04483 |
| Opus 5.5 | $0.00008 | $0.01793 |
| Sonnet 5.5 | $0.00004 | $0.00897 |
| Haiku 4.5 | $0.00002 | $0.00448 |
Grade A, and why
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 3mo 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 — 736 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Query Optimization
You are a database performance expert specializing in query optimization, indexing strategies, and database performance tuning. You help identify and resolve performance bottlenecks in database queries and operations.
Understanding Query Execution
1. Reading EXPLAIN Plans
PostgreSQL EXPLAIN:
-- Basic EXPLAIN
EXPLAIN SELECT * FROM orders WHERE customer_id = 123;
-- Detailed analysis with ANALYZE
EXPLAIN ANALYZE SELECT * FROM orders WHERE customer_id = 123;
-- Visual format
EXPLAIN (FORMAT JSON) SELECT * FROM orders WHERE customer_id = 123;
Key Metrics to Watch:
EXPLAIN (ANALYZE, BUFFERS, VERBOSE)
SELECT o.*, c.name
FROM orders o
JOIN customers c ON o.customer_id = c.id
WHERE o.created_at > '2024-01-01'
AND o.status = 'completed';
/*
Key indicators:
- Seq Scan: Table scan (usually slow for large tables)
- Index Scan: Using an index (good)
- Index Only Scan: Best - data from index only
- Nested Loop: Join strategy (good for small datasets)
- Hash Join: Join strategy (good for large datasets)
- Sort: Expensive operation, consider indexes
- Buffers: Memory usage
- Actual time: Real execution time
*/
Interpreting Costs:
Cost Structure: cost=0.42..8.44 rows=1 width=136
- First number (0.42): Startup cost
- Second number (8.44): Total cost
- rows: Estimated rows returned
- width: Average row size in bytes
LOWER COST = BETTER PERFORMANCE
2. Query Execution Order
SQL Execution Flow:
-- Written order (logical)
SELECT customer_name, SUM(total) as revenue
FROM orders
WHERE status = 'completed'
GROUP BY customer_name
HAVING SUM(total) > 1000
ORDER BY revenue DESC
LIMIT 10;
-- Actual execution order:
-- 1. FROM orders
-- 2. WHERE status = 'completed'
-- 3. GROUP BY customer_name
-- 4. HAVING SUM(total) > 1000
-- 5. SELECT customer_name, SUM(total)
-- 6. ORDER BY revenue DESC
-- 7. LIMIT 10
Indexing Strategies
1. When to Create Indexes
Good Index Candidates:
-- Foreign keys (for JOINs)
CREATE INDEX idx_orders_customer_id ON orders(customer_id);
-- Frequently filtered columns (WHERE clauses)
CREATE INDEX idx_orders_status ON orders(status);
-- Frequently sorted columns (ORDER BY)
CREATE INDEX idx_orders_created_at ON orders(created_at);
-- Columns used in GROUP BY
CREATE INDEX idx_sales_product_id ON sales(product_id);
-- Columns in JOIN conditions
CREATE INDEX idx_order_items_order_id ON order_items(order_id);
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.
- 3mo ago First seen · 736 lines · 19 tokens per session scan A 8d2b4a216d60
Query Optimization is a skill published in the GitHub repository cyperx84/claude-code-plugin-examples (2 stars, last pushed 1y ago), licensed MIT. It adds 19 tokens to every session and 4,483 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-08-31.
Query Optimization compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| Query Optimizationcyperx84/claude-code-plugin-examples | Skill | 2 | 1y ago | MIT | A | 19 | Claude Code |
| create-prprisma/orm | Skill | 48k | today | Apache-2.0 | A | 47 | Claude Code, Codex |
| schema-explorationlangchain-ai/deepagents | Skill | 32k | today | MIT | A | 57 | Claude Code, Codex |
| atlas-mssqlariga/atlas | Skill | 8.9k | 5d ago | Apache-2.0 | A | 163 | Claude Code |
| ha-data-storesshiwenwen/hope-agent | Skill | 1.9k | today | MIT | A | 115 | Claude Code, Codex |
| pentesting-mysqlxalgorix/xalgorix | Skill | 1.5k | yesterday | Apache-2.0 | A | 65 | Claude Code, Codex |
| nornicdb-cypher-queriesorneryd/NornicDB | Skill | 937 | today | MIT | A | 79 | Claude Code, Codex |