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 alerting rules. Use when creating, updating, or managing rule lifecycle (enable, disable, mute, snooze), choosing metric threshold rule types and params, or read-only find/list with tag filters.
$ npx -y skills add elastic/agent-skills --skill kibana-alerting-rules --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/kibana-alerting-rulesContext preview
The summary Claude sees to decide when to auto-load this skill.
Create and manage Kibana alerting rules. Use when creating, updating, or managing rule lifecycle (enable, disable, mute, snooze), choosing metric threshold rule types and params, or read-only find/list with tag filters.
name: kibana-alerting-rules description: > Create and manage Kibana alerting rules. Use when creating, updating, or managing rule lifecycle (enable, disable, mute, snooze), choosing metric threshold rule types and params, or read-only find/list with tag filters. metadata: author: elastic version: 0.3.0 universal: true compatibility: Kibana 8.x or 9.x with matching Elasticsearch, self-managed, Elastic Cloud Hosted, or Elastic Cloud Serverless; some rule types and features are version- or license-gated (for example, rule-level flapping is GA in 9.3). Requires the `elastic` CLI ≥ 0.2 with `stack kb` support.
Create, inspect, update, and manage Kibana alerting rules: choose the right rule type, encode threshold and grouping semantics, attach actions only when requested, and list or filter rules read-only when the user asks to discover existing coverage.
<!-- 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 -->
A rule has three parts: **conditions** (`params` + `rule_type_id`), **schedule** (how often conditions are checked), and **actions** (optional connectors run when alerts fire). When conditions are met, the rule creates **alerts**; actions deliver notifications through **connectors**. Do not create connectors or actions unless the user explicitly asks for notification wiring — many tasks require only the rule definition.
Required privileges: `all` on the owning Kibana feature (Stack Rules, Observability, Security, etc.) and `all` on Rules Settings. Managing connectors needs `all` on Actions and Connectors; `read` is sufficient to attach existing connectors as rule actions.
**On-premises prerequisite:** configure a stable `xpack.encryptedSavedObjects.encryptionKey` in `kibana.yml` before creating rules — it encrypts rule API keys and connector secrets. If it is unset, each restart regenerates it and breaks existing rules; all Kibana nodes in a cluster must share the same key.
1. **Classify the task.** Decide whether the user needs to **create** a rule, **find/list** rules (read-only), **update** an existing rule, or perform a **lifecycle** change (enable, disable, mute, snooze, delete). If the user only asks to show or list rules, treat the request as read-only — do not create, update, enable, or delete anything.
2. **For find/list tasks, filter and page sensibly.** Call `GET kbn:/api/alerting/rules/_find` with query parameters that narrow results instead of dumping every rule:
Enumerate matching rule ids and names. If no rules match, say so plainly — do not invent results. Query alerting rules specifically, not connectors or streams.
3. **For create tasks, choose the rule type before writing params.** Match the user's intent to a metric/threshold rule type — not log, anomaly, or unrelated types:
`consumer: "stackAlerts"`.
`"infrastructure"`.
Read [rule-types-reference.md](references/rule-types-reference.md) for param schemas, valid consumers, and action groups. When the user specifies an index, field, threshold, duration, and grouping field, encode all four explicitly in `params` — do not substitute a connector or action for the condition.
4. **Encode threshold, duration, and grouping correctly.** These three dimensions are independent:
`system.cpu.total.pct` is typically fractional (`0.9` for 90%); use `90` only when the field is on a 0–100 scale.
Align `schedule.interval` with that window (e.g., both five minutes) so a brief spike does not fire on a mismatched cadence. Add `alert_delay: {"active": N}` only when the user wants N **consecutive** matching runs, not a single lookback window.
(e.g., `host.name`), and a `termSize` large enough to cover all entities ("any host"). Without grouping, the rule aggregates globally and will not alert per host.
5. **Build the create payload.** Required fields: `name`, `rule_type_id`, `consumer`, `schedule`, `params`. Optional: `tags`, `enabled`, `actions`, `alert_delay`, `flapping`. Use the user-supplied rule id in the URL when given; otherwise let Kibana generate one.
**Example params — CPU > 90% on any host for 5 minutes on `eval-alert-metrics`:**
{
"name": "CPU exceeds 90% for 5 minutes",
"rule_type_id": ".index-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,…