Back to Skills

promql-cli

CLI for querying Prometheus and PromQL-compatible engines (Thanos, Cortex, VictoriaMetrics, Grafana Mimir, Grafana Tempo...) — instant queries, range queries, metric discovery (metrics/labels/meta subcommands), output formats (table/csv/json/graph). Apply when executing PromQL queries, troubleshooting performance issues on a software having observability, investigating latency/error rates/saturation, or analyzing time series data.

147stars10forksUpdated 6/26/2026

Security Assessment

Medium Risk(60/100)

Detected risks:

Privilege Escalation([references/installation.md] sudo)
Security Score60/100

About promql-cli

promql-cli wraps the Go CLI `promql` (github.com/nalbury/promql-cli) for querying, analyzing, and visualizing Prometheus metrics, and works against PromQL-compatible engines including Thanos, Cortex, VictoriaMetrics, Grafana Mimir, and Grafana Tempo. It applies when running PromQL queries, troubleshooting performance on a system with observability, investigating latency, error rates, or saturation, or analyzing time series. It requires both `promql` and `jq`, and is user-invocable.

The skill organizes guidance into reference files to read before acting: installation (hosts, auth, tokens, passwords, multi-host), usage (metric/exporter/label discovery, queries, output formats), graphing (terminal ASCII charts), debugging (latency, errors, saturation), and a PromQL reference (metric types, functions, aggregations). Core commands include instant queries (`promql 'up'`), range queries with ASCII graphs (`promql 'rate(http_requests_total[5m])' --start 1h`), output formats table/csv/json/graph, and discovery subcommands `metrics`, `labels <metric>`, and `meta <metric>`. A specific config can be targeted with `--config`. Before any query it performs a setup check by running `promql 'up'` and maps common errors — connection refused, no such host, 401, 403, and "please specify an authentication type" — to configuration or auth problems documented in the installation reference.

A notable safety stance: because config files may contain credentials such as tokens and passwords that must never pass through an LLM, the skill does not create config files on the user's behalf. Instead it instructs the user to create `~/.promql-cli.yaml` themselves (and `~/.promql_token`, chmod 600) and proceeds only once they confirm. Its key principles reflect PromQL best practice: use rate() on counters rather than raw values, isolate a single instance when debugging instead of aggregating across replicas, filter early with label matchers in the innermost selector, keep le in the by clause before histogram_quantile(), and prefer --output graph for range queries since ASCII sparklines convey trend direction compactly. It points to the official promql-cli documentation and Context7 for discoverability, and to the project issue tracker for bugs.

FAQ

What does this skill require to run?

It requires the promql-cli binary (promql, from github.com/nalbury/promql-cli) and jq. It is user-invocable.

Which monitoring backends does it work with?

Prometheus and other PromQL-compatible engines including Thanos, Cortex, VictoriaMetrics, Grafana Mimir, and Grafana Tempo.

Will it set up my Prometheus host and credentials for me?

No. Because config files may contain tokens or passwords that must never pass through an LLM, it does not create config files on your behalf. It guides you to create ~/.promql-cli.yaml yourself and proceeds only after you confirm it is ready.

How do I discover what metrics and labels are available?

Use the discovery subcommands: promql metrics lists all metric names, promql labels <metric> lists a metric's labels, and promql meta <metric> shows its type and help text.

Why does it recommend rate() and the graph output for time series?

Raw counters only ever increase so their absolute value is meaningless; rate() gives the per-second change you actually care about. For range queries it prefers --output graph because ASCII sparklines convey trend direction compactly and are easy for an LLM to parse.

All Files

7 files
references/graphing.md0.8 KB
View
references/installation.md4.0 KB
View
evals/evals.json10.3 KB
View
SKILL.md5.5 KB
View
references/usage.md3.1 KB
View
references/debugging.md6.5 KB
View
references/promql-reference.md3.9 KB
View

Install promql-cli

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill