Esql logo

Esql

Community
sherman
esql

Review Elastic ES|QL queries for Elasticsearch 9.5.4 and later, covering compatibility, correctness, Prometheus and 01.metrics operational-metric semantics, alert reliability, and query performance. Use when Codex is asked to inspect, critique, fix, or rewrite ES|QL pipelines, especially Elastic/Kibana alert queries embedded in .yaml/.yml files or standalone .esql queries.

Overview

Publishersherman
Repositorycodex-skills
Skill nameesql
Stars
40
Forks
6
Bundled files
5
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by sherman on GitHub. Read the source before you install it.

Installation

Install the Esql AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/sherman/codex-skills/tree/master/skills/esql
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/sherman/codex-skills.git /tmp/codex-skills
mkdir -p .claude/skills
cp -r /tmp/codex-skills/skills/esql .claude/skills/esql
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Esql in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Esql on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Esql is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

ES|QL Query Review

Workflow

  1. Target Elasticsearch 9.5.4 and later; 9.5.4 is the minimum local version, not an exact version pin. Use the actual deployment version when known, and verify version-sensitive syntax and behavior against applicable official Elastic docs or matching-version material already supplied inside this project.
  2. Detect the input format before extracting queries:
    • For .yaml/.yml, parse the YAML and review each ES|QL block scalar such as query: |. Read the surrounding alert metadata and comments before reviewing the query.
    • For .esql, treat the file as one query unless the user explicitly identifies multiple queries.
  3. Infer the query intent, source grain, time range, whether the alert runner injects the time window, metric format and type, grouping grain, and alert condition before judging the query. Distinguish traditional Prometheus metrics from the 01.metrics operational format before reviewing aggregation semantics. In YAML alerts, use fields such as name, description, severity, interval_sec, and time_window as part of that contract.
  4. Read references/review-checklist.md for any non-trivial review. Read references/01-metrics.md when the query uses operational fields such as metrics.calls, metrics.failures, or metrics.duration_*, or when the metric format is ambiguous. Read good-examples.esql and bad-examples.esql when matching this repository's preferred review style or adding new examples. In bad-examples.esql, text after PROBLEM: or Problem: is annotation, not ES|QL.
  5. Review in passes: syntax/version, source scope, filter placement, aggregation grain, metrics semantics, null and multivalue behavior, arithmetic, alert determinism, result limits, and output shape.
  6. Prefer findings over generic advice. Every finding should name the risky fragment, explain why it matters, and propose a concrete fix or safer rewrite.

Choosing TS or FROM

In our metrics environment, all stored counters are interval deltas, including counters originating from Prometheus. Treat this as the established local data contract. For a direct total over complete intervals, sum the counts; for throughput, divide by the covered duration. Elasticsearch 9.5.4 also supports RATE and INCREASE on delta counters using the metric mapping and configured temporality metadata. Check that field configuration when judging a query; do not reject these functions merely because the samples are deltas. See references/ts-vs-from.md.

Choose from the required calculation, not from the fact that the source is a time series data stream (TSDS). Use FROM when matching samples can be combined directly; use TS when each series needs a separate calculation before combining results. For metric aggregations or a proposed TS/FROM rewrite, read references/ts-vs-from.md for the decision table, equivalence conditions, and examples.

Review Scope

  • Keep filesystem inspection inside the current ES|QL project and files explicitly supplied by the user.
  • Do not search sibling repositories, parent workspaces, application code, deployment code, or metric producers to infer undocumented behavior unless the user explicitly asks for that investigation.
  • Use the query, YAML metadata and comments, bundled references, examples, and official Elastic documentation. If these do not establish a data contract, state the assumption or uncertainty in the review instead of searching external code.

Review Stance

  • Be strict about correctness, false negatives, false positives, arbitrary alert rows, and obviously excessive shard scans.
  • Be careful with inferred data contracts. If a problem depends on undocumented assumptions such as "one document per metric per timestamp", say that explicitly.
  • Do not claim that a final KEEP or DROP improves aggregation cost. It mostly reduces response payload after upstream work has already happened.
  • Do not rewrite the whole query unless the user asks. For review, preserve the original intent and give minimal corrected fragments.
  • Treat good-examples.esql as style calibration: narrow sources where possible, filter early, name intermediate fields, use conditional STATS, use deterministic SORT before top-N LIMIT, and produce alert-friendly details.
  • Apply the local interval-delta contract and the TS/FROM decision rule when reusing examples. Existing SUM(SUM_OVER_TIME(...)) examples do not prove that TS is needed.

Output Format

Start with findings, ordered by severity. Use this shape:

text
[severity] Short title
Fragment: `...`
Why: ...
Fix: ...

Use severities:

  • blocker: invalid ES|QL, wrong version, or query cannot return intended result.
  • high: likely false alert, missed alert, or severe avoidable cluster cost.
  • medium: fragile metric semantics, cardinality risk, nondeterministic output, or maintainability issue that can affect operations.
  • low: readability, naming, comments, magic constants, or minor style.

After findings, include a corrected fragment or full corrected query only when it materially helps. If there are no material issues, say so and list residual assumptions that could not be verified from the query alone.

Version Notes

The local version range is Elasticsearch 9.5.4 and later. Prefer official Elastic documentation applicable to the actual deployment version or a checked-out matching Elastic branch over memory. Useful starting points are in references/elastic-docs.md.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Esql AI skill do?

Review Elastic ES|QL queries for Elasticsearch 9.5.4 and later, covering compatibility, correctness, Prometheus and 01.metrics operational-metric semantics, alert reliability, and query performance. Use when Codex is asked to inspect, critique, fix, or rewrite ES|QL pipelines, especially Elastic/Kibana alert queries embedded in .yaml/.yml files or standalone .esql queries.

Why use Esql on TypingMind?

Because you install it once and use it with any model. Esql is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Esql in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/sherman/codex-skills/tree/master/skills/esql. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Esql?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Esql?

As many as you like. As long as a model supports skills, you can use Esql with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Esql AI skill free?

It is published on GitHub by sherman. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