From datajunction
Queries DataJunction semantic layer: finds nodes, generates SQL, fetches metric data, explores lineage, visualizes results via UI, MCP tools, or APIs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/datajunction:datajunction-queryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Consumer-side workflow for DJ: find existing nodes, build SQL to query them, fetch data, visualize results. For the underlying concepts (node types, dimension links, star schema), invoke the `datajunction` skill.
Consumer-side workflow for DJ: find existing nodes, build SQL to query them, fetch data, visualize results. For the underlying concepts (node types, dimension links, star schema), invoke the datajunction skill.
For interactive exploration — browsing namespaces, inspecting a node's lineage / SQL / available dimensions, building queries by clicking dimensions on/off — the DJ web UI is usually the fastest path. It's hosted at the same URL as the DJ server (e.g. https://your-dj-server.example.com/).
Use the UI when:
Use the MCP tools / API (below) when:
Suggest opening the UI when the user's question is exploratory and you don't yet know the right node name. Suggest MCP tools when you have a name in hand and need data, lineage, or generated SQL.
When you need to explore the DJ semantic layer, use these MCP tools:
Use MCP tool: search_nodes
Example: search_nodes(query="revenue", node_type="metric", namespace="finance")
Use MCP tool: get_node_details
Example: get_node_details(name="finance.total_revenue")
What you get:
Use MCP tool: get_common
Example: get_common(metrics=["finance.total_revenue", "growth.daily_active_users"])
When to use: Always check this before building queries with multiple metrics!
Use MCP tool: get_node_lineage
Example: get_node_lineage(node_name="finance.total_revenue", direction="both")
When you need to query metrics or generate SQL, use these MCP tools:
Use MCP tool: build_metric_sql
Example:
build_metric_sql(
metrics=["finance.total_revenue"],
dimensions=["core.date.date"],
filters=["core.date.date >= '2024-01-01'"],
orderby=["core.date.date ASC"],
limit=100,
dialect="trino",
)
Returns:
Performance: always pass a filter on a date/time dimension. When the upstream cube has a temporal partition declared on that dimension, DJ pushes the filter down to the partition column, limiting the data scanned. Without a time filter, queries scan the full underlying table.
(Don't pass include_temporal_filters=True here — that's a parameter on get_query_plan for inspecting partition templates in materialization-plan SQL, not for live queries.)
Use MCP tool: get_metric_data
Example:
get_metric_data(
metrics=["finance.total_revenue", "finance.transaction_count"],
dimensions=["core.date.date", "core.region.region_name"],
filters=["core.date.date >= '2024-01-01'"],
orderby=["core.date.date ASC"],
limit=1000
)
Best practices:
limitget_query_plan
first (see below) — it returns the scan estimate without executingUse MCP tool: visualize_metrics
get_metric_dataExample:
visualize_metrics(
metrics=["finance.total_revenue"],
dimensions=["core.date.date"],
filters=["core.date.date >= '2024-01-01'"],
orderby=["core.date.date ASC"],
limit=90,
chart_type="line"
)
Chart types:
line: Time series (default)bar: Categorical comparisonsscatter: Correlation analysisUse MCP tool: get_query_plan
get_metric_data / visualize_metrics if you suspect
the query might be expensive — the same scan estimate that drives the
refusal guardrail is surfaced here, so you can iterate on filters
until the estimate is reasonableExample:
get_query_plan(
metrics=["finance.total_revenue"],
dimensions=["core.date.date"],
filters=["core.date.date >= '2024-01-01'"],
)
When to use:
The MCP tools call the DJ REST and GraphQL APIs under the hood. Here's what they're doing:
Node discovery:
GET /nodes?node_type=metric&namespace=finance
GET /nodes/{node_name}
SQL generation (⚠️ Always use V3):
GET /sql/metrics/v3 # Generate query SQL
GET /sql/measures/v3 # Generate pre-aggregation SQL
Dimension compatibility:
GET /metrics/common/dimensions
Available at /graphql:
query {
nodes(nodeType: METRIC, namespace: "finance") {
name
description
dimensions { name type }
}
commonDimensions(nodes: ["finance.revenue", "growth.users"]) {
name
type
}
}
npx claudepluginhub datajunction/dj --plugin datajunctionHelps design DataJunction semantic models: choosing node shapes, decomposing SQL into nodes, and applying naming/ownership/namespace conventions.
Build and run a GrowthBook Product Analytics chart via the REST API — visualize a metric over time, aggregate a fact table, or chart a raw warehouse table, then return the numbers plus a deep link to the chart. Use when the user asks "show me signups by country", "chart daily active users", "how many orders last week", "plot revenue over time", "break that down by plan", or any "show me / chart / plot / how many" question about product data. For discovering what metrics and fact tables exist first, use metric-search. For experiment results, use experiment-analyze — this skill is for general analytics, not A/B test readouts.
Answers business questions on analytics, metrics, KPIs by generating/executing SQL via dbt Semantic Layer, compiled SQL mods, or model analysis against data warehouse.