onboarding
Onboard an Elastic Cloud organization: configure the `elastic` CLI's Cloud context and API key, establish a default region, then…
Create and manage Kibana Dashboards and Lens visualizations. Use when you need to define dashboards and visualizations declaratively, version control them, or automate their deployment.
$ npx -y skills add elastic/agent-skills --skill kibana-dashboards --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/kibana-dashboardsContext preview
The summary Claude sees to decide when to auto-load this skill.
Create and manage Kibana Dashboards and Lens visualizations. Use when you need to define dashboards and visualizations declaratively, version control them, or automate their deployment.
name: kibana-dashboards description: > Create and manage Kibana Dashboards and Lens visualizations. Use when you need to define dashboards and visualizations declaratively, version control them, or automate their deployment. metadata: author: elastic version: 0.3.0 universal: true compatibility: Kibana 9.4 or later (Dashboards and Visualizations APIs) with matching Elasticsearch, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless. Requires the `elastic` CLI ≥ 0.3 with `stack kb` support (dedicated `dashboards` and `visualizations` commands).
Create, update, and delete Kibana dashboards and standalone Lens visualizations using the Kibana 9.4+ Dashboards and Visualizations APIs. Produce minimal, diffable JSON bodies; prefer inline panel definitions over library references; and choose the correct dataset type (data view vs ES|QL) before writing metrics or chart layers.
<!-- begin-partial: preamble -->
This skill executes Elasticsearch operations through the `elastic` CLI. If the [`elastic` CLI](https://github.com/elastic/cli#configuration) is not installed, tell the user what it is needed for. Do not guess credentials, call the HTTP API directly, or attempt other workarounds.
This skill references operations in HTTP-shorthand form (e.g., `GET /`, `GET /_cat/indices`, `GET /{index}/_mapping`, `GET /{index}/_settings/index.mode`, `POST /_query`). The [Operations](#operations) table at the end of this document maps each shorthand to the equivalent `elastic` CLI command — always use the CLI rather than calling the HTTP API directly.
<!-- end-partial: preamble -->
**Version requirement:** Kibana 9.4+ (Dashboards and Visualizations APIs).
**ES|QL placement:**
`PUT kbn:/api/dashboards/{id}`.
ES|QL — the persisted Lens state must use a text-based ES|QL datasource (`textBased` / `esql`), not a data-view count operation.
1. **Verify Kibana connectivity.** Call `GET kbn:/api/status`. If the call fails, stop and surface the error — do not guess endpoints or credentials. Read `version.number` to confirm the cluster meets the 9.4+ requirement.
2. **Classify the task.** Decide whether the user needs a **dashboard** (collection of panels, optional time range), a **standalone Lens visualization** (library item referenced by id or used alone), or **both**. Determine whether a deterministic saved-object id was supplied — when given, use upsert (`PUT`) with that id rather than `POST` (which auto-generates ids).
3. **Choose the dataset type before building metrics or layers.**
| User intent | Dataset | Metric / axis pattern | | ------------------------------------------------ | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | Simple count or aggregation on a saved data view | `data_source.type: "data_view_reference"` with `ref_id` | `metrics: [{ type: "primary", operation: "count" }]` (or other aggregation operations) | | Ad-hoc index pattern | `data_source.type: "data_view_spec"` with `index_pattern` and `time_field` | Same aggregation `operation` fields | | ES\|QL query (explicit or complex logic) | `data_source.type: "esql"` with `query` | `metrics: [{ type: "primary", column: "<alias>" }]` or layer axes `{ column: "<alias>" }` — **never** `operation: "count"` on the metric |
Write the aggregation in the ES|QL query (`STATS count = COUNT()`), then reference the resulting column by name.
4. **Build a dashboard body when creating or updating dashboards.** The request body is flat — `title`, `panels`, and optional `time_range` at the root. Do not wrap in `{ data: ... }` on write. Required fields:
example `{ "from": "now-7d", "to": "now" }`). Supplying `time_range` persists the dashboard time filter on open (equivalent to enabling time restore in the UI).
**Upsert with a deterministic id:**
{
"title": "Sales Overview",
"panels": [],
"time_range": { "from": "now-7d", "to": "now" }
}Call `PUT kbn:/api/dashboards/eval-sales-overview` with the body above when the user supplies that id.
**Inline ES|QL metric panel example** (inside `panels`):
{
"type": "vis",
"id": "total-requests",
"grid": { "x": 0, "y": 0, "w": 12, "h": 6 },
"config": {
"title": "Total Requests",
"type": "metric",
"data_source": {
"type": "esql",
"query": "FROM logs* | STATS count = COUNT()"
},
"metrics": [{ "type": "primary", "column": "count" }]
}
}Prefer inline `config` properties over `config.ref_id` for portable dashboards. Read [Dashboard API Reference](references/dashboard-ap
Elastic Agent Skills — built by the people who built Elastic — deliver native platform expertise directly to your AI coding agent.
Onboard an Elastic Cloud organization: configure the `elastic` CLI's Cloud context and API key, establish a default region, then…
Provision and operate Elastic Cloud infrastructure: create, connect to, update, and delete Serverless projects (Elasticsearch,…
Explain Elasticsearch ML anomaly detection scores, model behavior, and result interpretation. Use when the user asks why a score…
Create and manage Elastic ML anomaly detection jobs via the API. Use when setting up jobs on an index or data stream, configuring…
Diagnose a non-green Elasticsearch cluster and surface the single most likely cause with remediation. Use when an operator…
Execute ES|QL (Elasticsearch Query Language) queries, use when the user wants to query Elasticsearch data, analyze logs,…