SkillsLib.ai

dbt Model Optimization & Refactoring

Optimize and refactor your dbt models for performance and maintainability

0.0(0 reviews)
100+ downloads
Updated Nov 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

Draw.io Diagram Automation for Project Management
$25
Draw.io Diagram Automation for Project Management

Turn project descriptions, timelines, and structured data into professional draw.io diagrams instantly. You can generate flowcharts, org charts, Gantt charts, swimlane diagrams, and process flows by describing what you need. Claude creates draw.io XML that you can open directly in the editor or modify further.

M&E Data Collection Specialist
$35
M&E Data Collection Specialist

You can design culturally appropriate survey instruments tailored to international development contexts, analyze mixed-methods data by integrating quantitative findings with qualitative insights, and implement robust data quality management systems for your field operations. Claude helps you create survey templates with adaptive logic, develop validation protocols, and produce data quality reports that highlight issues before analysis begins.

Warehouse Optimization Analyzer
$35
Warehouse Optimization Analyzer

You can diagnose warehouse bottlenecks using structured data analysis, then generate optimized layouts and flow improvements. The skill models space utilization, labor deployment, and throughput constraints to identify quick wins and long-term improvements, delivering quantified cost savings and performance gains for your specific facility.

Qualitative Impact Data Analyzer
$40
Impact4.2(22)
Qualitative Impact Data Analyzer

You can systematically code qualitative data against your evaluation framework, surface patterns and themes across multiple responses, extract compelling impact stories with supporting evidence, and generate summary matrices that link narrative findings to your outcomes claims. This skill maintains analytical rigor while reducing the 40-60 hours typically spent manually reviewing transcripts and open-ended survey responses per evaluation cycle.

Lead Magnet Creator
$50
Lead Magnet Creator

Get complete, ready-to-deploy lead magnets tailored to your ideal customer profile. Claude designs the concept, writes the persuasive copy, builds the email sequences, and creates deployment strategies that attract qualified prospects and build engaged lists fast. You'll capture 3-5x more subscribers with magnetic offers that actually resonate.

Proposal Gen
$45
Commercial4.4(51)
Proposal Gen

You can convert raw discovery call notes into polished, multi-section sales proposals that include executive summaries tailored to buyer personas, needs analysis mapped to your solution architecture, tiered pricing options with competitive positioning, ROI projections with financial justification, and realistic implementation timelines. The skill preserves personalization and strategic positioning while automating structural components, letting you respond to RFPs and time-sensitive opportunities without sacrificing quality or consistency.

Property Subrogation Recovery Strategist
$30
Property3.3(6)
Property Subrogation Recovery Strategist

This skill analyzes property damage claims to identify viable subrogation opportunities against third-party defendants. It quantifies recovery potential using liability assessment, damages analysis, and comparable settlement benchmarks—then develops negotiation-backed strategies to maximize your recovery. The skill guides you through intake, documentation, negotiation, and settlement workflows to transform claims into recoveries.

Facility Layout Optimizer
$35
Facility Layout Optimizer

This skill generates optimized facility layouts by analyzing material and personnel flow patterns, validating against operational constraints, and comparing multiple design options with quantified metrics. You provide your facility's dimensions, equipment locations, and operational requirements, and Claude produces detailed layouts with flow efficiency scores, space utilization analysis, and cost-benefit comparisons. Each layout option includes specific recommendations for improving throughput, reducing congestion points, and enhancing safety compliance.

$30.00