snowflake-dbt-model-refactoring

snowflake-dbt-model-refactoring is a skill for Claude Code from AltimateAI/data-engineering-skills. It costs 195 tokens per session (8,967 once invoked), scanned A, original, MIT.

A refactoring procedure for oversized dbt models running on Snowflake. dbt is a tool that builds and manages SQL data models; the procedure reorganizes a model while checking that its results remain the same.

In plain words
What is it for?
It is for splitting up bloated models, finding duplicated logic and affected downstream models, reviewing the SQL, and producing a before-and-after report. It is limited to Snowflake projects and does not optimize query speed.
Why use it?
Large SQL models are difficult to understand and risky to change, especially when other models depend on them. This procedure checks downstream effects and compares row counts and per-row values before and after the refactor.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

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

Good fit It is for splitting up bloated models, finding duplicated logic and affected downstream models, reviewing the SQL, and producing a before-and-after report. It is limited to Snowflake projects and does not optimize query speed.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/altimateai/data-engineering-skills/snowflake-dbt-model-refactoring
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-dbt-model-refactoring
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 4 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-dbt-model-refactoring

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/altimateai/data-engineering-skills/snowflake-dbt-model-refactoring"><img src="https://agentmods.dev/badge/skills/altimateai/data-engineering-skills/snowflake-dbt-model-refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 195 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,967 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.00195 $0.08967
Opus 5.5 $0.00078 $0.03587
Sonnet 5.5 $0.00039 $0.01793
Haiku 4.5 $0.00019 $0.00897

Measured 2d ago against content hash 81f01b3e250d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

snowflake-dbt-model-refactoring 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 2d 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.

skills/snowflake/snowflake-dbt-model-refactoring/SKILL.md · 693 lines

How it starts

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

snowflake-dbt-model-refactoring

When to invoke

Trigger this skill when any of the following is true for a target dbt model on a Snowflake-backed dbt project:

  • More than ~200 lines
  • More than 5 joins in a single query block
  • A CTE longer than ~50 lines
  • Logic duplicated across 3+ models (payment pivots, RFM buckets, etc.)
  • Hardcoded lists / thresholds repeated inline
  • Downstream consumers exist and would be affected by structural changes

If the project targets BigQuery, Redshift, or Databricks, use the generic refactoring-dbt-models skill instead — Phase 7's warehouse benchmark is Snowflake-specific.

Non-goals

  • Do not rewrite for performance alone — that is the job of query-optimize
  • Do not change model outputs — refactoring must preserve row count and per-row values
  • Do not touch models the user did not point at, even if they look messy

Prerequisites & invocation

This skill delegates specialized sub-tasks (lineage, parity, SQL review, cost attribution, etc.) that are not themselves packaged with snowflake-skills. Two valid invocation paths — pick the one that matches the user's environment:

Preferred — altimate-code (bundled in the dbt-snowflake kit). Before using any delegated-task line below, verify it is available:

command -v altimate-code

If present, delegate each sub-task via its non-interactive runner:

altimate-code run "<task description>" --yolo \
  --output /tmp/altimate-result.md --dir "$(pwd)"

Then read /tmp/altimate-result.md and use the result. See the altimate-code skill for the full flag reference and install guidance.

Fallback — plain dbt + direct SQL when altimate-code is not installed and the user does not want to install it. In that case:

  • Replace dbt-analyze lookups with dbt ls --select +<target>+ --output json (downstream nodes) plus dbt docs generate + reading target/catalog.json and target/manifest.json for the column-usage map. Note: this is coarser than altimate-code's column-level lineage.
  • Replace build/compile delegation with plain dbt build / dbt compile.
  • Replace data-parity with the SQL in Phase 4 run directly against the warehouse (via the dbt adapter, snowsql, or any Snowflake client).
  • Replace sql-review with sqlfluff lint or project-standard linter.
  • Replace cost-report / query-optimize with direct queries against SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY + QUERY_ATTRIBUTION_HISTORY (sample SQL in Phase 7).

Read the full file on GitHub · 693 lines

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. 2d ago First seen · 693 lines · 195 tokens per session scan A 81f01b3e250d

Subscribe to this mod's changes

snowflake-dbt-model-refactoring is a skill published in the GitHub repository AltimateAI/data-engineering-skills (128 stars, last pushed 3d ago), licensed MIT. It adds 195 tokens to every session and 8,967 once invoked, about $0.0008 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-16.

Related

Other skills, from other repositories

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

data-profiling

Profile and map raw data BEFORE designing a schema. One-time exploratory analysis to learn the true shape of a dataset — row/column counts, null rates, cardinality, value distributions, ranges, data types, candidate keys, duplicates, referential relationships — then a source-to-target field mapping and an ER diagram.…

Methasit-Pun/data_engineer_claude_skills · 151 tokens