promql-cli

tarafından samber

Prometheus ve PromQL uyumlu motorları (Thanos, Cortex, VictoriaMetrics, Grafana Mimir, Grafana Tempo...) sorgulamak için CLI — anlık sorgular, aralık sorguları, metrik keşfi (metrics/labels/meta alt komutları), çıktı biçimleri (table/csv/json/graph). PromQL sorguları yürütürken, gözlemlenebilirliğe sahip bir yazılımda performans sorunlarını giderirken, gecikme/hata oranları/doygunluğu araştırırken veya zaman serisi verilerini analiz ederken kullanın.

npx skills add https://github.com/samber/cc-skills --skill promql-cli

promql-cli — Prometheus Query CLI Skill

promql-cli (github.com/nalbury/promql-cli) is a Go CLI for querying, analyzing, and visualizing Prometheus metrics, plus PromQL fundamentals.

Reference Files

Read the relevant reference file(s) before executing tasks:

FileWhen to read
references/installation.mdUser needs to install promql-cli or set up configuration (hosts, auth, token, password, multi-host)
references/usage.mdUser wants to discover metrics/exporters/labels, run queries, or choose output formats
references/graphing.mdUser wants to visualize Prometheus data as an ASCII chart in the terminal
references/debugging.mdUser is investigating a performance issue, latency, errors, or saturation
references/promql-reference.mdUser needs help writing PromQL, understanding metric types, functions, or aggregations

For most tasks, read references/usage.md. For PromQL help, read references/promql-reference.md. When debugging, read both references/debugging.md and references/promql-reference.md.

Setup Check

Before running any query, verify that a host is configured:

promql 'up'   # succeeds if host is reachable; fails with connection error if not configured
# or
promql --host xxx 'up'

Recognize these errors as a configuration/auth problem and refer to references/installation.md:

ErrorCause
dial tcp ... connection refusedNo host running at the configured address
dial tcp ... no such hostHostname not resolved — wrong host in config
error querying prometheus: ...401...Bearer token missing or invalid
error querying prometheus: ...403...Token valid but insufficient permissions
please specify an authentication typeAuth flags partially set — use config file instead

If any of these appear, do not create config files on behalf of the user — config files may contain credentials (tokens, passwords) that must never pass through an LLM. Instead, guide the user to set it up themselves:

"Please create ~/.promql-cli.yaml manually with your Prometheus host (and credentials if needed). See references/installation.md for the exact format. Let me know once it's ready."

Only after the user confirms the config is in place should you proceed with queries.

Quick Command Reference

promql 'up'                                          # instant query
promql 'rate(http_requests_total[5m])' --start 1h    # range query (ASCII graph)
promql 'up' --output csv                             # CSV output
promql 'up' --output json                            # JSON output
promql metrics                                       # list all metric names
promql labels <metric>                               # list labels for a metric
promql meta <metric>                                 # show metric type and help
promql --config ~/.promql-cli-prod.yaml 'up'         # target a specific host

Key Principles

  1. Use rate() on counters, never raw values — raw counters only ever increase; the absolute value is meaningless. rate() gives the per-second change rate, which is what you actually care about.
  2. When debugging, isolate a single instance — aggregating across replicas masks per-instance anomalies. A single overloaded pod hidden behind healthy peers won't show up in averages.
  3. Filter early with label matchers in the innermost selector — Prometheus evaluates selectors before functions, so filtering late means scanning all time series. Early filters reduce data scanned and query latency.
  4. For histograms, keep le in the by clause before histogram_quantile() — the function needs all le buckets to interpolate percentiles; dropping le early produces NaN or wrong results.
  5. Prefer --output graph for range queries — ASCII sparklines convey trend direction (rising, falling, spiking) in a compact format that LLMs parse well; raw timestamp tables require mental modeling.
  6. Store credentials in ~/.promql-cli.yaml and ~/.promql_token, chmod 600 — passing tokens as CLI args exposes them in shell history and process listings.

This skill is not exhaustive. Please refer to the official promql-cli documentation and examples for up-to-date information. Context7 can help as a discoverability platform.

