SkillsLib.ai

dbt Model Optimization & Refactoring

Optimize and refactor your dbt models for performance and maintainability

0.0(0 reviews)
100+ downloads
Updated Oct 2026

What You Can Do

You can analyze your dbt models to identify performance bottlenecks, redundancies, and design issues, then receive concrete refactoring recommendations with implementation guidance. This skill helps you restructure models following dbt best practices, improve query efficiency, and enhance code maintainability across your entire dbt project.

Features

Performance analysis

Identify slow queries, inefficient joins, and materialization strategy issues causing bottlenecks

Code quality scanning

Detect redundant logic, unmaintainable patterns, and violations of dbt naming conventions

Refactoring blueprints

Receive step-by-step refactoring plans with before/after code examples

Test coverage assessment

Review existing tests and generate new test cases for refactored models

Dependency mapping

Visualize and optimize the DAG structure to reduce model interdependencies

Documentation generation

Auto-create or improve YAML documentation for refactored models

Best practice alignment

Ensure models follow industry standards for staging, intermediate, and mart layers

Example Output

Input: Your dbt project with 50+ models

Output:

code
### Performance Issues Found
- stg_customers: Cartesian join in customer_transactions (20s execution time)
- fct_orders: Redundant group-by across 3 upstream models

### Refactoring Plan
1. Extract transaction aggregation into int_customer_transactions
2. Replace cartesian join with LEFT JOIN + ROW_NUMBER()
3. Add incremental logic to stg_customers (current: full refresh)

### Code Changes
-- Before
SELECT c.*, t.*
FROM raw_customers c
CROSS JOIN raw_transactions t  -- Inefficient!

-- After
SELECT c.*, t.transaction_count
FROM {{ ref('stg_customers') }} c
LEFT JOIN {{ ref('int_customer_transactions') }} t
  USING (customer_id)

Expected Gains: 40% query time reduction, 3 fewer dependencies, improved test coverage

What's Included

  • SKILL.md: The Claude skill with dbt analysis workflows, optimization templates, and refactoring decision trees
  • Model Audit Checklist: Comprehensive list of performance and maintainability criteria
  • Refactoring Templates: SQL patterns for common refactoring scenarios (incremental models, staging layers, fact tables)
  • Test Generation Snippets: dbt YAML templates for unit tests and model contracts
  • DAG Optimization Guide: Best practices for model layering and dependency management

Who It's For

  • Analytics Engineers — Refactor legacy dbt projects and improve code quality
  • Data Team Leads — Establish optimization standards across your organization
  • dbt Project Owners — Reduce query costs and accelerate model execution
  • Data Platform Teams — Scale dbt projects while maintaining performance SLAs

Best For

  • Identifying and fixing performance bottlenecks in slow-running models
  • Restructuring large dbt projects to follow layered architecture (staging, intermediate, marts)
  • Eliminating redundant logic and consolidating overlapping models
  • Adding test coverage and documentation during refactoring
  • Planning incremental materialization strategies to reduce compute costs

You might also like

Film Location Scout Site Analyzer
$45
Scouting3.8(32)
Film Location Scout Site Analyzer

You can evaluate unfamiliar locations objectively against your specific production needs—whether that's crane access, parking capacity, noise restrictions, or permit requirements. The skill generates comprehensive scout reports that compare multiple sites using weighted evaluation matrices, flag deal-breakers early, and document infrastructure limitations so your production team makes informed decisions before committing resources to visits.

SCADA System Integration & Troubleshooting
$30
SCADA System Integration & Troubleshooting

You'll design robust SCADA system architectures, configure industrial protocols (Modbus, Profibus, OPC-UA, DNP3), and diagnose connectivity and performance issues across distributed control networks. Get step-by-step configuration guidance, integration workflows, and troubleshooting decision trees tailored to your specific hardware and protocol stack.

DaVinci Resolve Color Grading Workflow & Quality Control
$35
DaVinci Resolve Color Grading Workflow & Quality Control

You can establish systematic color grading workflows that accelerate project delivery, ensure visual consistency across episodes and projects, and maintain broadcast-quality standards. Claude generates reusable templates, quality control checklists, and grading decision frameworks tailored to your project's color science and deliverable requirements.

Career Pivot Strategy Planner
$50
Career Pivot Strategy Planner

You'll create a comprehensive, data-driven career transition plan that reduces risk and accelerates your move to a new role or industry. Get a financial runway analysis, identify exactly which skills you need to acquire, map out realistic timelines, and develop contingency strategies for every scenario. Stop wondering if you can afford to switch jobs, and start executing with confidence.

MyCase Document Workflow Automation
$40
MyCase Document Workflow Automation

Generate customized legal documents and client communications automatically from your MyCase case data. This skill extracts case details, client information, and matter status to populate document templates, send email updates, and create batch processing workflows. Reduce manual data entry and standardize your document generation process while maintaining client communication consistency.

ESG Impact Report Generator & Framework Compliance Tool
$45
Reporting4.2(34)
ESG Impact Report Generator & Framework Compliance Tool

You can convert raw ESG metrics and narratives into professionally structured impact reports that satisfy regulatory and investor requirements. The skill automatically verifies alignment with SASB materiality categories, GRI standards, and TCFD recommendations; constructs defensible materiality matrices from stakeholder feedback; standardizes impact metrics to IRIS+ and SDG frameworks; and identifies compliance gaps between your draft and mandatory disclosure requirements.

Vehicle Stunt Sequence Safety Analyzer
$30
Vehicle4.2(11)
Vehicle Stunt Sequence Safety Analyzer

You can submit detailed vehicle stunt descriptions and receive structured safety analyses that identify hazards, verify compliance with regulations, assess insurance implications, and generate required pre-production documentation. The skill helps you bridge creative vision with practical safety execution by providing risk assessments that studios, insurance companies, and location managers require before production begins.

Wwise Implementation & Troubleshooting Assistant
$45
Wwise Implementation & Troubleshooting Assistant

This skill helps you troubleshoot Wwise integration issues, diagnose audio performance bottlenecks, and generate comprehensive documentation for interactive audio specifications. You'll get step-by-step fixes for common implementation problems, performance optimization strategies, and best practices for audio systems across different game engines and platforms.

$30.00