datajunction/dj/datajunction-repo

Claude Code and agent skill by datajunction/dj

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Activate this skill when authoring DataJunction (DJ) nodes via YAML files in a git repository — the repo-backed workflow. Covers YAML schemas per node type, branch-based development, temporal partitions on cubes, registering pre-aggregations / aggregate awareness, and the full PR-driven deployment flow. Keywords: - YAML nodes, YAML definitions - repo-backed namespace, repo-backed workflow - git workflow, branch development, feature branch - cube YAML, metric YAML, dimension YAML, transform YAML…

Install

npx vskill@latest install datajunction/dj/datajunction-repo

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as datajunction/dj/datajunction-repo.

DataJunction Repo-Backed Workflow

YAML-and-git authoring for DJ. Use this skill when working in a repo-backed namespace — node definitions are YAML files, changes go through PRs, CI/CD deploys.

For modeling decisions (whether to make something a metric, dim, or transform; how to decompose a query), see datajunction-semantic-model. This skill assumes the modeling decisions are made and you're translating them into YAML.

Overview

DataJunction supports repo-backed namespaces where node definitions are stored as YAML files in a git repository. This enables:

  • ✅ Version control for your semantic layer
  • ✅ Pull request review workflows for changes
  • ✅ Branch-based development (feature branches, environments)
  • ✅ Declarative configuration (infrastructure as code)
  • ✅ Audit trail of all changes
  • ✅ Team collaboration with code review

Repository Structure

There is no required layout under `nodes/`. DJ walks the tree recursively (rglob("nodes/**/*.yaml")) and takes the namespace from each YAML's name: field. The folder path is purely organizational. Files can be flat, nested by type, nested by domain, or any mix — DJ doesn't care, and reorganizing later is a free git mv.

That said, you should still choose a layout for your repo so contributors know where to add things. A few common patterns:

By node type (good when most contributors are adding metrics across one domain):

nodes/
sources/transactions.yaml
dimensions/user.yaml
metrics/revenue.yaml
transforms/clean_transactions.yaml
cubes/revenue_cube.yaml

By domain (good when multiple teams/areas share one repo):

nodes/
billing/
sources/payments.yaml
transforms/payment_events_clean.yaml
metrics/monthly_revenue.yaml
user_events/
transforms/sessions.yaml
metrics/dau.yaml

Flat (small projects, <30 nodes):

nodes/
transactions.yaml
user.yaml
revenue.yaml
Deciding on a layout

For an existing repo: look at the current nodes/ tree and match it. Consistency within a repo matters more than any specific scheme. Don't introduce a new style alongside an established one.

For a new repo: ask the user a few questions before committing to a layout:

  • How many contributors / teams will use this repo?
  • Roughly how many nodes do you expect (10? 100? 1000?)
  • Are most nodes going to be metrics on top of a few shared transforms, or many independent fact/dim chains?

Defaults from those answers:

  • 1 team + <30 nodes → flat is fine
  • 1 team + larger → by node type
  • Multiple teams → by domain, with optional type subdirs inside each domain folder when a domain itself grows past ~30 nodes

The right call almost never matters as much as it feels like it does — folder layout has zero effect on deployed namespaces, so optimize for "where would a new contributor look for X" and accept that you'll reorganize as the repo grows.


Branch-Based Development

Understanding Branch-Based Namespaces

When you create a branch in a repo-backed namespace, DJ creates a corresponding namespace that points to that branch.

Naming convention:

{namespace}.{branch_name}

Examples:

  • finance.main → points to main branch of finance repo
  • finance.feature-new-metrics → points to feature-new-metrics branch
  • finance.staging → points to staging branch
Creating a Feature Branch

Option A: Via DJ API

bash
curl -b ~/.dj/cookies.txt -X POST $DJ_URL/namespaces/finance/branches \
-H 'Content-Type: application/json' \
-d '{
"name": "feature-new-metrics",
"from_branch": "main"
}'
# This creates:
# 1. Git branch: feature-new-metrics (from main)
# 2. DJ namespace: finance.feature-new-metrics

Option B: Manually in Git

bash
cd dj-finance/
git checkout -b feature-new-metrics
git push origin feature-new-metrics
# DJ may auto-discover branches

YAML Node Definitions

All node types can be defined as YAML files in the repository.

Column-Level Configuration

Column types are auto-inferred from queries

  • DJ analyzes your SQL and automatically determines column types
  • No need to manually specify types in the columns section

Use CAST() to control specific types

yaml
query: |
SELECT
CAST(user_id AS bigint) AS user_id,
CAST(revenue AS decimal(18,2)) AS revenue,
transaction_date
FROM finance.transactions

Column attributes

  • primary_key — Marks column as part of the primary key
  • dimension — Marks column as available for grouping (transforms/facts only)

Optional column fields

  • display_name — Human-readable name for UI display

```yaml columns:

  • name: ad_account_id

display_name: "Ad Account ID" attributes:

  • dimension

```

Important constraints:

  • ❌ SELECT * is NOT supported — always explicitly list columns
  • ✅ Column order in YAML should match SELECT order
  • ✅ Use descriptive display names for better UX
Source Node YAML
yaml
# nodes/sources/transactions.yaml
name: finance.transactions
description: Raw transaction data from payment system
type: source
catalog: prod_catalog
schema_: finance
table: transactions_table
columns:
- name: transaction_id
display_name: "Transaction ID"
attributes:
- primary_key
- name: user_id
display_name: "User ID"
- name: amount_usd
display_name: "Amount (USD)"
- name: transaction_date
display_name: "Transaction Date"
- name: status
display_name: "Status"
dimension_links:
- type: join
dimension_node: common.dimensions.users
join_type: left
join_on: finance.transactions.user_id = common.dimensions.users.user_id
- type: join
dimension_node: common.dimensions.date
join_type: left
join_on: finance.transactions.transaction_date = common.dimensions.date.dateint
mode: published

