/omni-analytics:omni-queryfrom omni-analytics
Queries Omni Analytics' semantic layer via the Omni CLI to retrieve metrics, run reports, perform multi-step analysis, and compute table calculations like running totals and MoM change.
Ships in omni-analytics. 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.
Read when SKILL.md points to them.
Run queries against Omni's semantic layer via the Omni CLI. Omni translates field selections into optimized SQL — you specify what you want (dimensions, measures, filters), not how to get it.
Tip: Use
omni-model-explorerfirst if you don't know the available topics and fields.
omni config list # several profiles? ask the user which, then: omni config use <name>
omni whoami whoami # confirms auth and lists your permissions
omni update check -o json 2>/dev/null || true # updateAvailable: true? tell the user and share both upgrade commands
If
omniisn't installed, ask the user to install it (CLI README). On an auth error: a setOMNI_API_TOKENoverrides the profile, so retry once without it (env -u OMNI_API_TOKEN omni whoami whoami); otherwise followomni agent-help(Auth) to have the user sign in.
You also need a model ID and knowledge of available topics and fields.
omni query --help # List query operations
omni query run --help # Show flags for running a query
omni query run --schema # Request body and response shape
omni query run --schema --field query.filters # One sub-field, e.g. the filter union
omni ai --help # AI-powered query generation
omni-model-explorer; omni ai pick-topic / omni ai generate-query --run-query=false). Reach for raw userEditedSQL only when no topic fits, or when the user explicitly asks to run their SQL as-is. See Running Raw SQL. Don't passthrough SQL by reflex (you're not a text-to-SQL generator), and don't force-fit a topic that doesn't match.calc_name in both query.fields and calculations[] (true even for simple operators like OMNI_RUNNING_TOTAL). Include a compact query-JSON excerpt — query.fields, the real calculations[] object with operators/operands intact, relevant pivots[]/limit, and the validation result — not a paraphrase like { "OMNI_OFFSET_MULTI over": "field" } or "computed via OMNI_RUNNING_TOTAL." Long CSV can bury the query shape; show a few rows plus the reusable shape, or say you're omitting the full JSON for brevity.calculations[]. Write swallow_errors: false explicitly — omitting it defaults to true, which can turn a failed calc into #ERROR! cells or plausible wrong values on a COMPLETE query. Treat a blank, #ERROR! or suspiciously uniform calc column as a failed calc, and prefer the documented Omni operators: references/table-calculations.md.resultType:"json" (or "csv") at the body's TOP LEVEL — not inside query. Misplacing it inside query is silently ignored: you get the default base64-Arrow streaming envelope back (unreadable rows) and waste a round trip. See Handling and Validating Results.Prefer building every query on a topic, not a bare base view. Topics carry the governed joins, labels, and access — and a query not built on a topic is not accessible to restricted queriers/viewers (it works for you as a modeler/admin but silently fails for restricted roles). Set the query table to the topic's base view and pass join_paths_from_topic_name: <topic>. And if you are a Restricted Querier (QUERY_TOPICS, no QUERY_FULL_MODEL — check whoami), topic-based isn't just preferred, it's the only option: a bare base-view query or a raw-SQL userEditedSQL query needs QUERY_FULL_MODEL, so every query you author and place into content must be topic-based.
How the join map resolves joined-view fields. table stays the topic's base view; join_paths_from_topic_name lets the topic's join map reach joined-view fields from it — e.g. to select users.state on an order_items-based topic, table stays order_items and the join comes from the topic; you do not set table: users. Omit join_paths_from_topic_name (or point table at a non-base view) and joined-view fields may fail to resolve or join wrong. Confirm the base view and every reachable join with omni models get-topic <modelId> <topic> — its base_view_name and join_via_map show the base view and the join path to each reachable view. (This is the canonical topic-query shape; omni-content-builder tiles and omni-model-builder validation queries use it too.)
Decide where the query should come from:
omni-model-builder.omni-model-builder). Prompt the requestor first, and build it on a branch.Fallback — non-topic query pathways. Two pathways run outside any topic: a bare base view (table: + the global relationships file for joins) and raw SQL (userEditedSQL, see "Running Raw SQL"). Both share the same caveat: topic-scoped controls — access filters (row-level) and always_where — are not applied, and in a dashboard the tile is invisible to Viewer / Restricted Querier roles by default (handling a restricted audience is a content-permission concern — see omni-content-builder). The two pathways differ on object-level access grants: a bare-view query still enforces them, but raw SQL bypasses them too (it's the most permissive pathway). Prefer a topic when one fits; reach for a non-topic pathway only when nothing else expresses the query.
When the conclusion is "build or modify a topic," hand off to omni-model-builder to do it right.
Composite topics. A composite has no base view: send join_paths_from_topic_name: <composite> and no table, and address its fields with @ names: references/query-parameters.md.
omni query run --body '{
"query": {
"modelId": "your-model-id",
"table": "order_items",
"fields": [
"order_items.created_at[month]",
"order_items.total_revenue"
],
"limit": 100,
"join_paths_from_topic_name": "order_items"
}
}'
modelId goes inside query on every query run (for a branch or workbook model, use that model's id), and a date field supports a timeframe in brackets: [date], [week], [month], [quarter], or [year]. Pivoted queries reject limit: null unless the body sets a top-level resultType, so otherwise give them a numeric limit; transposed_measures takes an array of measure names, and true returns an empty result. query-parameters.md has the full parameter list, sorts, pivots, and common query patterns.
Each query.filters entry maps a field name to a typed object such as { "type": "string", "kind": "EQUALS", "values": ["California"] }, and a boolean filter uses is_negative with no kind or values. An object with the wrong properties for its type is silently ignored, so confirm that the filter bound in summary.display_sql (with cache: "SkipCache") or by a changed row count. Operators by type are in query-parameters.md, and every filter type is in filter-expressions.md.
Table calculations are AST objects in calculations[], and each calc_name must also be in query.fields, or the column never shows. Copy each request's AST from table-calculations.md; after lifting a calc from an agentic job's generate_query action (result.query), re-run your assembled query and compare its values with the job's csvResult. Query tasks are read-only unless the user explicitly asks to change the model: when a field seems missing, find the right model, topic, or branch or report the missing field, and do not create branches, add measures, or edit YAML to make a query work.
userEditedSQL)Use userEditedSQL only when no topic can express the query or the user asks to run their SQL as-is; it is the most permissive non-topic pathway, so keep it to ad-hoc reads by privileged users and strip it from any reused or dashboard query. A ${}-templated userEditedSQL from generate-query does not run through query run; treat it as a sign that the topic lacks a measure. An unbounded raw query stops at 50,000 rows whatever the envelope limit, so put LIMIT in the SQL; raw-sql.md has the body shape and options.
query)Request options such as resultType, cache, userId, branchId, and planOnly go at the top level of the body beside query; a key placed inside query is silently dropped, except branchId, which is rejected there. Validate with a JSON-mode run before showing the human-mode table or --chart view, and when workbookUrl or --workbook returns no link, the user lacks the workbooks permission, so do not retry. request-options.md lists every option and how to confirm an aggregate table served a query.
omni query runstreams NDJSON — it is NOT one JSON object. In JSON mode (pass-o jsonwhen parsing — a human default fromconfig set-formatorOMNI_OUTPUT_FORMATapplies even when piped, and prints a table instead) the CLI prints multiple JSON objects, one per line: first a{"jobs_submitted":{…}}line, then one{"job_id":…,"status":…,"summary":{…}}line per job, then a{"remaining_job_ids":[…],"timed_out":"false"}footer. (With a top-levelresultTypethe body is a single JSON/CSV document instead.) A naivejson.loads(entire_stdout)throwsJSONDecodeError: Extra data. Don't write a single-object parser — iterate lines and pick the ones withjob_id, or slurp withjq -s. The last line is the footer, not the result.--compactputs each object on one tidy line.
Without resultType, each job line carries the rows as base64 Arrow in result, unreadable inline. The row count is cache_metadata.num_rows (not summary.row_count); summary has invalid_calculations, missing_fields and display_sql. omni query wait --schema describes the job line and footer.
To read rows yourself, always set resultType: "json" (or "csv") at the body's TOP LEVEL — then stdout is a clean, directly-parseable JSON array (or CSV), with none of the Arrow/NDJSON envelope to unpack. This is the single reliable way to spot-check values; reaching for the default Arrow path and trying to decode rows from it is the common time-waster.
{ "query": { ... }, "resultType": "csv" }
resultType: "xlsx" is also valid, but it returns a binary .xlsx file (zip-based) — like the default Arrow blob, you can't read it inline without a spreadsheet app or a library. Use it only to deliver a file to a person, not to inspect results. For agent-side reading, stick to csv/json.
Check every response before trusting or presenting it, using the checklist below, and flag an empty result to the user. handling-results.md has the commands for each check and for decoding Arrow.
| Check | How | When |
|---|---|---|
| Query succeeded | Job line status is COMPLETE. A failed job carries error_type/error_message and the CLI still exits 0; with resultType, a failure is an error object and a non-zero exit | Every query |
| Calcs/fields valid | summary.invalid_calculations and summary.missing_fields empty | Every query (esp. with calculations) |
| Data was returned | cache_metadata.num_rows > 0 | Every query |
| Results not truncated | cache_metadata.num_rows < limit | When completeness matters |
| Columns are correct | CSV column headers match requested fields | When building dashboards or reports |
| Values are reasonable | Spot-check CSV output | When presenting to users |
| Filters are applied | Compare filtered vs unfiltered row counts | When using filters |
| Long-running query completed | Footer remaining_job_ids is empty | Queries on large tables |
If the footer's remaining_job_ids is non-empty (timed_out is "true"), poll those ids:
omni query wait --job-ids job-id-1,job-id-2
JSON mode never polls for you: the stream ends at the wait window, and a non-empty remaining_job_ids is the only sign the result is incomplete. (Human-mode output on CLI ≥ 1.3.0 does poll.)
Streaming large results (CLI ≥ 1.5.0): omni query wait --completion-only true completes a job without its result, or set "completionOnly": true at the body's top level on query run, never with resultType; then omni query results reads the result in slices for about an hour. handling-results.md has the steps.
Extract and re-run queries powering existing dashboards:
# Get all queries from a dashboard
omni documents get-queries <dashboardId>
# Run as a specific user
omni query run --body '{ "query": { ... }, "userId": "user-uuid-here" }'
# Cache policy (values: omni query run --schema --field cache)
omni query run --body '{ "query": { ... }, "cache": "SkipCache" }'
Run a saved query as it is saved (CLI ≥ 1.5.0). omni documents run-query <identifier> <queryId> runs one of the document's saved queries server-side and returns a single JSON / CSV / XLSX document — the query body is read on the server, so the caller can only replace or add filters for the run. A tile on the dashboard (or any query of a document with an app) runs for anyone who can view it; a hidden tile or an off-dashboard tab needs workbook access. <queryId> is the tile's queryIdentifierMapKey or its query presentation id from omni documents get-queries. Per-run filters are keyed by field name; a filter that cannot be applied fails the run with a 400 rather than running without it. With an org-scoped key, --user-id runs as that member, on get-queries too. Prefer this over reconstructing the full query run body when you want the saved behavior intact.
Instead of constructing query JSON manually, you can describe what you want in natural language and let Omni's AI generate the query.
omni ai generate-query <modelId> "<question>" generates and runs a query (--run-query false returns only the query JSON), and omni ai pick-topic shows the topic the AI would pick for a question; see ai-query-generation.md for the response shape and flags.
Submit with omni ai job-submit, poll omni ai job-status on its state field, and read omni ai job-result (resultSummary is the narrative; actions[] holds each step). The poll loop must stop on every terminal state (COMPLETE, FAILED, CANCELLED) and never be a fixed-count loop that breaks only on success; before presenting the answer, check each actions[] entry, and if a required generate_query action is pending, partial, or failed, the summary is not final, so run or regenerate that query and present only validated results. ai-query-generation.md has the loop code and the follow-up commands (submit feedback once per job).
Before a job's query becomes a dashboard queryPresentation, always set userEditedSQL to "" (a tile query requires the key). When calculations[] is empty, rebuild the calc from the action's result.csvResultFields, except aggregates such as SUM, which become filtered measures in the model; job-result-to-presentation.md has the full algorithm.
Use omni ai job-submit for anything non-trivial, including generating a table calc or reusable query AST (append "as a table calculation" to the prompt when you want one), and omni ai generate-query for simple queries or for shape-only drafts when query execution isn't permitted. The comparison table is in ai-query-generation.md.
For complex analysis, chain queries:
400 "Unable to parse data stream". Use the typed filter object: references/filter-expressions.md.Queries are ephemeral — there is no persistent URL for a query result. To give the user a shareable link:
{OMNI_BASE_URL}/dashboards/{identifier} (the identifier comes from the document API response)omni-content-builder with the query as a queryPresentation, then share {OMNI_BASE_URL}/dashboards/{identifier}Omni docs pages for queries, documents and AI: references/docs-links.md.
evals/evals.json (opens in a new tab)references/ai-query-generation.md (opens in a new tab)references/docs-links.md (opens in a new tab)references/filter-expressions.md (opens in a new tab)references/handling-results.md (opens in a new tab)references/job-result-to-presentation.md (opens in a new tab)references/query-parameters.md (opens in a new tab)references/raw-sql.md (opens in a new tab)references/request-options.md (opens in a new tab)references/table-calculations.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
12 skills in this plugin
/omni-adminAdminister an Omni Analytics instance — manage connections, users, groups, user attributes, permissions, schedules, and schema refreshes via the Omni CLI. Use this skill whenever someone wants to manage users or groups, set up permissions on a dashboard or folder, configure user attributes, create or modify schedules, manage database connections, refresh a schema, set up access controls, provision users, or any variant of "add a user", "give access to", "set up permissions", "who has access", "configure connection", "refresh the schema", or "schedule a delivery"./omni-ai-evalEvaluate Omni AI accuracy using Omni's built-in eval system — define a prompt set, run a judged eval against a model (or branch), and read the accuracy-judge verdicts. Use this skill whenever someone wants to evaluate Omni AI, benchmark Blobby, run regression tests, compare AI output across branches or model-context changes, measure AI quality, run A/B tests on model changes, assess the impact of an ai_context or modeling change, or any variant of "run evals", "test Blobby", "benchmark query generation", "compare AI results", "regression test", "how accurate is the AI", or "measure the impact of my changes"./omni-ai-optimizerOptimize an Omni Analytics model for Blobby, the Omni Agent — configure ai_context, ai_fields, synonyms, sample_queries, and ai_settings. Use this skill whenever someone wants to improve AI accuracy in Omni, make Blobby smarter, add AI context or example questions, curate which fields the AI sees, personalize AI context by user attribute, diagnose context-window pruning or truncation, raise a topic's AI context budget, control which topics AI can reach, troubleshoot why Blobby gives wrong answers, or any variant of "make the AI better", "Blobby isn't answering correctly", "optimize for AI", or "teach the AI about our data"./omni-content-builderCreate, update, and manage Omni Analytics documents and dashboards programmatically — document lifecycle, drafts, tiles, visualizations, filters, controls, and layouts — using the Omni CLI. Use this skill whenever someone wants to build a dashboard, create a workbook or document, add tiles or charts, configure dashboard filters or controls, set up a KPI view, lay out or rearrange tiles and pages, edit a dashboard as a draft and publish it, change dashboard settings, rename/move/duplicate/delete a dashboard, modify dashboard-level model customizations like workbook-specific joins or fields, or build and edit an Omni app (custom HTML content in place of a dashboard) — including casual phrasings like "make a dashboard for…", "add a chart to…", or "clean up this dashboard's layout" that don't name the skill. Load it before any document API call, even when a local build script exists. For running a query or pulling metrics use omni-query; for adding a field to the shared model use omni-model-builder./omni-content-explorerFind, browse, and organize content in Omni Analytics — dashboards, workbooks, folders, and labels — using the Omni CLI. Use this skill whenever someone wants to find an existing dashboard, search for content, list workbooks, browse folders, see what dashboards exist, find popular reports, download a dashboard as PDF or PNG, set an alert on a dashboard tile, favorite content, manage labels on documents, or any variant of "find the dashboard about", "what reports do we have", "show me our dashboards", "where is the sales report", "download this dashboard", or "alert me when this changes". This skill locates and organizes content; to inspect what a dashboard tile actually queries — its fields, filters, and sorts — use omni-query./omni-embedEmbed Omni Analytics dashboards in external applications — URL signing, custom themes, iframe events, entity workspaces, and permission-aware content — using the @omni-co/embed SDK and Omni CLI. Use this skill whenever someone wants to embed a dashboard, sign an embed URL, customize the embedded theme, handle embed events, listen for clicks or drills in the iframe, send filters to an embedded dashboard, set up entity workspaces, look up embed users, build a permission-aware content list, white-label an embedded dashboard, or any variant of "embed this dashboard", "customize the iframe theme", "handle click events from the embed", "filter the embedded dashboard", "set up embedding", or "what dashboards can this user see".npx claudepluginhub exploreomni/omni-agent-skills --plugin omni-analyticsOther plugins' skills for the same job