AGENT SKILL

cube-embed

Set up and debug Cube embedded analytics — embed sessions, embed tokens, embeddable dashboards and embed tenants — using the Cube CLI. Use whenever someone is shipping Cube analytics inside their own product: mint a session for an end user, enable a dashboard for embedding, set up multi-tenant isolation so each customer sees only their data, or debug why an embedded view is empty or unauthorized. Triggers on "embed this dashboard", "embedded analytics", "our customers need to see", "multi-tenant analytics", "the iframe is blank", "embed token", "sign the embed URL", "customer-facing dashboard". For internal access control use cube-admin; for the dashboards themselves use cube-build-content.

License 许可
Apache-2.0
最近更新
2026-10-01
Stars
★ 4
Forks
0

01 前言 Front Matter

name
cube-embed
license
Apache-2.0
description
Set up and debug Cube embedded analytics — embed sessions, embed tokens, embeddable dashboards and embed tenants — using the Cube CLI. Use whenever someone is shipping Cube analytics inside their own product: mint a session for an end user, enable a dashboard for embedding, set up multi-tenant isolation so each customer sees only their data, or debug why an embedded view is empty or unauthorized. Triggers on "embed this dashboard", "embedded analytics", "our customers need to see", "multi-tenant analytics", "the iframe is blank", "embed token", "sign the embed URL", "customer-facing dashboard". For internal access control use cube-admin; for the dashboards themselves use cube-build-content.
compatibility
Needs the Cube CLI, installed and logged in, and network access to Cube Cloud.

03 SKILL.md 正文

Embed Cube in your product

Embedding is where analytics leaves your team and reaches your customers, so the isolation model matters more than the mechanics. Most of the work is getting the security context right; the CLI part is short.

CLI-only. The Cube MCP tools do not mint embed sessions or configure embedding. Without a terminal and the Cube CLI, explain the model below and say which commands the user needs to run.

Preflight

command -v cube >/dev/null || echo "Cube CLI not installed: curl -fsSL https://raw.githubusercontent.com/cube-js/cube/master/install-cli.sh | sh"
cube whoami || echo "Not authenticated. Interactive: cube login. Headless: set CUBE_API_URL + CUBE_API_KEY."
cube context list

The model, before the commands

Four things, and conflating them is the usual source of confusion:

  • Embed tenant — one of your customers. The isolation boundary.
  • Embed user — an end user inside one of those customers.
  • Embed session / token — short-lived credentials carrying that user's security context. This is what makes row-level security apply.
  • Embeddable dashboard — a dashboard explicitly enabled for embedding. Dashboards are not embeddable by default.

The security context in the token is what the model's row-level security reads. Isolation is a property of the token you mint, not of the dashboard you embed. A correct dashboard with a wrong token shows one customer another customer's data — which is the failure mode worth being paranoid about.

Commands

cube embed generate-session --data '<session>'
cube embed token --session-id <session>

cube embed enable-dashboard <public-id>
cube embed dashboard <public-id>
cube embed disable-dashboard <public-id>

cube embed tenant groups <tenant>
cube embed tenant delete <tenant>
cube embed tenant delete-group <tenant> <group>

Sessions and tokens are minted server-side. They must never be generated in browser code or checked into a repository — anyone holding one has that user's access until it expires.

Setting up a new embedded dashboard

  1. Build and publish the dashboard (cube-build-content).

  2. Get the dashboard's public id, then run cube embed enable-dashboard — until this runs, embedding it fails.

  3. Confirm the model has row-level security keyed on the attribute your security context carries. Check with cube-explore-model; if it does not, stop and fix the model first.

  4. Mint a session for a test embed user of one tenant.

  5. Verify that user sees only that tenant's rows. cube deployments token carries your context, so it cannot test this. Mint a token for each of two tenants' security contexts, query the same measure with each through the cube-run-query endpoint, and confirm the numbers differ:

    cube environments create-token <deployment> <environment> --security-context '{"tenant_id":"<a>"}'
    

    The token is a credential — use it, never print it.

Step 5 is the one that catches broken isolation, and it is the one people skip because step 4 appeared to work.

Debugging an embedded view

Symptom Where to look
Blank iframe, no error Dashboard not enabled for embedding — run cube embed dashboard to check
401 / 403 in the iframe Token expired or minted for the wrong tenant
Renders but no rows Security context has no matching value — the token is valid but scoped to nothing
Shows too much data Row-level security is not applied. Stop and treat this as an incident, not a bug to iterate on
Works for you, not customers You are testing with an internal account that bypasses the tenant scope

