Trail of Bits' security review skill for PRs, commits, and diffs: risk-first analysis with git history, blast radius, and honest coverage limits.
PromQL Query Patterns
Summary
Grafana's official PromQL skill: write, validate, and optimise Prometheus queries, and hunt down the label that blew up your cardinality.
Features
- rate vs irate vs increase, and the 4x-scrape-interval rule
- Aggregation with sum, avg, topk, by and without
- Classic and native histogram_quantile for correct percentiles
- Ratio queries with divide-by-zero guards
- SLO and burn-rate maths for error-budget alerts
- Cardinality-hunting playbook for slow queries and OOMs
- Recording-rule naming and dashboard-query migration
Install This Skill
Add this skill to your favorite AI agent in a few steps.
Skill Content
Usage Instructions
Learn how to use this skill with different AI agents.
Example Usage
Our checkout p95 dashboard looks wrong after we moved to native histograms — rewrite the panel query and add a 2%/1h burn-rate alert for the 99.9% availability SLO.
Description
Prometheus queries fail in quiet ways. A rate() over too short a window returns nothing instead of erroring, a p95 computed from the wrong histogram type is off by an order of magnitude, and a ratio divides by zero the moment traffic drops — none of which announce themselves. This skill from Grafana Labs gives an agent the query patterns that make those failures visible before they reach a dashboard.
What it covers
The core is the set of distinctions that PromQL punishes you for getting wrong: rate versus irate versus increase, label matchers and regex behaviour, and aggregation with sum, avg, topk, by, and without. On top of that it covers classic and native histogram_quantile, ratio expressions with divide-by-zero guards, absent and changes for staleness detection, time offsets and predict_linear for trend work, recording-rule naming conventions, and the SLO and burn-rate arithmetic behind error-budget alerts.
It also carries a cardinality-hunting playbook — the workflow for finding which label is generating the series explosion behind a slow query, an OOMing Prometheus, or an unexpected Grafana Cloud bill.
The rule it enforces first
rate() and increase() need a range vector of at least four scrape intervals. On a 60-second scrape that means [5m] minimum. Most "my query returns no data" reports resolve to this one line, which is why the skill states it as a golden rule up front.
Where it applies
The queries work against Prometheus, Grafana Mimir, and Grafana Cloud Metrics. The skill is written to trigger on the way people actually phrase these requests — "calculate the error rate", "p99 latency", "sum by service", "why is this query slow", "what's filling Mimir" — rather than requiring anyone to say the word PromQL.
Part of the grafana-core plugin in Grafana's public skills marketplace, alongside dashboarding, alerting and IRM, Alloy, Beyla, and OpenTelemetry skills.
Related Skills
Generates and validates parametric STEP-first CAD parts and assemblies from natural language.
Deno's official foundational skill — project setup, package choices, configuration, and CLI commands done the current way.
Build Gradio web UIs and ML demos in Python with the current API — components, layouts, events, and chat interfaces.