snowflake-query-optimization

snowflake-query-optimization is a skill for Claude Code from AltimateAI/data-engineering-skills. It costs 221 tokens per session (5,449 once invoked), scanned A, original, MIT.

An end-to-end workflow for improving a Snowflake query, a SQL request run in Snowflake's cloud data warehouse. It retrieves the query, rewrites it, checks that results match, benchmarks it, and reports the outcome.

In plain words
What is it for?
Use it to optimize a SQL file or a Snowflake query ID, compare old and new results, measure performance, and produce a report.
Why use it?
It avoids treating a rewrite as successful without checking correctness and speed. It also gathers the required query and performance information from Snowflake.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Claude Code.

Part of the snowflake-skills plugin — 6 skills shipped together

Good fit Use it to optimize a SQL file or a Snowflake query ID, compare old and new results, measure performance, and produce a report.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/altimateai/data-engineering-skills/snowflake-query-optimization
Install

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.

Any agent
npx skills add AltimateAI/data-engineering-skills --skill snowflake-query-optimization
Clone the repo
git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills

Made for: Claude Code.

Or install snowflake-skills, the plugin that ships this one along with the rest of its 6 skills.

Wrote 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.

agentmods badge for snowflake-query-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/altimateai/data-engineering-skills/snowflake-query-optimization/github.svg)](https://agentmods.dev/skills/altimateai/data-engineering-skills/snowflake-query-optimization)
Your own site
<a href="https://agentmods.dev/skills/altimateai/data-engineering-skills/snowflake-query-optimization"><img src="https://agentmods.dev/badge/skills/altimateai/data-engineering-skills/snowflake-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.

agentmods 80×15 button for snowflake-query-optimization

Your own site · 80×15
<a href="https://agentmods.dev/skills/altimateai/data-engineering-skills/snowflake-query-optimization"><img src="https://agentmods.dev/badge/skills/altimateai/data-engineering-skills/snowflake-query-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 221 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,449 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00221 $0.05449
Opus 5.5 $0.00088 $0.02180
Sonnet 5.5 $0.00044 $0.01090
Haiku 4.5 $0.00022 $0.00545

Measured today against content hash 4f86a04e144f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

snowflake-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 today.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/parity_bench.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/snowflake/snowflake-query-optimization/SKILL.md · 499 lines

How it starts

The opening of the file, as written. The whole thing — 499 lines — stays where its author put it; the contents beside it link to each section on GitHub.

snowflake-query-optimization

Input (one of) → fetch SQL → optimize → parity-validate → benchmark → report.

Delegates warehouse work to altimate-code when available; falls back to direct Snowflake SQL otherwise. Does not reinvent query-profile parsing.

When NOT to use this skill

  • Pasted SQL text, no parity needed → optimizing-query-text.
  • Quick rewrite from a query_id, no re-run or parity → optimizing-query-by-id.
  • Finding candidate queries to optimize → finding-expensive-queries.
  • Refactoring a dbt model → snowflake-dbt-model-refactoring.

Prerequisites

Before invoking, verify what's actually available — do not fabricate results from file reads alone.

command -v altimate-code     # preferred delegate
command -v snowsql           # fallback client (any Snowflake client works)

Must have (one of):

  • altimate-code installed and configured with a Snowflake connection, OR
  • a working Snowflake client (snowsql, dbt adapter, Python with snowflake-connector-python, etc.) and credentials for the account.

Grants required on the Snowflake role:

  • SELECT on SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY (preferred), or the ability to run INFORMATION_SCHEMA.QUERY_HISTORY() (fallback).
  • USAGE on the warehouse referenced by the baseline query (needed to re-run it for comparison).

If neither path is available, stop and tell the user.

Time budget

Target end-to-end runtime: ≤5 min (300s), hard ceiling 6 min (360s), excluding Phase 4 parity + Phase 5 benchmark re-runs, which scale with the baseline query's cost and are exempt from the cap. A query being optimized is often slow by nature — forcing parity into a 90s window would push the agent to skip the mandatory hard stop.

Per-phase caps (sum ≤ 300s, parity/benchmark separate): Phase 1 ≤30s · Phase 2 ≤45s · Phase 3 ≤75s · Phase 4 overhead ≤60s (plus re-run time) · Phase 5 overhead ≤30s (plus one re-run of the optimized query). If a non-parity phase exceeds its budget, stop the extra work and move on.

Read the full file on GitHub · 499 lines

Files

What ships with it

1 file 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.

Changes

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.

  1. today First seen · 499 lines · 221 tokens per session scan A 4f86a04e144f

Subscribe to this mod's changes

snowflake-query-optimization is a skill published in the GitHub repository AltimateAI/data-engineering-skills (130 stars, last pushed yesterday), licensed MIT. It adds 221 tokens to every session and 5,449 once invoked, about $0.0009 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-10-28.

Related

Other skills, from other repositories

misata

Generate relational test, demo or evaluation data from a declared schema with Misata, where every declaration (foreign keys, unique and CHECK rules, monthly revenue curves, rates, group shares, ledger identities) holds exactly or is refused before generation, then attest the files. Use when a task needs a seeded…

rasinmuhammed/misata · 101 tokens

backend-patterns

Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.

Methasit-Pun/data_engineer_claude_skills · 31 tokens

dbt-patterns

The most important design decision in a dbt project is how to organize model layers. A clear layer structure means every model has exactly one place it belongs, and anyone reading the project can understand what each model does.

Methasit-Pun/data_engineer_claude_skills · 143 tokens

data-migration

Moving data between systems safely — cutover planning, backfill strategies, dual-write patterns, validation, rollback procedures, and zero-downtime migration techniques. Use this skill whenever the team is migrating from one database or warehouse to another (MySQL → Snowflake, Redshift → BigQuery, on-prem → cloud)…

Methasit-Pun/data_engineer_claude_skills · 160 tokens

schema-design

Data modeling for analytical workloads — star schema, snowflake schema, one big table (OBT), slowly changing dimensions (SCD), normalization tradeoffs, grain definition, and surrogate key strategies. Use this skill whenever the user is designing or reviewing a data warehouse schema, planning a fact/dimension table…

Methasit-Pun/data_engineer_claude_skills · 143 tokens

sql-patterns

Best-practice SQL for analytical workloads — window functions, CTEs, query optimization, partitioning strategies, and anti-patterns to avoid. Use this skill whenever the user is writing or reviewing a SQL query that goes beyond a basic SELECT, especially on BigQuery, Snowflake, Redshift, or DuckDB. Trigger on mentions…

Methasit-Pun/data_engineer_claude_skills · 137 tokens