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.
Security Assessment
Detected risks:
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.
Install promql-cli
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
samber/cc-skills