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

Forensic Psychology Expert Witness Assistant
$35
Forensic Psychology Expert Witness Assistant

Prepare comprehensive expert witness reports and testimony that meet Daubert standards for admissibility and withstand cross-examination scrutiny. You'll get structured case analyses integrating psychological assessments, relevant case law citations, and anticipated counterarguments. The skill helps you document your forensic opinions with the legal rigor required in criminal, civil, and family law proceedings.

Real-Time Motion Control System Design & Validation
$35
Real-Time Motion Control System Design & Validation

You design robust motion control systems by generating control architectures, tuning PID and state-space controllers, and analyzing stability margins with detailed performance predictions. You'll get transfer functions, tuned gains, frequency response plots, real-time constraint validation, and code templates ready for implementation in MATLAB or Python.

Enterprise Architecture Design & Trade-off Analysis
$35
Enterprise Architecture Design & Trade-off Analysis

You can systematically evaluate architectural options by building decision matrices, identifying trade-offs, and documenting design rationale. This skill generates comparison frameworks, risk assessments, and architecture decision records (ADRs) that help you choose between competing approaches based on concrete criteria like performance, scalability, cost, and team capabilities.

Thought Leadership Content Multiplier
$30
Thought Leadership Content Multiplier

You provide a single core insight or perspective, and this skill transforms it into a complete, coordinated thought leadership content suite across every major channel. It generates optimized articles, social threads, email sequences, presentation outlines, and more—all reinforcing the same core message while adapting to each platform's unique audience and format. Every piece maintains strategic consistency while maximizing reach and engagement.

Commercial Underwriting Risk Assessor
$35
Commercial Underwriting Risk Assessor

Analyze commercial insurance applications by extracting risk factors, evaluating loss history and industry exposure, and generating structured underwriting recommendations with standardized documentation. You'll reduce review time per application, ensure consistent decision criteria across your team, and maintain compliant audit trails for every underwriting action.

Kanban Flow Analyzer
$30
Kanban3.4(33)
Kanban Flow Analyzer

You can systematically diagnose flow problems in your Kanban board by analyzing stage-by-stage work accumulation, cycle time patterns, and throughput trends. The skill generates flow metrics dashboards, identifies capacity constraints, forecasts delivery dates based on historical data, and produces prioritized improvement recommendations with estimated impact—giving you objective evidence to guide WIP adjustments, process changes, and retrospective discussions.

Compliance & Certification Requirement Mapper
$35
Compliance & Certification Requirement Mapper

You can map your game's features to certification requirements across ESRB, PEGI, USK, CLASSIND, and platform-specific standards simultaneously. The skill generates compliant test cases that prove adherence to each body's content and technical standards, tracks certification status to identify gaps before submission, and documents evidence trails for audits and appeals. This prevents costly certification rejections (2-8 week delays, $2,500-$10,000+ resubmission fees) by ensuring comprehensive compliance documentation from the QA phase onward.

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.

$30.00