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-manifest-json.md

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

Using manifest.json for Lineage Retrieval

This is the second fallback method when MCP lineage tools are not available. Read and parse the manifest.json file directly to extract lineage information.

How to use

  1. Locate the manifest.json file:

    • Usually in target/manifest.json in the dbt project root
    • May also be in project root as manifest.json
  2. Read the manifest.json file:

    • First check the file size - if it's very large (>10MB), you may need to use streaming or partial reads
    • Look for the target model in the nodes section
  3. Extract lineage from the manifest structure:

    {
      "nodes": {
        "model.project.model_name": {
          "unique_id": "model.project.model_name",
          "resource_type": "model",
          "depends_on": {
            "nodes": ["model.project.upstream_model", "source.project.source_name"]
          },
          "original_file_path": "models/path/to/model.sql"
        }
      }
    }
  4. Build the lineage graph:

    • Parents: Found in the depends_on.nodes array
    • Children: Search all nodes for ones that have this model in their depends_on.nodes
  5. For each node in the lineage, extract:

    • unique_id
    • resource_type (model, source, seed, snapshot, exposure, test)
    • original_file_path or path
    • Any other relevant metadata

Benefits

  • ✅ Works offline
  • ✅ No MCP server required
  • ✅ Contains complete lineage information
  • ✅ Includes all metadata

Limitations

  • ❌ Manifest can be very large (100MB+)
  • ❌ May be slow to parse
  • ❌ May not exist if dbt parse hasn't been run
  • ❌ Only reflects last parse, not current uncommitted changes

When to use

Use this method when:

  • Both get_lineage_dev and get_lineage MCP tools are NOT available
  • The manifest.json file exists and is reasonably sized (<10MB)
  • You need complete lineage information

Tips

  • If the manifest is very large, consider reading it in chunks or using grep/search instead
  • If you only need a specific model's lineage, you can use Grep to find just that section
  • Check the manifest file size before attempting to read the entire file

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.