Conventions

  • Never print a full token in output. Say that one was minted and for which user.
  • Always test with a real embed user, never an admin account. Admin accounts see everything, which makes broken isolation invisible.
  • When something is wrong with isolation, say so directly and stop.

04 同仓库更多 Skills

cube-js
cube-js/cube-agent-skills

cube-run-query

Run queries against a Cube deployment's semantic layer and interpret the results — through the Cube MCP tools when they are connected, or the Cube CLI from a terminal. Use whenever someone wants numbers out of Cube — pull a metric, check a total, compare periods, verify that a measure returns what it should, sanity-check a model change. Triggers on "how many", "what's the total", "show me revenue by month", "did that measure work", "what's our MoM growth", "pull the numbers for", and any request to verify a model change against real data. To find out what is queryable first use cube-explore-model; to change the model use cube-build-model; to save a result as a report or dashboard use cube-build-content.

★ 4
cube-js
cube-js/cube-agent-skills

cube-explore-model

Search and inspect a Cube semantic model — cubes, views, measures, dimensions, joins, and the files they live in — through the Cube MCP tools or the Cube CLI. Use whenever someone wants to know what data is available in Cube, where a metric is defined, which cube a field belongs to, how two cubes join, or what a change would affect. Triggers on "what can I query", "what measures do we have", "where is revenue defined", "show me the data model", "what's in this deployment", "which cube has customer email", and impact questions like "what breaks if I rename this". Read the model with this skill before changing it. To edit the model use cube-build-model; to run a query and get numbers back use cube-run-query; to browse workbooks, dashboards and reports use cube-explore-content.

★ 4
cube-js
cube-js/cube-agent-skills

cube-explore-content

Find and inspect saved content in a Cube workspace — workbooks, dashboards, reports, folders and scheduled notifications — using the Cube CLI, or the Cube MCP tools for content you already have a link to. Use whenever someone wants to know what already exists rather than build something new: locate a dashboard, list reports, see what a report queries, find who a notification goes to, or check what saved content references a model field before renaming it. Triggers on "what dashboards do we have", "find the revenue report", "where is that workbook", "what's in this folder", "who gets this scheduled report", "is anything using this field". To create or edit content use cube-build-content; to inspect the semantic model itself use cube-explore-model.

★ 4
cube-js
cube-js/cube-agent-skills

cube-deploy

Manage Cube deployments and their lifecycle — create deployments, deploy a project, check build status, manage environments and environment variables, connect a GitHub repo, and tail logs — using the Cube CLI. Use whenever someone wants to ship, configure or debug a deployment rather than change the model inside one. Triggers on "deploy this", "did the build pass", "why did the build fail", "set an environment variable", "create a deployment", "connect our repo", "show me the logs", "what regions are available", "the deployment is down". To change model files use cube-build-model; for users and access use cube-admin.

★ 4
cube-js
cube-js/cube-agent-skills

cube-configure-agent

Inspect and tune Cube's in-product AI agent — its rules, certified queries and Agent Skills — by authoring markdown in the semantic model, through the Cube MCP tools or the Cube CLI. Use whenever someone wants the Cube agent to answer better: teach it a business definition, stop it making a recurring mistake, certify a trusted query, capture a repeatable workflow as a skill, or find out why it answered the way it did. Triggers on "the agent keeps getting X wrong", "teach the agent that", "make the agent always", "add a certified query", "create an agent skill", "why did the agent say that", "what rules does the agent have". To change the underlying model use cube-build-model; to explore what is queryable use cube-explore-model.

★ 4
cube-js
cube-js/cube-agent-skills

cube-build-model

Author and change a Cube semantic model — add or edit cubes, views, measures, dimensions, joins and pre-aggregations in YAML — on a dev-mode branch through the Cube MCP tools or the Cube CLI, then commit and build. Use whenever someone wants to add a metric, define a measure or dimension, create a cube or view, join two cubes, fix a model error, rename a field, or expose a field to business users. Triggers on "add a metric", "define revenue", "create a view for", "expose this field", "join orders to customers", "fix the model", "add a pre-aggregation". Read the model first with cube-explore-model. To run a query against the result use cube-run-query; to deploy or check build status use cube-deploy.

★ 4