/data-engineering-skills:optimizing-sql-queriesfrom data-engineering-skills
Optimizes slow analytical SQL by reading EXPLAIN plans, reducing scanned data, fixing join strategy, and applying partitioning/clustering/indexes across Postgres, Snowflake, BigQuery, Databricks/Spark SQL, and Redshift.
Ships in data-engineering-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
- [ ] Read the actual query/EXPLAIN plan (not guesses)
- [ ] Find the dominant cost: scan, join, aggregation, or sort/spill
- [ ] Reduce data read (predicates, partition/cluster pruning, column pruning)
- [ ] Fix join strategy (order, keys, broadcast vs shuffle, skew)
- [ ] Re-measure and confirm the plan changed
EXPLAIN (ANALYZE, BUFFERS) <query>SYSTEM$EXPLAIN_PLAN_JSON--dry_run for bytes billeddf.explain("formatted") or the SQL plan tabEnable partition/cluster pruning — push filters on the partition/cluster key so the engine skips files. On BigQuery/Snowflake this is the single biggest lever.
-- Good: filter on the partitioning column with a literal/range so pruning applies
SELECT user_id, SUM(amount)
FROM orders
WHERE order_date >= '2026-01-01' AND order_date < '2026-02-01' -- prunes partitions
GROUP BY user_id;
Filter before joining, not after. Reduce each side to the needed rows/columns first so the join processes less data.
Prefer explicit column lists over SELECT * in columnar warehouses — reading
fewer columns reads fewer bytes.
Choose the right join for the sizes. A small dimension joined to a large fact
should broadcast (map-side) rather than shuffle. In Spark, let Adaptive Query
Execution pick, or hint /*+ BROADCAST(dim) */.
Aggregate/pre-filter in a CTE to shrink data before an expensive window or join, rather than computing over the full table.
WHERE DATE(ts) = ...) disables
pruning — filter on a raw range instead.SELECT DISTINCT to hide a fan-out join — fix the join grain instead; it is
cheaper and correct.OR across columns often prevents index/pruning use — rewrite as UNION ALL
or IN.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub unknown-333/awesome-data-engineering-skills --plugin data-engineering-skills36 skills in this plugin
/authoring-airflow-dagsWrite production-grade Apache Airflow DAGs using the TaskFlow API — idempotent tasks, correct scheduling and catchup, retries/SLAs, connections/variables, and avoiding top-level code. Use when creating or reviewing Airflow DAGs, scheduling pipelines, wiring task dependencies, configuring retries/backfills, or fixing non-idempotent tasks./building-dagster-assetsBuild Dagster pipelines using software-defined assets — asset dependencies, partitions, resources and IO managers, asset checks, and schedules/sensors. Use when creating Dagster assets or jobs, modeling data as assets, adding partitions or backfills, wiring resources/IO managers, or migrating from task-based orchestration to assets./Other plugins' skills for the same job