Works with the AI Agents you already use
PromQL Query Helper and Validator
by Saizul Amin
Write, explain and fix PromQL queries, with a static checker and a library of ready queries for RED/USE metrics, SLIs, error ratios, latency percentiles, saturation and capacity.
$4
PromQL Query Helper and Validator
Example session with this skill installed
Run the PromQL Query Helper and Validator skill on my project and give me a prioritised list of what to fix, with exact changes.
- Read your context and instructions
- Compiled the promql query helper
Here is what the PromQL Query Helper and Validator skill produced.
Demo: real, unedited output of the skill's bundled script on a sample input from its test suite.
Output
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:4: histogram_quantile(0.99, sum by (job) (rate(http_request_duration_seconds_bucket[5m])))
HIGH histogram_quantile.missing_le: the aggregation inside histogram_quantile() drops the 'le' label
-> keep it: sum by (le) (rate(x_bucket[5m])) or sum by (le, job) (...)
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:6: histogram_quantile(0.95, http_request_duration_seconds_bucket)
MEDIUM histogram_quantile.no_rate: histogram_quantile() over raw bucket counters gives the quantile since process start
-> wrap the buckets in rate(x_bucket[5m])
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:8: rate(sum(http_requests_total)[5m:])
HIGH rate.of_aggregation: rate(sum(...)) aggregates before rating: counter resets are lost (and without a subquery it is a syntax error)
-> use sum(rate(x[5m])): rate first, then aggregate
LOW counter.raw: counter 'http_requests_total' used without rate()/increase()
-> raw counters only go up and reset on restart; use rate() or increase()
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:10: sum(http_requests_total{job=~"api"})
LOW counter.raw: counter 'http_requests_total' used without rate()/increase()
-> raw counters only go up and reset on restart; use rate() or increase()
INFO regex.no_metachar: job=~"api" has no regex characters
-> use job="..."
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:12: sum by (job) (rate(http_errors_total[5m])) / sum by (job, instance) (rate(http_requests_total[5m]))
MEDIUM binary.mismatched_grouping: '/' between aggregations grouped by ['job'] and ['instance', 'job']: series only match on identical label sets
-> group both sides by the same labels, or use on(...)/ignoring(...) with group_left
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:16: histogram_quantlie(0.9, sum by (le) (rate(x_bucket[5m])))
MEDIUM function.unknown: 'histogram_quantlie(' is not a PromQL function or aggregation
-> check the spelling (e.g. histogram_quantile, rate, sum)
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:18: rate(node_memory_MemAvailable_bytes[1m])
LOW rate.on_non_counter: rate() on 'node_memory_MemAvailable_bytes', which does not look like a counter
-> rate() is for counters (*_total); for gauges use deriv(), delta() or avg_over_time()
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:20: max_over_time(rate(http_requests_total[5m])[30d:1m])
LOW subquery.expensive: subquery [30d:1m] evaluates 43200 steps per point
-> use a recording rule, or a coarser step
-Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/observability-skills/tests/fixtures/promql/queries.promql:22: sum(rate(http_requests_total{path=~".*"}[30s]))
MEDIUM rate.short_window: rate() over [30s] is shorter than 60s
-> use at least 4x the scrape interval; in Grafana use [$__rate_interval]
LOW regex.match_all: path=~".*" matches everything, including series without the label
-> drop the matcher, or use =~".+" to require the label
10 expression(s), 12 finding(s): 2 high, 4 medium, 5 low, 1 info
What you do next
- Fix the highest-severity items first.
- Ask your agent to apply the fixes it suggests, then run the skill again to confirm.
- Keep the skill installed and re-run it whenever the project changes.
Connects securely to your tools. The creator never sees your data.
About this skill
Write, explain and fix PromQL queries, with a static checker and a library of ready queries for RED/USE metrics, SLIs, error ratios, latency percentiles, saturation and capacity. The checker finds histogram_quantile() that drops the le label or skips rate(), rate() without a range or applied after sum(), raw counters, rate windows that are too short, typos in function names, =~ that should be =, match-all selectors, divisions whose sides are grouped by different labels (empty results) and expensive subqueries; it reads expressions from the command line, .promql files, rule files and Grafana dashboards.
Who it's for
Use when the user asks how to query something in Prometheus, Grafana or Mimir/Thanos/VictoriaMetrics, says a query returns no data, NaN, wrong numbers or is slow, wants p95/p99 latency, error rate or SLO queries, or pastes PromQL to review.
What's inside
- Tested, offline Python script(s): promql_check.py (deterministic results, standard library only unless noted)
- Reference guides: query-library.md, pitfalls.md
- Step-by-step agent instructions in SKILL.md covering: When to use; When not to use; Workflow
Why it's worth it
Generic prompts guess. This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice. See the real demo below.
Works with every major AI agent
Built on the open SKILL.md standard: Claude Code, Codex CLI, Cursor, VS Code Copilot, Gemini CLI, Windsurf and 20+ other agents.
Requirements
- Python 3.8+ for the bundled scripts
- No API keys, no account, runs locally
Open source: saizul/observability-skills on GitHub (MIT licence, by Saizul Amin).
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
- Software
Python 3.8+