/dataproduct-builder-demo-databricks:datacontract-testfrom dataproduct-builder-demo-databricks
Run `datacontract test` against ODCS contracts in the project to verify the live Databricks (Unity Catalog) data still conforms to schema, quality rules, and freshness. Handles two kinds of contracts with different semantics: output-port contracts under `models/output_ports/**/*.odcs.yaml` (tested against this project's output-port schema — "am I still producing what I promised?") and input-port contracts under `models/input_ports/*.odcs.yaml` (tested against the upstream data product's schema — "is upstream still producing what I trusted?"). Trigger when the user asks to "test the data contracts", "verify the data product matches its contract", "are we still contract-conformant", "check upstream drift", or "run the contract tests".
Ships in dataproduct-builder-demo-databricks. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Run the Data Contract CLI (datacontract test) against contracts in the project to check whether the data currently in Unity Catalog still matches the schema and quality rules declared in the contract.
Two kinds of contracts live in this project and they test against different Unity Catalog locations:
models/output_ports/v<N>/*.odcs.yaml — what this data product commits to produce. They test against this project's output-port schema (<catalog>.<output-port-id>). A failure means we are no longer producing what we promised.models/input_ports/*.odcs.yaml — cached snapshots of what we trust upstream to produce. They test against the upstream provider's server (<catalog>.<upstream-output-port-id>), using the server block from the upstream ODCS. A failure means upstream drifted from the contract we trusted; the consequence is that our output may break too. Treat input-port failures as an upstream incident, not a local bug.dataproduct-implement and want to re-test without re-running dbt → this skill.--logs.
${PLUGIN_ROOT}below refers to the root of this plugin — the directory that containsskills/. On Claude Code it is set automatically as${CLAUDE_PLUGIN_ROOT}; use that. On any other agent (Codex, Copilot CLI, etc.) it is unset; resolve it as../..relative to thisSKILL.mdfile's directory (i.e. the grandparent ofskills/<this-skill>/).
Tool invocation. Below, datacontract means uv tool run --from 'datacontract-cli[databricks]' datacontract (a datacontract already on PATH works too).
Before running Step 0, print this plan to the user verbatim:
Running datacontract-test. I'll:
- Pre-checks: confirm
datacontractruns and Databricks credentials are in the environment.- Pick which contract(s) to test — defaults to all
models/output_ports/**/*.odcs.yamlandmodels/input_ports/*.odcs.yaml.- Pick the server (defaults to the contract's Databricks server with environment
prod/production).- Run
datacontract testper contract and capture the result.- Report pass/fail with per-rule detail; flag missing credentials separately from real failures.
Then proceed.
Confirm uv tool run --from 'datacontract-cli[databricks]' datacontract --version works. If uv is missing, stop and tell the user to install it (curl -LsSf https://astral.sh/uv/install.sh | sh).
Confirm at least one *.odcs.yaml exists under models/output_ports/**/ or models/input_ports/. If not, stop and tell the user there is nothing to test.
Confirm Databricks credentials for the Data Contract CLI are in the environment. The CLI reads DATACONTRACT_DATABRICKS_* env vars, not ~/.dbt/profiles.yml. The minimum set:
DATACONTRACT_DATABRICKS_HTTP_PATH # SQL warehouse, e.g. /sql/1.0/warehouses/<id> — env only, never read from the contract
DATACONTRACT_DATABRICKS_TOKEN # PAT or OAuth access token (see below)
DATACONTRACT_DATABRICKS_SERVER_HOSTNAME # optional when the server block has `host`
datacontract test only runs SELECTs, so a read-only principal (e.g. a service principal with USE CATALOG, USE SCHEMA, SELECT) is enough — unlike dbt, which needs write rights. If any are unset, surface the list and ask whether to continue (the CLI will fail-fast on that server) or stop. Do not try to source credentials yourself, and never print token values.
models/output_ports/**/*.odcs.yaml and models/input_ports/*.odcs.yaml.CONTRACTS. For each entry, also remember its role (output or input) — Step 4 surfaces failures differently.For each contract in CONTRACTS:
type: databricks server with environment prod / production, then one named prod / production. Use its actual .server name (e.g. databricks-prod) — never assume production. If none matches, ask the user which one.--server all if the user explicitly asks to test every server.type: databricks, mark the contract skipped (this plugin is Databricks-only).For each contract:
uv tool run --from 'datacontract-cli[databricks]' datacontract test <path-to-contract>.odcs.yaml --server <server> --logs
Where <path-to-contract> is the file resolved in Step 1 — typically models/output_ports/v<N>/<file>.odcs.yaml for output contracts, or models/input_ports/<file>.odcs.yaml for input contracts. The CLI does not care which directory; the role only matters for how Step 4 reports the result.
DATACONTRACT_DATABRICKS_SERVER_HOSTNAME overrides the contract's host. If an input-port contract's host differs from this project's workspace, run it with that variable unset (and with an HTTP path + token valid for the upstream workspace), otherwise the CLI connects to the wrong workspace.--logs ensures per-rule failure detail is in stdout — without it the CLI only prints a summary.--output ./test-results/<contract>.xml --output-format junit.--publish <API_HOST>/api/test-results (API_HOST = entropy-data connection get -o json | jq -r .host) with ENTROPY_DATA_API_KEY set inline, e.g. ENTROPY_DATA_API_KEY="${ENTROPY_DATA_API_KEY:-$(entropy-data connection get --show-api-key -o json | jq -r .api_key)}". --publish-test-results is deprecated — don't use it. Do not publish by default — it writes server-side state.Token exchange failed, using external token — harmless.Run sequentially, not in parallel — the SQL warehouse is the bottleneck and parallel runs muddy the log output.
End with this two-part recap. Use the Status enum: passed, failed, skipped (missing creds or non-Databricks server).
Part 1 — outcome table. One row per contract tested. Group the rows: output-port contracts first, then input-port contracts under a sub-header (so the reader sees the two roles at a glance).
| Contract | Role | Server | Result | Failures | Details |
|---|---|---|---|---|---|
<contract-file> | output / input | <server> (<catalog>.<schema>) | passed / failed / skipped | count or — | one line per failing rule (field + rule), or "missing env var: …" if skipped |
Part 2 — next steps. Bullet list, include only what applies. Treat output vs. input failures differently:
customers.customer_id: not_null violated for 17 rows). The fix is in this project — either the dbt model is wrong, the contract is wrong, or the data is wrong. If the user wants a follow-up SQL to find the offending rows, suggest the shape but do not run it.dataproduct-implement once upstream republishes a corrected contract, so the cached snapshot under models/input_ports/ refreshes.skipped row, the exact env vars the user needs to set, and where to get them (usually the workspace admin).PERMISSION_DENIED / TABLE_OR_VIEW_NOT_FOUND on an input port usually means the access agreement isn't provisioned as a Unity Catalog grant yet (USE CATALOG, USE SCHEMA, SELECT) — not drift.If everything passed, write a single line: All <N> contracts pass against <server>.
The Data Contract CLI reads credentials from environment variables, not from the contract file. Only the connection topology belongs in the servers block — always with an explicit catalog:
servers:
- server: databricks-prod # the name is free-form; pass it to --server
type: databricks
environment: prod
host: adb-1234567890123456.7.azuredatabricks.net
catalog: acme_prod
schema: customers_v1
customProperties:
- property: httpPath # informational; the CLI reads the HTTP path from env
value: /sql/1.0/warehouses/abc123def456
There is no table in the server block: the table is the contract's schema[].physicalName // name (e.g. customers).
Personal access token (local runs):
export DATACONTRACT_DATABRICKS_SERVER_HOSTNAME=adb-1234567890123456.7.azuredatabricks.net
export DATACONTRACT_DATABRICKS_HTTP_PATH=/sql/1.0/warehouses/<warehouse-id>
export DATACONTRACT_DATABRICKS_TOKEN=dapi...
A PAT is long-lived until rotated. Scope it narrowly and avoid putting the export in .bashrc/.zshrc.
Short-lived OAuth from a logged-in databricks CLI (recommended for local runs):
export DATACONTRACT_DATABRICKS_TOKEN=$(databricks auth token --host "https://${DATABRICKS_HOST}" | jq -r .access_token)
Service principal, OAuth M2M — used for CI. Mint a ~1h token with the client-credentials grant:
export DATACONTRACT_DATABRICKS_TOKEN=$(curl -sf -X POST "https://${DATABRICKS_HOST}/oidc/v1/token" \
-u "${DATABRICKS_CLIENT_ID}:${DATABRICKS_CLIENT_SECRET}" \
-d 'grant_type=client_credentials&scope=all-apis' | jq -r .access_token)
export DATACONTRACT_DATABRICKS_SERVER_HOSTNAME=${DATABRICKS_HOST}
export DATACONTRACT_DATABRICKS_HTTP_PATH=${DATABRICKS_HTTP_PATH}
(Recent datacontract-cli releases can also do the exchange themselves from DATACONTRACT_DATABRICKS_CLIENT_ID / DATACONTRACT_DATABRICKS_CLIENT_SECRET when no token is set.) Grant the service principal USE CATALOG, USE SCHEMA, and SELECT on the schemas under test — nothing more. This read-only SP is enough for contract tests; dbt runs need a separate principal with write rights (see dataproduct-implement).
Azure Databricks with an Entra ID login — an Entra access token for the Azure Databricks resource also works as the token:
export DATACONTRACT_DATABRICKS_TOKEN=$(az account get-access-token --resource 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d --query accessToken -o tsv)
The CLI then logs Token exchange failed, using external token — harmless.
datacontract test which executes SELECT queries; it never writes. Do not invoke datacontract publish, datacontract export, or entropy-data datacontracts put from this skill..env, dotfiles, or anywhere else on the user's behalf.What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/dataproduct-bootstrapBootstrap a brand-new Databricks (Unity Catalog) dbt data product from scratch in one go — dbt_project.yml, generate_schema_name macro, model layout, README, .gitignore, profiles.yml(.example) for Databricks, ODPS, output-port ODCS, openlineage.yml, and a GitHub Actions workflow. Reuses the data product and contract when they are already published on Entropy Data. Trigger when the user asks to start a new data product, scaffold a new dbt project, or "create a Databricks data product from scratch."/dataproduct-implementGiven an Entropy Data data product URL or id, fetch its ODCS, derive and generate Databricks (Unity Catalog) dbt models, run dbt-ol (ship lineage to Entropy Data on the spot), run dbt tests, run datacontract tests, and mark the output port live on Entropy Data — end-to-end in one go. Demo-grade. Trigger when the user asks to "implement the data product <url>", "build the dbt pipeline for this data product", or "scaffold dbt models from a data contract".npx claudepluginhub entropy-data/dataproduct-builder-demo-databricks --plugin dataproduct-builder-demo-databricksOther plugins' skills for the same job