Notes:

  • Column types are auto-inferred from the source table schema
  • display_name provides human-readable labels for UI
  • join_type can be left, right, or inner (defaults to left)
Dimension Node YAML
yaml
# nodes/dimensions/user.yaml
name: finance.user
description: User dimension with attributes
type: dimension
query: |
SELECT
user_id,
username,
email,
country_code,
signup_date,
tier
FROM finance.users
primary_key:
- user_id
columns:
- name: user_id
display_name: "User ID"
attributes:
- primary_key
- name: username
display_name: "Username"
- name: email
display_name: "Email Address"
- name: country_code
display_name: "Country"
- name: signup_date
display_name: "Signup Date"
- name: tier
display_name: "User Tier"
dimension_links:
- type: join
dimension_node: common.dimensions.date
join_type: left
join_on: finance.user.signup_date = common.dimensions.date.dateint
- type: join
dimension_node: common.dimensions.country
join_type: left
join_on: finance.user.country_code = common.dimensions.country.country_code
mode: published

Notes:

  • Dimension node columns don't need dimension attribute (all are dimensions by nature)
  • display_name improves readability in query builders and dashboards
Metric Node YAML
yaml
# nodes/metrics/revenue.yaml
name: finance.total_revenue
description: Total revenue from completed transactions
type: metric
query: |
SELECT
SUM(
CASE
WHEN status = 'completed' AND refund_flag = false
THEN amount_usd
ELSE 0
END
) AS total_revenue
FROM finance.transactions
required_dimensions:
- common.dimensions.date.dateint
metric_metadata:
direction: higher_is_better
unit: dollar
owners:
- data-platform-team@company.com
- alice@company.com
mode: published

Important metric rules (see datajunction-semantic-model for full discussion):

  • ✅ ALWAYS specify owners — critical for governance
  • ❌ No WHERE clauses in metric queries (use CASE WHEN instead)
  • ✅ Include required_dimensions for time-based metrics
  • ✅ Add metric_metadata for direction and unit
  • ✅ Use `required_filters` and `recommended_filters` to say which dimension attributes a query must or should filter. Give an entry a default filter if callers should not have to send one; without it, a query that omits the filter is rejected
Transform Node YAML
yaml
# nodes/transforms/clean_transactions.yaml
name: finance.clean_transactions
description: Cleaned transaction data with standardized status
type: transform
primary_key:
- transaction_id
query: |
SELECT
transaction_id,
user_id,
amount_usd,
transaction_date,
CASE
WHEN status IN ('complete', 'completed', 'success') THEN 'completed'
WHEN status IN ('fail', 'failed', 'error') THEN 'failed'
ELSE status
END AS status_clean,
refund_flag
FROM finance.transactions
columns:
- name: transaction_id
display_name: "Transaction ID"
attributes:
- primary_key
- name: user_id
display_name: "User ID"
attributes:
- dimension
- name: amount_usd
display_name: "Amount (USD)"
- name: transaction_date
display_name: "Transaction Date"
attributes:
- dimension
- name: status_clean
display_name: "Status"
attributes:
- dimension
- name: refund_flag
display_name: "Refund Flag"
attributes:
- dimension
dimension_links:
- type: join
dimension_node: common.dimensions.users
join_type: left
join_on: finance.clean_transactions.user_id = common.dimensions.users.user_id
- type: join
dimension_node: common.dimensions.date
join_type: left
join_on: finance.clean_transactions.transaction_date = common.dimensions.date.dateint
mode: published

Notes:

  • primary_key field lists the primary key column(s)
  • dimension attribute marks columns available for grouping in metrics
  • Column types are auto-inferred from the query
  • Columns without dimension attribute are typically measures/facts
Cube YAML
yaml
# cubes/revenue_cube.yaml
name: finance.revenue_cube
description: Pre-computed revenue metrics by date and region
metrics:
- finance.total_revenue
- finance.avg_transaction_value
dimensions:
- common.dimensions.date.dateint
- common.dimensions.date.month
- common.dimensions.users.country_code
mode: published

When to use cubes:

  • Frequently queried metric combinations
  • Pre-compute for performance (materialization)
  • Dashboard metric sets

Critical: All metrics in a cube MUST share ALL dimensions in the cube. Use get_common_dimensions MCP tool (see datajunction-query) to check first.


Temporal Partitions on Cubes

Temporal partitions enable automatic partition filtering for performance optimization. When configured, DJ automatically adds partition filters to SQL queries, dramatically improving query performance on large datasets.

How Partitions Work

A partition is always declared on a column. When that column is a dimension attribute on a cube, DJ uses it as the partition boundary and pushes the filter down to all upstream nodes that link to that same dimension.

Partition field format:

yaml
partition:
type: temporal # or: categorical
granularity: day # second, minute, hour, day, week, month, quarter, year
format: yyyyMMdd # Java/Spark date format (e.g. yyyyMMdd → 20240101, yyyy-MM-dd → 2024-01-01)
Declaring a Partition on a Cube

In a cube, declare the partition in the `columns:` section using the full dimension attribute path as the column name:

yaml
# cubes/revenue_cube.yaml
name: ${prefix}revenue_cube
node_type: cube
metrics:
- ${prefix}total_revenue
- ${prefix}order_count
dimensions:
- common.dimensions.date.dateint
- common.dimensions.geo.country_code

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
166
Repository forks
34
7-day trend score
25

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/datajunction/dj/datajunction-repo/badge)](https://verified-skill.com/skills/datajunction/dj/datajunction-repo)

Something wrong with this skill or its page? Tell us.