/dataproduct-builder-databricks:dataproduct-sharefrom dataproduct-builder-databricks
Sync approved Entropy Data access agreements to Unity Catalog grants (internal consumers) or Delta Shares (external consumers). Reads `entropy-data access list --provider-dataproduct <id>`, filters to active agreements, and applies `GRANT SELECT` on the output port's table or creates a Delta Share with that table added. Trigger when the user asks to "grant access to consumers", "apply UC grants for approved access", "set up Delta Sharing for this product", or "sync access agreements to Databricks".
Ships in dataproduct-builder-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.
This data product is a provider — other products consume from it. Entropy Data tracks access agreements where the access has been approved; until the grant lands in Unity Catalog (or a Delta Share is created), the consumer can see the data product in the catalog but cannot actually SELECT from it. This skill closes that gap.
Two delivery mechanisms, chosen per agreement:
GRANT SELECT ON TABLE <catalog>.<schema>.<table> TO <principal>. Native Unity Catalog, no separate sharing object.dataproduct-deploy. Grants are independent of bundle deployment.databricks grants update --json '{"changes":[{"principal":"...","remove":["SELECT"]}]}' or databricks shares update --remove-table ... command and stop.Before running Step 0, print this plan to the user verbatim:
Running dataproduct-share. I'll:
- Pre-checks: confirm this is a bundle, the
databricksCLI is authenticated with grant permission, and theentropy-dataCLI is connected.- Resolve the data product id from
<id>.odps.yaml(or ask).- List approved access agreements where this product is the provider.
- Classify each as internal (UC grant) or external (Delta Share). Ask if unclear.
- Build a grant/share plan, show it to you. Wait for your confirmation.
- Apply grants with
databricks grants update; create/update shares withdatabricks sharescommands.- Report what was applied, what failed, what's already in place.
Then proceed.
databricks.yml exists at the working directory root.databricks --version is on PATH and databricks auth describe succeeds. The authenticated identity must have MANAGE on the target catalog or MANAGE GRANT on the output port's table — databricks grants get TABLE <catalog>.<schema>.<table> should succeed. If it fails with a permissions error, surface it and ask the user to either re-auth as a privileged principal or hand off the generated grant commands to someone who can run them.uv run --quiet entropy-data --version succeeds from the project root. If it fails, run uv sync and retry. Then confirm uv run entropy-data connection test succeeds. Use uv run entropy-data … for every CLI invocation in this skill.DATA_PRODUCT_ID: look for a single *.odps.yaml at the repo root and read id. If multiple ODPS files exist or none, ask the user.entropy-data access list --provider-dataproduct <DATA_PRODUCT_ID> -o json
Keep only entries with info.active: true (status approved); ignore pending, rejected, and revoked. The remaining entries each describe one consumer relationship; capture for each:
consumer.dataProductId and consumer.teamconsumer.principal (the workspace-side identity to grant to — may be empty if the agreement was created before this field existed)provider.outputPortId (which output port of ours they have access to)info.approvedAt, info.purposeRemember the filtered list as AGREEMENTS. If empty, write No approved access agreements for <DATA_PRODUCT_ID>. and stop.
Cross-reference each agreement's provider.outputPortId against the local <id>.odps.yaml. If an agreement references an output port that no longer exists locally (e.g. it was removed or renamed), flag it as orphaned and exclude from the plan — surface in the final report.
For each agreement, decide the delivery mechanism:
| Consumer signal | Mechanism | Notes |
|---|---|---|
consumer.principal matches <email>@<your-account-domain> or a known service-principal id in the same account | Internal — UC grant | Use databricks grants update |
consumer.principal is a Delta Sharing recipient name (already created) | External — Delta Share | Use databricks shares update --add-table |
consumer.principal is an email at an unrecognized domain | External — Delta Share (create recipient first) | Use databricks recipients create then databricks shares ... |
consumer.principal is empty | Ask the user | "Agreement doesn't specify a principal. Is consumer <consumer.dataProductId> internal (give a UC principal) or external (give a Delta Sharing recipient or email)?" |
To determine "same account": fetch the current workspace's account id once (databricks current-user me -o json for the user's identity; for service principals, the account id is in databricks auth describe -o json). Treat any principal whose account id matches as internal. Heuristic-fail: if you cannot infer the account, default to ask the user rather than guessing.
Record the chosen mechanism per agreement as MECHANISM[<agreement-id>] = "uc" | "share".
Print one table per mechanism so the user can review the full plan before anything runs.
Unity Catalog grants:
| Agreement | Consumer | Output port | Table | Principal | Action |
|---|---|---|---|---|---|
<agreement-id> | <consumer.dataProductId> | <output-port-id> | <catalog>.<schema>.<table> | <principal> | GRANT SELECT (already present / new) |
Delta Shares:
| Agreement | Consumer | Output port | Table | Share | Recipient | Action |
|---|---|---|---|---|---|---|
<agreement-id> | <consumer.dataProductId> | <output-port-id> | <catalog>.<schema>.<table> | <share-name> | <recipient-name> | "add table to share" / "create share + add table" / "create recipient + share + add table" |
The share name convention: <DATA_PRODUCT_ID>_share (one share per data product; tables added per agreement). If the user prefers per-output-port shares, ask before proceeding.
Wait for explicit user confirmation before applying anything.
For each Unity Catalog grant in the plan:
Check current grants: databricks grants get TABLE <catalog>.<schema>.<table> -o json. If <principal> already has SELECT, mark as already present and skip.
Apply the grant:
databricks grants update TABLE <catalog>.<schema>.<table> \
--json '{"changes":[{"principal":"<principal>","add":["SELECT"]}]}'
Verify by re-reading grants. If SELECT is now present, mark as created; otherwise failed with the API error.
For each Delta Share in the plan:
Ensure the recipient exists. databricks recipients get <recipient-name> -o json — if 404, create it:
databricks recipients create --json '{"name":"<recipient-name>","authentication_type":"TOKEN"}'
For Databricks-to-Databricks sharing (consumer is on Databricks), use authentication_type: DATABRICKS instead and pass data_recipient_global_metastore_id from the consumer's metastore.
Ensure the share exists. databricks shares get <share-name> -o json — if 404, create it (the share name is positional, not --name):
databricks shares create <share-name>
Add the table to the share if not already present:
databricks shares update <share-name> --json '{"updates":[{"action":"ADD","data_object":{"name":"<catalog>.<schema>.<table>","data_object_type":"TABLE"}}]}'
Grant the share to the recipient. The write command is update-permissions (note: shares share-permissions is the read-only command and takes no update subverb):
databricks shares update-permissions <share-name> \
--json '{"changes":[{"principal":"<recipient-name>","add":["SELECT"]}]}'
Mark as created (full path), updated (table added to existing share), or already present (recipient + share + table + permission all already wired).
If any step fails, capture the CLI error and continue to the next agreement — do not abort the run on a single failure, the user will want a full report of what worked and what didn't.
End with this two-part recap. Use the shared Status enum (AGENTS.md § Final-report Status enum). For failed grants/shares, use the informal failed value in the table cell with the error in Details.
Part 1 — outcome table. Group rows by mechanism.
| Agreement | Mechanism | Target | Status | Details |
|---|---|---|---|---|
<id> | UC grant | <catalog>.<schema>.<table> ← <principal> | … | "SELECT added" / "already present" / "failed: " |
<id> | Delta Share | <share-name> ⇢ <recipient-name> (+ <table>) | … | "share created + table added + recipient granted" / "table added to existing share" / "already present" / "failed: " |
Append a sub-table for orphaned agreements (active in Entropy Data, but the output port no longer exists locally):
| Agreement | Consumer | Missing output port | Suggested action |
|---|
Part 2 — next steps. Bullet list:
failed row, the exact CLI command to retry manually with the error context.databricks recipients get <recipient> -o json returns activation_url for token-auth recipients — surface it but do not share it via email/Slack from this skill).If nothing was changed (every agreement was already in place), write a single line: All <N> active access agreements for <DATA_PRODUCT_ID> are already wired up.
server block in <id>.odps.yaml. If the bundle was last deployed to a dev target but the ODPS server points at the prod catalog, the grants land on prod — flag this explicitly when the targets disagree.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub entropy-data/dataproduct-builder-databricks --plugin dataproduct-builder-databricks9 skills in this plugin
/datacontract-editEdit an output-port ODCS file under src/output_ports/v<N>/, run the contract test against the live data, and classify any failures as breaking or non-breaking changes — with suggested fixes. Only edits output-port contracts (the spec this data product commits to); input-port contracts under src/input_ports/ are upstream's responsibility and refreshed by dataproduct-implement. Trigger when the user asks to "add/remove/change a column in the data contract", "update the data contract", or "test contract changes"./datacontract-testRun the Data Contract CLI (`datacontract test`) against ODCS contracts in the project to verify the live data still conforms — schema, quality rules, and freshness. Handles two kinds of contracts with different semantics: output-port contracts under `src/output_ports/**/*.odcs.yaml` (tested against this project's Databricks warehouse — "am I still producing what I promised?") and input-port contracts under `src/input_ports/*.odcs.yaml` (tested against the upstream warehouse — "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"./dataproduct-deployValidate, deploy, and run the Declarative Automation Bundle's Lakeflow pipeline against a chosen Databricks target. Wraps `databricks bundle validate`, `databricks bundle deploy`, and `databricks bundle run`, then polls `databricks pipelines get` for completion and surfaces any failed expectations or pipeline-level errors. Trigger when the user asks to "deploy the data product", "run the Lakeflow pipeline", "deploy and run the bundle", or "ship this to dev"./dataproduct-exampledataExtract a small sample of rows from a Databricks output port via a non-production SQL warehouse, scrub anything classified as PII or sensitive in the data contract, and upload the scrubbed sample to Entropy Data via the entropy-data CLI. Trigger when the user asks to "upload example data", "publish sample rows for the data product", or "give consumers a preview of the data"./dataproduct-implementGiven an Entropy Data data product URL or id, fetch its data contracts (output port ODCS files written next to the Python under src/output_ports/v<N>/, input port ODCS files cached next to their Spark reader under src/input_ports/), translate the schema into Lakeflow @dp.materialized_view / @dp.table Python pipelines, and ensure the project has the publishing layer (ODPS, GitHub Actions). Trigger when the user asks to "implement the data product <url>", "build the Lakeflow pipeline for this data product", or "scaffold output-port tables from a data contract"./dataproduct-initInitialize a brand-new Databricks data product from scratch — create databricks.yml (Declarative Automation Bundle with `dev` and `prod` targets), a serverless Lakeflow Spark Declarative Pipeline resource, a Lakeflow Job that schedules it, the src/{input_ports,transformations,output_ports/v1}/ layout, pyproject.toml, README, and .gitignore. After scaffolding, hands off to the entropy-data-publish skill to add the publishing layer (ODPS, ODCS, GitHub Actions). Trigger when the user asks to start a new data product, scaffold a new Databricks bundle, or "create a data product from scratch."