promql

Write and optimize PromQL queries for Prometheus and Grafana Cloud Metrics.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/Canepro/codex-skills --skill promql-canepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: promql
Source: https://github.com/Canepro/codex-skills/tree/main/skills/promql
Command: npx skills add https://github.com/Canepro/codex-skills --skill promql-canepro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PromQL expression authoring and optimization for time-series data in Prometheus and Grafana Cloud Metrics, improving accuracy and performance of dashboards and alerts.

Core Features & Use Cases

  • Query construction: build rate, histogram_quantile, and aggregation queries that return correct results across multi-label environments.
  • Validation and optimization: verify query correctness, reduce cardinality, and pre-compute expensive expressions with recording rules.
  • Use Case: For a service with many instances, create a query to monitor per-service error rate and latency percentiles, then alert when thresholds are breached.

Quick Start

Ask me to generate a rate query for http_requests_total over the last 5 minutes.

Frequently Asked Questions about promql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a PromQL query to calculate the error rate for a service with multiple labels?

To calculate a per-service error rate in PromQL, you aggregate error metrics by labels and divide by total requests. This skill constructs precise rate queries that return correct results across multi-label environments.

What is the best way to compute latency percentiles using histogram_quantile in Prometheus?

Computing latency percentiles with histogram_quantile requires correctly grouping bucket boundaries and labels. This skill generates valid histogram_quantile queries for accurate latency monitoring in Grafana Cloud Metrics and Prometheus.

How can I reduce high cardinality in Prometheus time-series data?

Reduce high cardinality by pre-computing expensive PromQL expressions with recording rules. This skill validates query correctness and optimizes metrics to lower cardinality across services.

Can I build SLO alerts and dashboards with PromQL for Grafana Cloud Metrics?

Yes, you can build SLO alerts and dashboards using PromQL for Grafana Cloud Metrics. This skill supports SLO query construction and threshold-based alerting for time-series data.

Why does my Prometheus rate calculation return empty or incorrect results?

Prometheus rate calculations fail when time windows or label matchers are misconfigured. This skill writes and validates rate queries over specified intervals to ensure accurate time-series results.