If you encounter a bug or unexpected behavior in promql-cli itself, open an issue at https://github.com/nalbury/promql-cli/issues.

samber tarafından daha fazla skill

golang-code-style
samber
Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), or doc comments (→ See `samber/cc-skills-golang@golang-documentation` skill).
developmentcode-review
golang-testing
samber
Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI, or debugging flaky/slow tests. For testify-specific APIs see `samber/cc-skills-golang@golang-stretchr-testify`; for measurement methodology see...
developmenttestingcode-review
golang-design-patterns
samber
Idiomatic Golang tasarım desenleri — fonksiyonel seçenekler, yapıcılar, hata akışı ve basamaklama, kaynak yönetimi ve yaşam döngüsü, zarif kapanış, dayanıklılık, mimari, bağımlılık enjeksiyonu, veri işleme, akış ve daha fazlası. Mimari desenler arasında açıkça seçim yaparken, fonksiyonel seçenekleri uygularken, yapıcı API'leri tasarlarken, zarif kapanış ayarlarken, dayanıklılık desenlerini uygularken veya belirli bir soruna hangi idiomatic Go deseninin uyduğunu sorarken uygulayın.
developmentdesigncode-review
golang-error-handling
samber
Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code. For samber/oops specifics → See `samber/cc-skills-golang@golang-samber-oops`...
developmentcode-review
golang-performance
samber
Golang performans optimizasyonu kalıpları ve metodolojisi - eğer X darboğazı varsa, Y uygulanır. Tahsis azaltma, CPU verimliliği, bellek düzeni, GC ayarlama, havuzlama, önbellekleme ve sıcak yol optimizasyonunu kapsar. Profilleme veya kıyaslamalar bir darboğaz tespit ettiğinde ve bunu düzeltmek için doğru optimizasyon kalıbına ihtiyaç duyduğunuzda kullanın. Ayrıca, hızlı performans kazanımlarını belirlemeye yardımcı olabilecek iyileştirmeler veya kıyaslamalar önermek için performans kod incelemesi yaparken de kullanın. Ölçüm metodolojisi için değildir (→...
developmentcode-review
golang-security
samber
Golang için güvenlik en iyi uygulamaları ve zafiyet önleme. Enjeksiyon (SQL, komut, XSS), kriptografi, dosya sistemi güvenliği, ağ güvenliği, çerezler, sır yönetimi, bellek güvenliği ve günlükleme konularını kapsar. Go kodunu güvenlik açısından yazarken, incelerken veya denetlerken ya da kripto, G/Ç, sır yönetimi, kullanıcı girişi işleme veya kimlik doğrulama içeren riskli kodlar üzerinde çalışırken uygulayın. Güvenlik araçlarının yapılandırmasını içerir.
securitycode-reviewdevelopment
golang-database
samber
Go veritabanı erişimi için kapsamlı rehber — parametrik sorgular, struct tarama, NULL yapılabilir sütunlar, işlemler, izolasyon seviyeleri, SELECT FOR UPDATE, bağlantı havuzu, toplu işleme, bağlam yayılımı ve geçiş araçları. PostgreSQL, MariaDB, MySQL veya SQLite ile etkileşim kuran Golang kodu yazarken, gözden geçirirken veya hata ayıklarken; veritabanı testi için; veya database/sql, sqlx veya pgx ile ilgili sorular için kullanın. Veritabanı şemaları veya geçiş SQL’i oluşturmaz.
developmentdatabase
golang-lint
samber
Golang projeleri için linting en iyi uygulamaları ve golangci-lint yapılandırması — linterları çalıştırma, .golangci.yml yapılandırma, nolint yönergeleriyle uyarıları bastırma, lint çıktısını yorumlama ve linter seçimi. golangci-lint yapılandırırken, lint uyarıları veya nolint bastırmaları hakkında soru sorarken, kod kalitesi araçları kurarken veya linter seçerken kullanın. Ayrıca kullanıcı golangci-lint, go vet, staticcheck veya revive'den bahsettiğinde de kullanın.
developmentcode-reviewtesting