---
title: "PromQL query patterns: review, setup & limitations · Undominated.ai"
canonical: https://undominated.ai/skills/grafana-promql/
description: "PromQL skill that puts rate before aggregation, keeps the le label inside histogram_quantile, and guards a zero denominator."
---

# PromQL query patterns: review, setup & limitations · Undominated.ai

> PromQL skill that puts rate before aggregation, keeps the le label inside histogram_quantile, and guards a zero denominator.

[← Explore all skills](/skills/)

METRICS / Grafana Labs

# PromQL query patterns

PromQL skill that puts rate before aggregation, keeps the le label inside histogram_quantile, and guards a zero denominator.

 [See setup guidance ↓](#setup)[Original source ↗](https://github.com/grafana/skills/tree/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql)

SOURCE REVIEW

 Reviewed 2026-10-15
 Evidence 4 linked sources
 Publisher Grafana Labs
 Licence [Apache-2.0 ↗](https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/LICENSE)
 Revision 1ccacf29049f
 [Read what was—and wasn’t—checked ↓](#review)

“Write, validate, and optimize PromQL for Prometheus / Grafana Mimir / Grafana Cloud Metrics. Covers rate vs irate vs increase, label matchers and regex, sum / avg / topk / by / without aggregation, classic + native histogram_quantile, ratios with divide-by-zero guards, absent / changes for staleness, time offsets and predict_linear, recording-rule naming, SLO + burn-rate math, and a cardinality-hunting playbook. …”

 [Grafana Labs · upstream description ↗](https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql/SKILL.md) Our analysis follows below.

01 / THE REASONING

## Why this made the selection.

 - The primary file shows rate before sum, histogram_quantile with by (le, service), a comparison that drops zero denominators, and a recording-rule replacement checked against the Prometheus query API.
- references/patterns.md at this commit was read: irate is limited to spike detection, recording-rule names use aggregation level, metric, and operation, and the burn-rate snippet divides by (1 - 0.999) as a placeholder target.

### A good fit for

 - Writing an error-rate or latency query against Prometheus or Mimir
- Turning a slow dashboard expression into a recording rule
- Validate a recording rule against its original expression at the same timestamp
- Compare a query’s magnitude with an independent observation before using it in a dashboard.

### Weigh up before choosing

 - The curl examples default to http://localhost:9090 and say to add basic auth for Grafana Cloud. No query was sent. The 0.999 figure is a placeholder in the file, not a measured SLO.
- The skill was not executed. A grafana/skills install of a wider path can include skills this review did not select, including the Loki skill withheld from this pass.
- A successful empty query is not evidence of zero events; inspect metric existence, labels and the observation window. Do not remove series-distinguishing labels at scrape time to address a slow query.

02 / THE REVIEW RECORD

## What we actually inspected.

Source review has boundaries. A clear record is more useful than a “safe” badge.

### Material inspected

 - skills/grafana-core/promql/SKILL.md
- skills/grafana-core/promql/references/patterns.md
- LICENSE at the same commit
- vercel-labs/skills@48dc9e8eb8aa19040e91cb90ba0b642c9cbad57e:README.md
- LICENSE

### Our findings

 - The Apache appendix at this commit says Copyright 2026 Grafana Labs.
- The common failure modes, including a dropped le label and aggregation before rate, are written in the primary file and repeated with examples in patterns.md.
- The definition separately checks API status, result count, metric existence and magnitude, then requires a recording rule to match the source expression.
- The error-rate ratio divides only by a sum that has been compared with greater-than zero.
- The query validation workflow goes beyond successful parsing and nonempty results by comparing magnitude with a known ground truth such as a load run or log count.

### Not established by this review

 - No PromQL query was sent to a Prometheus or Grafana Cloud endpoint.
- The Alloy labeldrop example was not applied to a scrape config.
- Not executed: it was not installed or run.

The review applies to the material and revision named here. A newer upstream release can change its behavior.

03 / PUT IT TO WORK

## Add a skill to your workflow.

[Upstream setup instructions ↗](https://github.com/vercel-labs/skills/blob/48dc9e8eb8aa19040e91cb90ba0b642c9cbad57e/README.md)

DOCUMENTED COMMAND

 npx skills add grafana/skills/skills/grafana-core/promql Copy command ↗

Run in your terminal to choose your AI tools, project or global scope, and installation method. This short command follows the current upstream version; the review covers the revision shown above.

 Optional: install the reviewed revision

Keeps the original source and installer version where recorded, while leaving your AI tools and installation scope for you to choose.

 npx skills add https://github.com/grafana/skills/tree/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql Copy reviewed-revision command ↗ - The command pins only the PromQL skill at the reviewed commit. The installer was not executed.
- Do not point the installer at a parent directory if you only want this skill.

### Before you start

 - Node.js and npm
- A Prometheus, Mimir, or Grafana Cloud metrics endpoint you are allowed to query

### Compatibility

Agent Skills hosts · Prometheus or Grafana Mimir

### Implementation

Markdown

### Local query instructions; examples send PromQL to an endpoint

 - Read metric names you supply
- HTTP GET to the Prometheus API when the agent runs the curl examples
- Read metrics through the configured tenant endpoint; recording-rule deployment changes persistent server evaluation.

### Cost model

Apache-2.0 instructions at no charge. Grafana Cloud queries use the account whose token you supply.

04 / FOLLOW THE EVIDENCE

## The source trail.

Our notes are separate from the original resource. Check upstream before adopting a new version.

 - [Skill definition ↗](https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql/SKILL.md) Checked 2026-10-14 https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql/SKILL.md Supports: summary, whySelected
- [Pattern library ↗](https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql/references/patterns.md) Checked 2026-10-07 https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql/references/patterns.md Supports: irate scope, recording-rule names, burn-rate placeholder
- [Apache-2.0 licence ↗](https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/LICENSE) Checked 2026-10-07 https://github.com/grafana/skills/blob/1ccacf29049fde66637fe01ab93a83a772da323b/LICENSE Supports: Redistribution terms, Copyright 2026 Grafana Labs
- [Pinned continuation review C2-W26 ↗](https://raw.githubusercontent.com/grafana/skills/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql/SKILL.md) Checked 2026-10-15 https://raw.githubusercontent.com/grafana/skills/1ccacf29049fde66637fe01ab93a83a772da323b/skills/grafana-core/promql/SKILL.md Supports: review.findings, bestFor

KEEP COMPARING

## Other approaches to consider.

Related by category or shared topics. These are alternatives to inspect, not a measured quality order.

 [### Grafana Cloud dpm-finder ↗ Pins Grafana's dpm-finder skill, which checks a metrics-read key before the scan and skips metrics that return HTTP 422.](/skills/grafana-dpm-finder/)[### Frontend Observability session RCA ↗ Pins Grafana's frontend session skill, which stops until three ids are present and treats the saved gcx dump as untrusted.](/skills/grafana-frontend-session-rca/)[### Grafana alerting and IRM ↗ Pins Grafana's alerting and IRM skill, which requires a bearer token, checks the receiver before live routing, and silences notifications without stopping evaluation.](/skills/grafana-alerting-irm/)

 [AI Tools ↗](/tools/)[Skills ↗](/skills/)[Agents ↗](/agents/)[MCP Servers ↗](/mcp-servers/)[Workflows ↗](/workflows/)

## Continue your investigation

 - [Choose a toolkit](/tools/)
- [Inspect execution hosts](/agents/)
- [Check tool access](/mcp-servers/)
- [Check project dependencies](/check-repo/)
