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 AltimateAI/data-engineering-skills --skill optimizing-query-by-idgit clone --depth 1 https://github.com/AltimateAI/data-engineering-skillsWrote 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/altimateai/data-engineering-skills/optimizing-query-by-id)<a href="https://agentmods.dev/skills/altimateai/data-engineering-skills/optimizing-query-by-id"><img src="https://agentmods.dev/badge/skills/altimateai/data-engineering-skills/optimizing-query-by-id/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/altimateai/data-engineering-skills/optimizing-query-by-id"><img src="https://agentmods.dev/badge/skills/altimateai/data-engineering-skills/optimizing-query-by-id.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.00121 | $0.00912 |
| Opus 5.5 | $0.00048 | $0.00365 |
| Sonnet 5.5 | $0.00024 | $0.00182 |
| Haiku 4.5 | $0.00012 | $0.00091 |
Grade A, and why
optimizing-query-by-id 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 — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Optimize Query from Query ID
Fetch query → Get profile → Apply best practices → Verify improvement → Return optimized query
Workflow
1. Fetch Query Details from Query ID
SELECT
query_id,
query_text,
total_elapsed_time/1000 as seconds,
bytes_scanned/1e9 as gb_scanned,
bytes_spilled_to_local_storage/1e9 as gb_spilled_local,
bytes_spilled_to_remote_storage/1e9 as gb_spilled_remote,
partitions_scanned,
partitions_total,
rows_produced
FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY())
WHERE query_id = '<query_id>';
Note the key metrics:
seconds: Total execution timegb_scanned: Data read (lower is better)gb_spilled: Spillage indicates memory pressurepartitions_scanned/total: Partition pruning effectiveness
2. Get Query Profile Details
-- Get operator-level statistics
SELECT *
FROM TABLE(GET_QUERY_OPERATOR_STATS('<query_id>'));
Look for:
- Operators with high
output_rowsvsinput_rows(explosions) - TableScan operators with high bytes
- Sort/Aggregate operators with spillage
3. Identify Optimization Opportunities
Based on profile, look for:
| Metric | Issue | Fix |
|---|---|---|
| partitions_scanned = partitions_total | No pruning | Add filter on cluster key |
| gb_spilled > 0 | Memory pressure | Simplify query, increase warehouse |
| High bytes_scanned | Full scan | Add selective filters, reduce columns |
| Join explosion | Cartesian or bad key | Fix join condition, filter before join |
4. Apply Optimizations
Rewrite the query:
- Select only needed columns
- Filter early (before joins)
- Use CTEs to avoid repeated scans
- Ensure filters align with clustering keys
- Add LIMIT if full result not needed
5. Get Explain Plan for Optimized Query
EXPLAIN USING JSON
<optimized_query>;
6. Compare Plans
Compare original vs optimized:
- Fewer partitions scanned?
- Fewer intermediate rows?
- Better join order?
7. Return Results
Provide:
- Original query metrics (time, data scanned, spillage)
- Identified issues
- The optimized query
- Summary of changes made
- Expected improvement
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 · 133 lines · 121 tokens per session scan A 75953e4bb991
optimizing-query-by-id is a skill published in the GitHub repository AltimateAI/data-engineering-skills (137 stars, last pushed 1mo ago), licensed MIT. It adds 121 tokens to every session and 912 once invoked, about $0.0005 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.
optimizing-query-by-id compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| optimizing-query-by-idAltimateAI/data-engineering-skills | Skill | 137 | 1mo ago | MIT | A | 121 | Claude Code |
| misatarasinmuhammed/misata | Skill | 80 | today | MIT | A | 101 | Claude Code, Codex |
| aegis-dqaegis-dq/aegis-dq | Skill | 7 | 6mo ago | none | A | 42 | Claude Code, Codex |
| backend-patternsMethasit-Pun/data_engineer_claude_skills | Skill | 1 | 4mo ago | none | A | 31 | Claude Code |
| dbt-patternsMethasit-Pun/data_engineer_claude_skills | Skill | 1 | 4mo ago | none | A | 143 | Claude Code |
| data-migrationMethasit-Pun/data_engineer_claude_skills | Skill | 1 | 4mo ago | none | A | 160 | Claude Code |
| schema-designMethasit-Pun/data_engineer_claude_skills | Skill | 1 | 4mo ago | none | A | 143 | Claude Code |