Obs query

From shepard-system/shepard-obs-stack · View interactive version

Obs query is an AI agent skill from the GitHub repository shepard-system/shepard-obs-stack. Execute PromQL or LogQL queries against Prometheus and Loki. Use this skill whenever the user wants to run a custom query, check a specific metric value, search logs, asks "what is the value of metric X", wants to explore data in Prometheus or Loki, or pastes a PromQL/LogQL expression. Also use when

How to use this skill

Skill file

Obs Query

Execute arbitrary PromQL or LogQL queries and present results.

Query type detection

How to execute

PromQL instant query

scripts/obs-api.sh prom /api/v1/query --raw --jq '.data.result' --data-urlencode "query=<EXPR>"

PromQL range query

scripts/obs-api.sh prom /api/v1/query_range --raw --jq '.data.result' --data-urlencode "query=<EXPR>" --data-urlencode "start=$(date -v-1H +%s)" --data-urlencode "end=$(date +%s)" --data-urlencode "step=60"

LogQL query

scripts/obs-api.sh loki /loki/api/v1/query_range --raw --jq '.data.result' --data-urlencode "query=<EXPR>" --data-urlencode "limit=20"

Examples

For a comprehensive list of PromQL and LogQL examples, read references/examples.md in this skill directory.

Output

For output format options (table/csv/json), read .claude/skills/obs-shared/assets/output-formats.md.

Instructions

  1. Take the user's query from the skill argument (everything after /obs-query)
  2. If no query provided, read references/examples.md and show common examples
  3. Detect query type and execute with appropriate endpoint
  4. Format results as table (instant vectors), summary (range), or log lines
  5. If query fails, show the error and suggest fixes
  6. Safety: read-only GET queries only — never POST, PUT, DELETE, or admin endpoints
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.