consensys/ask-o11y-plugin/writing-promql-and-logql
Claude Code and agent skill by consensys/ask-o11y-plugin
- community
Checking that the SKILL.md file is still in the repository.
Writes efficient PromQL for Prometheus/Mimir metrics and LogQL for Loki logs, including label discovery for unfamiliar clusters. Use when the user asks for queries, graph data, metric analysis, or log searches, or before building panel or alert queries — even when they say "error rate", "p99", "how many errors", "log query", or "show me latency" without naming a query language.
Install
npx vskill@latest install consensys/ask-o11y-plugin/writing-promql-and-logqlSKILL.md
Golden rules
rate()/increase()need a range vector at least 4x the scrape interval — 60s scrape means[5m]minimumrate()first, then aggregate — neversum()a raw counter and thenrate()it- Keep
lein the inner aggregation ofhistogram_quantileor the result is NaN - Guard ratios against divide-by-zero:
sum(rate(errs[5m])) / (sum(rate(reqs[5m])) > 0) - Use label matchers to cut cardinality; start with short time ranges and expand
PromQL
See references/promql.md for the full pattern library — counters, gauges, histograms, ratios, absence and staleness (absent, changes), offsets and predict_linear, recording rules, SLO burn-rate math, and cardinality investigation queries.
LogQL
- Start with label filters, add line filters second, parse last
See references/logql.md for the full guide, including the label-discovery workflow for unfamiliar clusters, the parser matrix (json, logfmt, pattern, regexp, unpack), label_format, metrics-from-logs, and unwrapped range aggregations such as quantile_over_time over unwrapped durations.
Discovering the schema first
For an unfamiliar datasource, run label/metric discovery tools before writing queries — never guess label names or metric names. Verify values exist before filtering on them.
Choosing signal
Prefer the cheapest signal that answers the question: metrics for trends and aggregates, logs for events and errors, traces for request-level latency and causality. Do not query all three when one answers the question directly.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpkg/skills/bundled/writing-promql-and-logql/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/consensys/ask-o11y-plugin/writing-promql-and-logql)