All skills
dbt-labs avatar

/using-dbt-for-analytics-engineering

@8908932 official
by dbt Labsdbt-labs/dbt-agent-skills729 stars
62

Builds and modifies dbt models, writes SQL transformations using ref() and source(), creates tests, and validates results with dbt show. Use when doing any dbt work - building or modifying models, debugging errors, exploring unfamiliar data sources, writing tests, or evaluating impact of changes.

Use this Skill: https://skilld.dev/gh/dbt-labs/dbt-agent-skills/using-dbt-for-analytics-engineering

This session only. Nothing lands on disk.

scriptsreview_run_results.md

≈437 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Review dbt Run Results

When to Use

If a user tells you there is a problem with the project, review the target/run_results.json file to identify which resources failed and why.

Check the metadata.generated_at key to ensure the information is fresh.

Python Script

import json

def review_dbt_run_results(run_results_path: str):
    """Review dbt run_results.json and identify failures."""
    with open(run_results_path) as f:
        data = json.load(f)
    
    results = data.get('results', [])
    failed = [r for r in results if r.get('status') == 'error']
    
    print(f"Total: {len(results)} | Failed: {len(failed)}")
    
    if failed:
        print("\nFailed Resources:")
        for r in failed:
            # Extract resource name from unique_id (e.g., "model.project.name" -> "name")
            resource_name = r['unique_id'].split('.')[-1]
            resource_type = r['unique_id'].split('.')[0]
            
            print(f"\n- {resource_type}: {resource_name}")
            
            # Parse error message for key details
            message = r.get('message', '')
            if message:
                # Extract the main error line
                error_lines = [line for line in message.split('\n') if line.strip()]
                print(f"  Error: {error_lines[0] if error_lines else message}")
            
            # Show compiled SQL if available
            compiled = r.get('compiled_code', '').strip()
            if compiled and len(compiled) < 200:
                print(f"  SQL: {compiled}")
            elif compiled:
                print(f"  SQL: {compiled[:200]}...")
    
    return failed

# Usage
failed_resources = review_dbt_run_results('target/run_results.json')

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides comprehensive guidance for dbt analytics engineering. It includes explicit defensive instructions to mitigate indirect prompt injection risks by treating warehouse data and package registry responses as untrusted content. It interacts with the official dbt Hub for package management.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: MEDIUM · 1 issue

  • Runlayer6mo

    3/9 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 8908932. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 4 months ago
What it can do
Runs commands Reads files Edits files
user-invocable
false
metadata
{
  "author": "dbt-labs"
}
All 7 allowed tools
Bash(dbt *)Bash(jq *)ReadWriteEditGlobGrep
  • Testing
  • dbt
  • analytics-engineering
  • sql
  • data-transformation
  • modeling
  • warehouse
  • elt
  • data-pipeline

README badge

README badge for dbt-labs/dbt-agent-skills/using-dbt-for-analytics-engineering

Builds and modifies dbt models, writes SQL transformations using ref() and source(), creates tests, and validates work with dbt show. Targets analytics engineering workflows including model development, refactoring, debugging, and impact assessment in existing dbt projects.

Generated from the current SKILL.md.

Does this skill work with dbt Cloud or only dbt Core?
The skill works with dbt Core via the CLI. It also integrates with dbt Cloud APIs through the dbt MCP server if available in your environment, but the primary interaction model is the dbt CLI.
Can I use this skill to query dbt's semantic layer?
No. Use the `answering-natural-language-questions-with-dbt` skill for semantic layer queries. This skill focuses on building and modifying dbt models, writing SQL transformations, and running tests.
What warehouse databases does this skill support?
The skill works with any dbt-supported warehouse (Postgres, BigQuery, Snowflake, Redshift, etc.). Some guidance is warehouse-specific (e.g., avoiding large unpartitioned scans in BigQuery), but the core dbt workflows apply universally.
Can this skill help me debug dbt errors?
Yes. The skill includes a dedicated reference guide for debugging dbt errors covering project parsing, compilation, and database errors.
Does this skill modify my dbt project directly, or just provide guidance?
The skill both provides guidance and can modify your project. It has write access to create and edit dbt models, YAML files, tests, and documentation, but follows dbt best practices like using ref() and source() and validating changes with dbt show.

Generated from the current SKILL.md. These answers refresh after source changes.