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 erikdarlingdata/claude-plugins --skill tune-a-querygit clone --depth 1 https://github.com/erikdarlingdata/claude-pluginsWrote 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/erikdarlingdata/claude-plugins/tune-a-query)<a href="https://agentmods.dev/skills/erikdarlingdata/claude-plugins/tune-a-query"><img src="https://agentmods.dev/badge/skills/erikdarlingdata/claude-plugins/tune-a-query/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/erikdarlingdata/claude-plugins/tune-a-query"><img src="https://agentmods.dev/badge/skills/erikdarlingdata/claude-plugins/tune-a-query.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.00066 | $0.02144 |
| Opus 5.5 | $0.00026 | $0.00858 |
| Sonnet 5.5 | $0.00013 | $0.00429 |
| Haiku 4.5 | $0.00007 | $0.00214 |
Grade A, and why
tune-a-query 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 yesterday.
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 — 87 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Tune a query
Do the steps in order. Do not write a rewrite before step 4.
Steps 3 to 5 run queries. Run them on a copy of the database, never on production. The copy is a restored or cloned database on a server that no user depends on. If you do not know which server is the copy, ask before you run anything.
Steps 1 and 2, and getting the repro script in step 3, only read. On production, run only the sources that those steps name. Do not install anything on production, and do not run the slow query there.
This skill is for queries that read data. If the slow statement changes data (INSERT, UPDATE, DELETE or MERGE), ask the user how to test it on the copy.
1. Find it
- Get the query text, its plans and its runtime history. Use the first source that you have:
- The Performance Monitor MCP server (Lite or Darling):
get_top_queries_by_cpu,get_top_procedures_by_cpu,get_query_store_topandget_query_trend. Tool names change between versions, so read the server's tool list first. sp_QuickieStorefor Query Store data, orsp_QuickieCachefor the plan cache. Both are in Erik Darling's DarlingData repository.- The Query Store views:
sys.query_store_query,sys.query_store_planandsys.query_store_runtime_stats.
- The Performance Monitor MCP server (Lite or Darling):
- Record how often it runs, how long it takes, and whether that changed recently.
- If it got slow on a specific day, look for what changed that day before you rewrite anything. Examples are a new plan, a deployment, a statistics update and a large data load. A query that got slow last Tuesday is a different problem from a query that was always slow.
2. Read the plan
- Read the plan with a plan tool. Do not read the plan XML yourself. Use the sqlserver-query-plans plugin, the Performance Studio MCP server, or
analyze_query_planon the Performance Monitor MCP server. - Write down where the time goes: operator times, estimated rows against actual rows, spills and waits.
- Cost percentages are estimates. If you have actual operator times, ignore the cost percentages.
- A plan from the plan cache or Query Store has no actual row counts and no operator times. After step 3, get the actual plan from the copy and read it the same way.
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.
- yesterday First seen · 87 lines · 66 tokens per session scan A d2ca1460f118
tune-a-query is a skill published in the GitHub repository erikdarlingdata/claude-plugins (33 stars, last pushed yesterday), licensed MIT. It adds 66 tokens to every session and 2,144 once invoked, about $0.0003 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-12-01.
tune-a-query compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| tune-a-queryerikdarlingdata/claude-plugins | Skill | 33 | yesterday | MIT | A | 66 | Claude Code |
| triage-issuesgoogleapis/mcp-toolbox | Skill | 17k | today | Apache-2.0 | A | 164 | Claude Code, Codex |
| postgresql-indexingprowler-cloud/prowler | Skill | 15k | yesterday | Apache-2.0 | A | 108 | Claude Code |
| sql-optimization-patternssickn33/agentic-awesome-skills | Skill | 51k | yesterday | MIT | A | 28 | Claude Code |
| graphjin-evaldosco/graphjin | Skill | 3.2k | 4d ago | Apache-2.0 | A | 27 | Claude Code, Codex |
| axiom-audit-grdb-performanceCharlesWiltgen/Axiom | Skill | 1.3k | yesterday | MIT | A | 43 | Codex |
| byted-bytehouse-slow-querybytedance/agentkit-samples | Skill | 496 | 2d ago | Apache-2.0 | A | 74 | Claude Code, Codex |