/entropydata-dbt-demo-builder:datacontract-testfrom entropydata-dbt-demo-builder
Run `datacontract test` against the ODCS contracts of a data product in the Stackable demo to verify the live Trino data still conforms to schema, quality rules, and freshness. Handles two kinds of contracts with different semantics: output-port contracts in `dags/dataproducts/<id>/*.odcs.yaml` (tested against this data product's `hive-iceberg` schema: "am I still producing what I promised?") and input-port contracts referenced by the ODPS `inputPorts` (tested against the upstream server: "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 entropydata-dbt-demo-builder. 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 of a data product to check whether the data currently in Trino still matches the schema and quality rules declared in the contract. The Airflow DAG runs the same test after every build; this skill reproduces it on demand.
Two kinds of contracts matter here and they test against different Trino schemas:
dags/dataproducts/<id>/<contract-id>.odcs.yaml, referenced by the ODPS outputPorts[].contractId. What this data product commits to produce, usually in "hive-iceberg".<schema>. A failure means we are no longer producing what we promised.inputPorts[].contractId. They live in the upstream data product's folder (e.g. dags/dataproducts/tpch-source/tpch-source.odcs.yaml) or in Entropy Data. They test against the upstream server block (e.g. tpch.tiny). 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>/).
Before running Step 0, print this plan to the user verbatim:
Running datacontract-test. I'll:
- Pre-checks: confirm
datacontractis on PATH, Trino credentials are in the environment, andtrino-coordinator:8443is reachable.- Pick which contract(s) to test: defaults to the data product's output-port and input-port contracts.
- Pick the server (defaults to
trino).- 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 datacontract --version is on PATH. Prefer the data product's venv if it exists (export PATH="$PWD/dags/dataproducts/<id>/.venv/bin:$PATH", created by dataproduct-implement). If neither is available, stop and tell the user to install it: uv tool install 'datacontract-cli[trino]'.
Confirm at least one *.odcs.yaml exists under dags/dataproducts/*/. If not, stop and tell the user there is nothing to test.
Confirm Trino credentials for the Data Contract CLI are in the environment. The CLI reads DATACONTRACT_TRINO_* env vars, not profiles.yml:
DATACONTRACT_TRINO_USERNAME # admin
DATACONTRACT_TRINO_PASSWORD # same as TRINO_PASSWORD for dbt
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.
Confirm Trino is reachable on port 8443. Outside the cluster that needs kubectl port-forward svc/trino-coordinator 8443:8443 plus DATACONTRACT_TRINO_HOST=localhost, which overrides the contract's server host (if the TLS hostname check fails for localhost, add 127.0.0.1 trino-coordinator to /etc/hosts instead). If the Trino certificate is not in the system trust store, set REQUESTS_CA_BUNDLE to the CA file. If not reachable, say so and suggest re-running the Airflow DAG instead, which tests from inside the cluster.
dags/dataproducts/<id>/<id>.odps.yaml. Output-port contracts are the files <contractId>.odcs.yaml for each outputPorts[].contractId. Input-port contracts are inputPorts[].contractId: use dags/dataproducts/<input-port-name>/<contractId>.odcs.yaml if present, else fetch with entropy-data datacontracts get <contractId> -o yaml into a temporary directory outside the repo (never into the data product folder: the DAG would publish it).CONTRACTS. For each entry, also remember its role (output or input); Step 4 surfaces failures differently.For each contract in CONTRACTS:
trino.trino. If trino is not defined, ask the user which one.--server all if the user explicitly asks to test every server.For each contract:
datacontract test <path-to-contract>.odcs.yaml --server trino --logs
--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 (outside the data product folder).--publish $ENTROPY_DATA_HOST/api/test-results with ENTROPY_DATA_HOST and ENTROPY_DATA_API_KEY set inline (the CLI only sends the key to that host). Use the env vars if already set, otherwise read the saved connection: entropy-data -o json connection get | jq -r .host and entropy-data -o json connection get --show-api-key | jq -r .api_key. Do not publish by default; it writes server-side state.Run sequentially, not in parallel: Trino 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 Trino unreachable).
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 | trino | passed / failed / skipped | count or n/a | 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:
order_summary.order_id: not_null violated for 17 rows). The fix is in this data product: 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.skipped row, the exact env vars or port-forward the user needs.If everything passed, write a single line: All <N> contracts pass against trino.
The Data Contract CLI reads credentials from environment variables, not from the contract file. Only the connection topology belongs in the servers block:
servers:
- server: trino
type: trino
host: trino-coordinator
port: 8443
catalog: hive-iceberg
schema: demo
The demo's Trino uses basic auth over HTTPS (user admin). Setting a password switches the CLI to HTTPS:
export DATACONTRACT_TRINO_USERNAME=admin
export DATACONTRACT_TRINO_PASSWORD=...
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, Kubernetes secrets, 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 data product folder in the Stackable + Entropy Data demo repo in one go: `dags/dataproducts/<id>/` with ODPS, output-port ODCS, and a Trino dbt project (dbt_project.yml, profiles.yml, sources + marts model layout, README). If the data product already exists in Entropy Data (designed in the web UI), starts from its ODPS and output-port ODCS. The generic Airflow DAG picks the folder up after a push to Forgejo. Trigger when the user asks to start a new data product, scaffold a new dbt project in the demo, or "create a data product from scratch."/dataproduct-implementGiven an Entropy Data data product URL or id, merge its ODPS and ODCS into `dags/dataproducts/<id>/` of the Stackable demo repo, wire and request access to its input ports, implement the Trino dbt models the contract describes, run `dbt parse`, then get it running: either push to Forgejo and trigger the Airflow DAG (publish, `dbt-ol build` with OpenLineage, `datacontract test`), or run the same steps locally, and publish the result. Demo-grade. Trigger when the user asks to "implement the data product <url>", "implement the data product <id> with its data contract", "build the dbt pipeline for this data product", or "scaffold dbt models from a data contract".Other plugins' skills for the same job
npx claudepluginhub entropy-data/entropydata-dbt-demo-builder --plugin entropydata-dbt-demo-builder