All skills
dbt-labs avatar

/creating-mermaid-dbt-dag

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

Generates a Mermaid flowchart diagram of dbt model lineage using MCP tools, manifest.json, or direct code parsing as fallbacks. Use when visualizing dbt model lineage and dependencies as a Mermaid diagram in markdown format.

Use this Skill: https://skilld.dev/gh/dbt-labs/dbt-agent-skills/creating-mermaid-dbt-dag

This session only. Nothing lands on disk.

referencesusing-get-lineage-dev.md

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

Using get_lineage_dev for Lineage Retrieval

This is the preferred method when available. The get_lineage_dev (or mcp__dbt__get_lineage_dev) MCP tool reads from the local development manifest and provides the most accurate and up-to-date lineage information.

How to use

  1. Call the get_lineage_dev MCP tool with the model's unique_id

    • The unique_id follows the format: model.{project_name}.{model_name}
    • If you only have the model name, you can try with just the name or construct the unique_id
  2. The tool returns a lineage graph with:

    • parents: upstream dependencies (models, sources, seeds that this model depends on)
    • children: downstream dependencies (models, exposures that depend on this model)
  3. Parse the lineage response to extract:

    • Node unique_ids
    • Node types (model, source, seed, exposure, test, etc.)
    • File paths for each node
    • Relationships between nodes

Example usage

get_lineage_dev(
    unique_id="model.jaffle_shop.customers",
    depth=5  # Controls how many levels to traverse
)

Benefits

  • ✅ Most accurate - reads from local development manifest
  • ✅ Fast - no need to parse large JSON files
  • ✅ Includes all metadata (file paths, node types, etc.)
  • ✅ Respects depth parameter for controlling graph size

When to use

Use this method when:

  • The get_lineage_dev MCP tool is available
  • You're working in a local development environment
  • You want the most current lineage (including uncommitted changes)

Source: SKILL.md on GitHub

No alerts17d4 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill provides a secure and structured way to visualize dbt model lineage using Mermaid diagrams. It follows security best practices by including explicit instructions to treat all project-related files as untrusted content, preventing potential prompt injection from data files.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 9d91941. 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 5 months ago
What it can do
Reads files Runs commands
MCP servers
dbt
user-invocable
false
metadata
{
  "author": "dbt-labs"
}
All 6 allowed tools
mcp__dbt__get_lineage_devmcp__dbt__get_lineageReadGlobGrepBash(jq *)
  • MCP
  • dbt
  • mermaid
  • lineage
  • dag
  • visualization
  • manifest

README badge

README badge for dbt-labs/dbt-agent-skills/creating-mermaid-dbt-dag

Generates a Mermaid flowchart diagram of dbt model lineage and dependencies, using MCP tools, manifest.json, or code parsing as fallbacks. Targets visualization of dbt DAG structure in markdown format with color-coded node types.

Generated from the current SKILL.md.

Does this skill require dbt Cloud or does it work with local dbt projects?
It works with both. The skill tries get_lineage_dev first for local lineage, falls back to get_lineage for dbt Cloud production lineage, then parses manifest.json or code directly if MCP tools aren't available.
Can I include tests in the lineage diagram?
Yes. The skill asks the user whether to include tests in the diagram and will represent them as yellow nodes if included.
What happens if the manifest.json file is too large?
The skill skips manifest parsing and falls back to direct code parsing, which provides best-effort incomplete lineage by analyzing SQL and YAML files directly.
Does this skill color nodes by resource type?
Yes. Nodes are colored by type: sources (blue), staging models (bronze), intermediate models (silver), marts (gold), seeds (green), exposures (orange), and tests (yellow).

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