Analyzing Data
astronomer/agents
Queries the data warehouse with SQL and answers business questions about data.
Analyze DBSQL queries, including SQL embedded in notebooks (spark.sql(...), %sql cells), for anti-patterns, lint issues, and performance problems, using Databricks-specific dialect and platform…
$ npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install AltimateAI/data-engineering-skills optimizing-databricks-sql --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/databricks/optimizing-databricks-sql .claude/skills/optimizing-databricks-sql && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "optimizing-databricks-sql" agent skill from https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/databricks/optimizing-databricks-sql into .claude/skills/optimizing-databricks-sql/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimizing-databricks-sql", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/databricks/optimizing-databricks-sqlType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install AltimateAI/data-engineering-skills optimizing-databricks-sql --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/databricks/optimizing-databricks-sql .agents/skills/optimizing-databricks-sql && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "optimizing-databricks-sql" agent skill from https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/databricks/optimizing-databricks-sql into .agents/skills/optimizing-databricks-sql/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimizing-databricks-sql", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install AltimateAI/data-engineering-skills optimizing-databricks-sql --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/databricks/optimizing-databricks-sql .cursor/skills/optimizing-databricks-sql && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "optimizing-databricks-sql" agent skill from https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/databricks/optimizing-databricks-sql into .cursor/skills/optimizing-databricks-sql/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimizing-databricks-sql", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/AltimateAI/data-engineering-skills.git --path skills/databricks/optimizing-databricks-sql--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install AltimateAI/data-engineering-skills optimizing-databricks-sql --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/databricks/optimizing-databricks-sql .gemini/skills/optimizing-databricks-sql && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "optimizing-databricks-sql" agent skill from https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/databricks/optimizing-databricks-sql into .gemini/skills/optimizing-databricks-sql/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimizing-databricks-sql", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install AltimateAI/data-engineering-skills optimizing-databricks-sqlInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/databricks/optimizing-databricks-sql .github/skills/optimizing-databricks-sql && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "optimizing-databricks-sql" agent skill from https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/databricks/optimizing-databricks-sql into .github/skills/optimizing-databricks-sql/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimizing-databricks-sql", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install AltimateAI/data-engineering-skills optimizing-databricks-sql --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/databricks/optimizing-databricks-sql .opencode/skills/optimizing-databricks-sql && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "optimizing-databricks-sql" agent skill from https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/databricks/optimizing-databricks-sql into .opencode/skills/optimizing-databricks-sql/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimizing-databricks-sql", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
optimizing-databricks-sqlAnalyze DBSQL queries, including SQL embedded in notebooks (spark.sql(...), %sql cells), for anti-patterns, lint issues, and performance problems, using Databricks-specific dialect and platform…
Optimizing Databricks SQL is an agent skill from AltimateAI/data-engineering-skills. Analyze DBSQL queries, including SQL embedded in notebooks (spark.sql(...), %sql cells), for anti-patterns, lint issues, and performance problems, using Databricks-specific dialect and platform knowledge (Delta, Photon, Unity Catalog) layered on top of altimate-code's generic SQL engine. Use when a user asks to optimize, review, or lint DBSQL queries on Databricks, whether standalone or embedded in a notebook.
Its SKILL.md is about 6.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `references/dbsql-anti-patterns.md`, `references/delta-table-health.md` and `references/rewrite-engine-gaps.md`).
It sits in Databases, covering SQL, Linting and formatting and Data pipelines and ETL. It works with Databricks, SQL and Apache Spark. The repository describes itself as: Skills related to Data Engineering Work for Claude Code. The licence is MIT.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 705c68b. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
databricksFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Optimizing Databricks SQL loads about 6.7k tokens when it runs, and up to ~16k if it reads all its reference files. Until then it costs about 111 tokens; SKILL.md has 3,311 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from AltimateAI/data-engineering-skills at commit 705c68b, republished under its MIT licence (© AltimateAI). 3,311 words, ~6,658 tokens.
.claude/skills/optimizing-databricks-sql/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.A Databricks/Delta-platform overlay, not a standalone optimizer. The
generic rewrite/analyze/verify pipeline (Steps 1, 5, 6) is the same
pipeline altimate-code's native query-optimize skill runs — same tool
calls, same composition. This skill's only job is the part query-optimize
structurally can't do: detecting Databricks/Delta platform-specific issues
(Z-ordering, table statistics, Photon UDF blocking) that need table
metadata and Databricks docs knowledge, not just query text, and folding
those findings in alongside the generic ones.
If query-optimize is installed in the current environment, prefer
invoking it for Steps 1/5/6 and layer Steps 2–4's Databricks-specific
findings on top of its output, the same way sql-review defers to
sibling skills instead of duplicating them. If it isn't available (e.g.
this skill is running standalone, outside altimate-code), fall back to
calling the same tools directly as described below — the tool calls are
identical either way, so behavior doesn't change based on which path ran.
No rewrite is reported as "optimized" until it clears the validation gate in Step 7 — that gate is a hard requirement, not a suggestion.
Use when:
Do NOT use for:
query-optimize directly.sql-review..collect(), .join(), UDFs used as
Python objects) → deferred to a later phase, out of scope for now.Confirm the resolved file path matches what was requested, before
doing anything else. If the user gave an explicit path (a
/Workspace/... path, a repo path, any specific path), the tool used to
read or write it must resolve to that exact path — not a same-named
file found some other way. If the proper access tool fails, or the only
way to find something is a generic filename search, stop and disclose
it explicitly before analyzing or writing anything: state what path
was requested, what (if anything) was found instead and where, and ask
how to proceed. Never silently substitute a different file and continue
as if it's the same one.
If no specific path was given at all (a generic request naming no file), a broader search — local files, a workspace listing — is a reasonable way to find a match. But the report must still state which path was actually used, so the reader can confirm it's the right one rather than discovering it was wrong after the fact.
| Step | Action | Tool(s) | Detail |
|---|---|---|---|
| 0. Locate warehouse | Confirm a Databricks connection exists; get its name for later calls | warehouse_list | — |
| 1. Baseline | Run with dialect: databricks, plus the composite validate/lint/safety/PII pass | sql_analyze, altimate_core_check | via query-optimize if available; see below if parsing fails |
| 2. Platform overlay | Cross-check against Databricks/Delta patterns the generic engine structurally can't detect from query text alone | — | references/dbsql-anti-patterns.md |
| 3. Ground truth | If a warehouse connection exists, confirm claims against real table metadata before stating them as fact | schema_inspect, sql_execute (DESCRIBE DETAIL) | references/delta-table-health.md |
| 4. Classify | Tag each finding predicate-level vs. strategy-level | sql_explain (EXPLAIN FORMATTED) | see below |
| 5. Rewrite | Generate and verify a fix | altimate_core_rewrite (verify_equivalence: true), altimate_core_equivalence for hand-authored fallbacks | see below, via query-optimize if available |
| 6. Grade | Present grade + findings, tagged by source | altimate_core_grade | via query-optimize if available |
| 7. Validate | Correctness + performance gate | — | references/validation.md |
| 8. Apply | Write the rewrite back, only on explicit confirmation | file edit | see below |
Confirmed twice in live testing: sql_analyze/altimate_core_check and
related tools (altimate_core_validate, altimate_core_migration)
cannot reliably parse DDL (CREATE TABLE ...) or MERGE statements —
either failing outright or returning nothing, sometimes inconsistently
across tools on the identical text. This is a real tool-coverage gap,
not a signal that the statement has no findings. When it happens, fall
back to live execution for grounding instead of treating the parse
failure as "nothing to report": run the statement (or EXPLAIN/
DESCRIBE DETAIL against it) directly via sql_execute, and reason from
what actually happens — a real parse/constraint error from the engine
itself (e.g. NON_LAST_MATCHED_CLAUSE_OMIT_CONDITION,
[MANAGED_TABLE_FORMAT]) is stronger, more specific evidence than any
static tool's silence would have been anyway.
When Step 0 found a live Databricks warehouse connection, don't call a
query expensive on text alone — confirm it. schema_inspect the
referenced tables (pass the warehouse name from Step 0), both to ground
table-health claims in real metadata and to build the schema_context
Step 5's rewrite/equivalence calls need for accurate table/column
resolution. For any Delta table involved, run DESCRIBE DETAIL <table>
via sql_execute to get real sizeInBytes/numFiles. Check statistics
proactively here, on every referenced table — don't wait to discover a
missing-stats finding as a side effect of running EXPLAIN in Step 4.
Full methodology, the stats cost ladder, and the samples.* gotcha are in
references/delta-table-health.md —
read it before making any stats-related recommendation. Default to the
cheapest check that answers the actual question:
ANALYZE TABLE ... COMPUTE STATISTICS NOSCAN for size-only questions
(e.g. broadcast eligibility), escalating to FOR COLUMNS (targeted) or
FOR ALL COLUMNS only if genuinely needed. ANALYZE TABLE is a
recommend-only action — see the confirmation rule below.
Predicate-level (function-wrapped filter, redundant cast, non-sargable
comparison — expressible as alternate literal SQL text): run
EXPLAIN FORMATTED on the original and check whether the plan's
RequiredDataFilters/PushedFilters already reflect the fixed form.
DATE(col)='X' predicate) — still recommend
the explicit rewrite, but justify it on standards/portability grounds
(not guaranteed on other runtimes/engines, small recurring compile-time
cost), not as a performance claim, since EXPLAIN showed no plan
difference on this data.Example — checking whether the runtime already rewrote the predicate:
Original: ... WHERE DATE(order_ts) = '2024-01-01'. Run
EXPLAIN FORMATTED on that exact text and read the scan node's
PushedFilters/RequiredDataFilters. (DATE() predicates are a tracked
rewrite-engine gap — see
references/rewrite-engine-gaps.md
#2 for how to actually produce the rewrite text; this example is about
which verdict the classification earns, not how to generate the fix.)
Case A — plan already shows the range form:
+- Relation sales.orders[...]
PushedFilters: [order_ts >= 2024-01-01 00:00:00, order_ts < 2024-01-02 00:00:00]Report it as: "No measured gain on this engine — EXPLAIN shows an
identical plan either way. Recommended for portability: a different
engine, an older Databricks Runtime, or a Photon-disabled session isn't
guaranteed to constant-fold this the same way." Step 7's verdict for
this one must be Correct, not faster — never Optimized.
Case B — plan still shows the function-wrapped form:
+- Relation sales.orders[...]
PushedFilters: [isnotnull(order_ts)]
-- DATE(order_ts) evaluated per-row in the Filter node above the scanSame rewrite, different justification: the current plan evaluates
DATE() per row and can't push the predicate into file pruning. This one
can legitimately reach Optimized if Step 7's Tier 1/Tier 2 checks
confirm an actual measured or structural improvement.
Why still rewrite it in Case A, if EXPLAIN shows no difference?
Cases A and B produce the same recommended SQL text for different
reasons, and reporting the wrong reason is worse than reporting none.
Case A's rewrite is insurance against something this session can't
observe — a future migration or runtime change; Case B's is a fix for
something this session directly measured. Collapsing both into one
"this is bad, fix it" verdict would overstate Case A's evidence, and it's
exactly the kind of claim the Step 7 gate exists to catch — a rewrite
labeled "Optimized" with no EXPLAIN/query.history difference behind
it.
Strategy-level (join type, shuffle/Exchange placement, aggregation
approach, broadcast decision — a plan-level choice with no equivalent SQL
text): don't try to write literal SQL for this — there is none. Instead:
EXPLAIN's Optimizer Statistics section first. A cost-based
choice (e.g. not broadcasting a small table) is often just downstream
of missing/stale statistics (see dbsql-anti-patterns.md #2b). If so,
recommend ANALYZE TABLE ... COMPUTE STATISTICS — this lets the
optimizer adapt as data changes, which is more robust than freezing
today's decision. Recommend it; don't run it (confirmation rule below)./*+ BROADCAST(t) */) as an explicit override —
flag it as forcing a decision rather than fixing a root cause, and note
it needs revisiting if data volume changes (a hint doesn't adapt).Every proposal from either path — tool-generated or hand-authored — still goes through the Step 7 validation gate. Classification decides what's worth proposing, not whether it needs verification.
altimate_core_rewrite(sql, schema_context, verify_equivalence: true)
first, every time, regardless of past results — one call proposes a
rewrite and proves it's semantically equivalent, partitioning results
into verified-safe vs. review-before-applying.EXPLAIN,
DESCRIBE DETAIL) — never from general SQL knowledge alone — then
verify explicitly with altimate_core_equivalence(sql1: original, sql2: candidate, schema_context), since there's no
altimate_core_rewrite call to attach verify_equivalence to for a
hand-authored candidate.Every path — tool-generated or hand-authored, tracked gap or novel — still goes through the Step 7 validation gate. An empty tool result doesn't mean there's nothing to propose, and nothing here is exempt from validation.
Present: grade, findings (tagged generic-engine / Databricks-specific
overlay / outside the defined pattern set — see below), and the verified
rewrite if one exists. If a query has nothing safe to rewrite (e.g. an
unfiltered SELECT * with no predicate to fix), say so — flag it, don't
force a rewrite that changes semantics just to have something to show.
Beyond the defined pattern set. sql_analyze's full rule set,
altimate_core_check's syntax/safety/PII pass, and
dbsql-anti-patterns.md's catalog can all come back clean while
something genuinely wrong is still visible in evidence already gathered
in Step 3/4 (an EXPLAIN shape, a DESCRIBE DETAIL result, a
query.history pattern) that just doesn't match either catalog's
entries. Don't suppress that for lack of a matching rule — propose it,
held to the same bar as everything else in this skill:
If genuinely nothing is found and nothing evidence-grounded suggests itself either, that's the "nothing safe to rewrite" branch above — say so plainly, don't manufacture a finding just to have something to report.
Two independent, both-required checks, run via references/validation.md:
Step 5's equivalence check (verify_equivalence: true, or a follow-up
altimate_core_equivalence call for hand-authored fallbacks) checks
logical/semantic equivalence; this gate additionally checks the rewrite is
actually measurably faster against real execution — a different
question equivalence doesn't answer.
If either check fails, is inconclusive, or can't be run (no warehouse
connection), say so plainly — "semantically unverified," "no measured
improvement," "couldn't validate — here's why." Every claim about what the
engine did (a plan showing a rewrite, a table's size) must trace back to an
actual tool call made in this session, not general knowledge of how
Spark/Databricks usually behaves.
Correctness checks are not composed ad hoc: decide scope first (window vs.
full table — validation.md §Step 1, including the mandatory
data-availability check before windowing), then use the tool-call recipe
in validation.md §Step 2, not a freehand query. data_diff is reserved
for cross-platform migration validation or localizing an already-found
mismatch — see validation.md §Step 2 for why it isn't the default.
Never hand-type checksum SQL from memory or by reasoning about what the
logic "should" look like — follow the explicit tool-call recipe in
validation.md instead.
ANALYZE TABLEEvery other command this skill runs is read-only (SELECT, DESCRIBE,
EXPLAIN, SHOW STATISTICS). ANALYZE TABLE ... COMPUTE STATISTICS is
different — it triggers a real scan (cost and time scaling with table
size) and writes new metadata. Recommending it is fine and expected;
running it without asking first is not, regardless of whether the session
is in an auto-approve/"yolo" mode that would normally skip confirmation for
other tool calls. State the recommendation and the exact command, then
wait for explicit go-ahead. Applies every time ANALYZE TABLE comes up —
Step 3's proactive stats check and Step 4's strategy-level findings alike.
Presenting a verified rewrite is not the same as shipping it. After the
report, if the rewrite's correctness was verified (verdict Optimized or
Structurally optimized, timing pending — never Not verifiable, and
never a candidate the equivalence check itself left as
review-before-applying), ask the user explicitly whether to apply it to
the source file or notebook cell. Only write the change after an
explicit yes — the same confirm-then-act pattern as ANALYZE TABLE
above, and for the same reason: a verified rewrite is safe to
recommend unconditionally, but writing to the user's file is not
something to do without asking, auto-approve session or not.
The confirmation prompt itself must restate the verdict, not just
correctness. Don't rely on the full report having appeared earlier in
the conversation — a user deciding right now whether to overwrite their
file needs the decision-relevant facts in front of them at the point of
decision: the verdict name (Optimized vs. Structurally optimized, timing pending — these mean different things about how much performance
confidence exists), and the Source: if the rewrite was hand-authored
rather than tool-generated (a gap-workaround rewrite arguably deserves
more scrutiny before writing than a tool-verified one). "Correctness
verified" by itself is half of what Step 7 established, and presenting
only that half at the one moment a file is actually about to change is
worse than presenting it in the full report, not equivalent to it.
Never report "File updated" without confirming the write actually happened. Confirmed live: a session reported "File updated — the file now reads: [new SQL]" when the file was, in fact, unchanged — no write tool was available for that file path, and the failure was never checked. A different run, hitting the identical missing-capability gap, correctly said so instead of asserting success. After attempting a write, verify it — read the file back, or check the write tool's own success/failure return, whichever is available — before claiming anything changed. If there's no working write capability for this file path at all, say that plainly (the way the second run did) rather than describing a change that didn't happen. This is the same "don't assert, verify" discipline as everywhere else in this skill, applied to the one step whose entire job is confirming something real changed.
A notebook cell containing spark.sql("...") or a %sql magic cell is
still DBSQL, in scope the same as a standalone saved query:
spark.sql("..."), %sql cells)..collect(), UDFs as Python objects,
.join()/.groupBy() calls, caching, broadcast hints. sql_analyze
structurally can't see non-SQL-text code; analyzing it needs
pyspark-anti-patterns.md, which is deferred. Extract and analyze the
embedded SQL only.| File | Contents | Read when |
|---|---|---|
| references/dbsql-anti-patterns.md | Databricks/Delta patterns the generic engine can't detect from query text alone | Every query, as the Step 2 overlay |
| references/delta-table-health.md | CBO vs. Delta data-skipping statistics, the cost ladder, Predictive Optimization limits | Before any stats-related recommendation |
| references/validation.md | Correctness recipe, performance tiers, the five valid verdicts | Every rewrite, before reporting it as optimized |
| references/rewrite-engine-gaps.md | Patterns lint catches but altimate_core_rewrite doesn't fix, with the specific workaround for each | Step 5, whenever altimate_core_rewrite returns nothing |
Databricks Optimize: <file_or_query_name>
==========================================
Summary: 2 Databricks-specific findings, 1 rewrite (baseline: 3 generic findings via query-optimize)
Findings: 2
[MEDIUM] Z_ORDER_CANDIDATE — `event_date` filtered repeatedly per
system.query.history, not the table's clustering key.
-> Needs a clustering-key change; not run automatically.
[LOW] MISSING_STATS — `orders` shows Optimizer Statistics: missing.
-> ANALYZE TABLE main.sales.orders COMPUTE STATISTICS
(not run automatically — needs your confirmation).
Rewrite
Before: WHERE DATE(order_ts) = '2024-01-01'
After: WHERE order_ts >= '2024-01-01' AND order_ts < '2024-01-02'
Source: known gap — DATE() function elimination, see
references/rewrite-engine-gaps.md #2 (altimate_core_rewrite
returned nothing; hand-derived and verified below)
Correctness: row_count 4,083,290 both sides, checksum
8488063342080952646 both sides (exact match)
Equivalence: VERIFIED (schema-backed, altimate_core_equivalence)
Validation: Structurally optimized, timing pending
Tier 2 (EXPLAIN): PushedFilters now shows the range form — structural
improvement confirmed.
Tier 1 (query.history): pending — lag on this workspace.
Consistency check: PASS — no tool result this session contradicts
another (e.g. a grade score disagreeing with a
query that already executed successfully)
Verdict: Apply the rewrite (verified)? Z-ordering and stats are
recommend-only — confirm before running ANALYZE TABLE.The Correctness: line is not optional decoration — validation.md
requires the raw row-count/checksum values shown verbatim, not just
"VERIFIED" asserted. If validation was windowed rather than full-table
(validation.md §Step 1), state the window explicitly, e.g.
Correctness: row_count 8,204 both sides, checksum ... both sides — windowed to order_date 2026-08-01–2026-08-08, not full table. A
windowed correctness claim and a full-table one are different-strength
claims; the report must say which one this is, not leave it implied. Any hand-authored rewrite needs a Source: line
disclosing why it wasn't tool-generated — whether it came from a tracked
gap (Source: known gap — NOT IN→NOT EXISTS, see references/rewrite-engine-gaps.md #1) or matched no catalog or gap at
all (Source: outside the defined pattern set — no catalog or tracked-gap match, hand-authored and verified below). The reader should always be
able to tell a tool-verified rewrite from a hand-authored one, and — for
a hand-authored one — whether it followed a documented recipe or was
composed from scratch. Never just a pass/fail verdict on its own.
Consistency check: is a standing field, not one that only appears when
there's a problem — state PASS when nothing conflicts. When a tool
result contradicts evidence already established this session (e.g.
altimate_core_grade scores syntax 0/100 on a query that already
executed successfully via sql_execute), report FLAGGED with the
specific contradiction named, not just the raw score — a grading tool's
bug shouldn't silently make it into the report as if it were a real
finding about the query.
No raw tool-call syntax or internal step numbers in the report.
altimate_core_rewrite(verify_equivalence: true), sql_analyze, and
"Classification (Step 4)" are internal vocabulary for organizing this
skill's own instructions — not something a reader needs or asked for.
Describe what was checked and what it showed in plain language instead
(e.g. "verified automatically" rather than naming the tool call; "the
predicate is already pushed down" rather than "Case A per Step 4"). This
doesn't apply to Source:, Tier 1/Tier 2, Consistency check:, or
the checksum formula used in the Correctness: line — those disclose
which kind of evidence backs a claim, which is decision-relevant, not
implementation trivia; keep them exactly as specified above. Confirmed
live why this distinction matters: a report that dropped the formula
name reported the exact same wrong value (SUM(hash(...))'s known
overflow-prone result) as a prior run that did name it — without the
formula visible, that violation of validation.md's mandatory
BIT_XOR(xxhash64(...)) recipe becomes undetectable from the report
alone. State the checksum function by name every time, in plain language
if needed ("checksummed via the collision-resistant recipe in
validation.md") but never omit which one ran.
Use markdown formatting directly in the report — don't wrap the whole
response in one code fence. Bold, headers, bullet lists, and inline
code spans let the host UI render the report with real structure and
syntax highlighting; a report wrapped entirely in a single ``` block
renders as flat, unstyled text instead, no matter how well-organized the
content inside it is. Confirmed live: two reports from the same skill,
same session, rendered completely differently — one richly formatted,
one a plain gray block — purely because of this. Reserve actual code
fences for SQL snippets (Before:/After:), not the report around them.
For findings sections specifically, a compact table (columns like
Severity/Source/Finding) is easier to scan than a bullet list once there
are 3+ short findings — but don't force long, evidence-backed findings
(an EXPLAIN excerpt, a multi-sentence justification) into a table cell;
give those a one-line table summary and let the supporting detail follow
as a normal paragraph underneath.
altimate_core_rewrite's coverage (patterns lint
catches but the rewrite engine doesn't yet generate a fix for), see
references/rewrite-engine-gaps.md.© AltimateAI, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 4 other files (references) in skills/databricks/optimizing-databricks-sql of AltimateAI/data-engineering-skills.
Open the folder on GitHubat commit 705c68b
Optimizing Databricks SQL next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Optimizing Databricks SQL this skillAltimateAI/data-engineering-skills | 127 | — | ~6.7k | Automated safety check: Pass | MIT | |
| Analyzing Dataastronomer/agents | 450 | — | ~1.3k | Automated safety check: Pass | Apache-2.0 | |
| Databricks Dbsqldatabricks/databricks-agent-skills | 345 | 1 repos | ~2.8k | Automated safety check: Pass | Custom licence | |
| Tinybird Datafile RulesTryGhost/Ghost | 55k | — | ~417 | Automated safety check: Pass | MIT | |
| Databricks JobsKilo-Org/kilo-marketplace | 189 | 1 repos | ~3.1k | Automated safety check: Pass | Custom licence | |
| Snowflake Developmentsickn33/agentic-awesome-skills | 47k | 2 repos | ~2.1k | Automated safety check: Pass | MIT |
astronomer/agents
Queries the data warehouse with SQL and answers business questions about data.
databricks/databricks-agent-skills
Databricks SQL (DBSQL) advanced features and SQL warehouse capabilities.
TryGhost/Ghost
Rules for writing Tinybird datasources, pipes, endpoints and materialized views, with SQL constraints, optimization habits and deduplication patterns.
Kilo-Org/kilo-marketplace
Develop and deploy Lakeflow Jobs on Databricks via DABs, Python SDK, or the CLI.
sickn33/agentic-awesome-skills
Comprehensive Snowflake development assistant covering SQL best practices, data pipeline design (Dynamic Tables, Streams, Tasks, Snowpipe), Cortex AI functions, Cortex Agents, Snowpark Python, dbt…
alirezarezvani/claude-skills
A skill your agent uses when writing Snowflake SQL, building data pipelines with Dynamic Tables or Streams/Tasks, using Cortex AI functions, creating Cortex Agents, writing Snowpark Python…
AltimateAI/data-engineering-skills
Delegates dbt and warehouse tasks such as lineage, migrations and cost attribution to the altimate-code CLI agent and relays its answer back.
AltimateAI/data-engineering-skills
Creates or modifies dbt models in line with a project's own conventions, then runs dbt build and dbt show to check the output instead of stopping at compile.
AltimateAI/data-engineering-skills
Walks through fixing dbt compilation, database and test errors: read the full error, check upstream models, apply a fix, then verify with dbt build and a data preview.
AltimateAI/data-engineering-skills
Helps choose an incremental strategy, design a reliable unique_key and debug failing dbt incremental models, and says when a plain table is the better choice.
AltimateAI/data-engineering-skills
Writes model and column descriptions in dbt schema.yml files, matching the project's existing documentation style and recording grain, business rules and caveats.
AltimateAI/data-engineering-skills
Ranks the costliest, slowest or heaviest-scanning Snowflake queries from query history and suggests how to optimize them.
Works with
Analyze DBSQL queries, including SQL embedded in notebooks (spark.sql(...), %sql cells), for anti-patterns, lint issues, and performance problems, using Databricks-specific dialect and platform…. Optimizing Databricks SQL is an agent skill from AltimateAI/data-engineering-skills.), %sql cells), for anti-patterns, lint issues, and performance problems, using Databricks-specific dialect and platform knowledge (Delta, Photon, Unity Catalog) layered on top of altimate-code's generic SQL engine.
Optimizing Databricks SQL fits situations like: A user asks to optimize; lint DBSQL queries on Databricks; whether standalone; embedded in a notebook.
Run `npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a claude-code`. Or copy the skill folder (skills/databricks/optimizing-databricks-sql in AltimateAI/data-engineering-skills) into .claude/skills/optimizing-databricks-sql in your project. Claude Code loads it when a task matches its description.
Run `npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a codex`. Or copy the skill folder (skills/databricks/optimizing-databricks-sql in AltimateAI/data-engineering-skills) into .agents/skills/optimizing-databricks-sql in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add AltimateAI/data-engineering-skills --skill optimizing-databricks-sql -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/optimizing-databricks-sql, .gemini/skills/optimizing-databricks-sql, .github/skills/optimizing-databricks-sql and .opencode/skills/optimizing-databricks-sql in your project.
Going by SKILL.md and its folder, Optimizing Databricks SQL needs the command-line tools its instructions call (databricks). Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Optimizing Databricks SQL is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 6.7k tokens (SKILL.md is roughly 27k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 9.3k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Optimizing Databricks SQL: Analyzing Data (astronomer/agents, 450 stars), Databricks Dbsql (databricks/databricks-agent-skills, 345 stars), Tinybird Datafile Rules (TryGhost/Ghost, 55k stars) and Databricks Jobs (Kilo-Org/kilo-marketplace, 189 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
AltimateAI (a GitHub organization) maintains it in AltimateAI/data-engineering-skills, which has 127 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 1, 2026.
Source: AltimateAI/data-engineering-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.