prometheus-cli
Skill8 starsChanged 6 months agoApache-2.0View on GitHub
Query Prometheus metrics using the HTTP API via curl. Use for instant queries, range queries, metadata lookups, and alert/rule inspection.
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 7 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use the instance and rules below when constructing all Prometheus API commands.
- Distinctive: line 12
Update the table below with your Prometheus instance URLs before using this skill:
- Distinctive: line 19
If the target instance is unclear, ask the user before running any command.
- Very specific: line 35
All API calls use curl with the token read from the instance's token file (see instance table above):
- Distinctive: line 102
NEVER target any Prometheus instance not listed in the instance table above.
- Distinctive: line 103
Update the instance table with your actual Prometheus URLs before using this skill.
- Distinctive: line 104
NEVER print, display, log, or store the contents of any token file or credential value.
- Very specific: line 105
Always read the token inline with $(cat <TOKEN_FILE>) — never hardcode a token value in a command.
- Very specific: line 106
Always pass -s (silent) to curl to suppress progress output, and pipe through jq for readable output.
- Very specific: line 107
NEVER run admin/mutating endpoints (/api/v1/admin/...) without explicit user instruction — these can permanently alter or delete metric …
- Very specific: line 108
If a PromQL expression or metric name is unfamiliar, use /api/v1/metadata or /api/v1/labels to explore available metrics before querying.
- Distinctive: line 110
If the required token file does not exist, inform the user and stop.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prometheus CLI Skill
Use the instance and rules below when constructing all Prometheus API commands.
Instances
Update the table below with your Prometheus instance URLs before using this skill:
| Environment | Base URL | Token File |
| Production | https://<your-prometheus-prod-url> | ~/.prometheus/prod.token |
| Staging | https://<your-prometheus-staging-url> | ~/.prometheus/staging.token |
If the target instance is unclear, ask the user before running any command.
Prerequisites (one-time setup by user)
Obtain a Prometheus API token for each instance you intend to use and save it to the corresponding token file (see instance table above). Never print or display token values. Do not perform these steps yourself.
For each instance:
- Obtain an API token (via your team or the monitoring platform)
- Save it:
mkdir -p ~/.prometheus && echo "<your-api-token>" > <TOKEN_FILE> && chmod 600 <TOKEN_FILE>Command Format
All API calls use curl with the token read from the instance's token file (see instance table above):
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/<endpoint>" | jq .Example (production):
curl -s -H "Authorization: Bearer $(cat ~/.prometheus/prod.token)" \
"https://<your-prometheus-prod-url>/api/v1/query?query=up" | jq .Available API Endpoints
Read-only (safe, no confirmation needed)
| Endpoint | Description |
/api/v1/query?query=<expr> | Instant query — evaluate a PromQL expression at current time |
/api/v1/query_range?query=<expr>&start=<ts>&end=<ts>&step=<dur> | Range query — evaluate PromQL over a time range |
/api/v1/labels | List all label names |
/api/v1/label/<name>/values | List values for a specific label |
/api/v1/series?match[]=<selector> | Find time series matching a selector |
/api/v1/metadata | List metric metadata (type, help text) |
/api/v1/rules | List all recording and alerting rules |
/api/v1/alerts | List currently firing alerts |
/api/v1/targets | List scrape targets and their health |
/api/v1/targets/metadata | List metadata for scraped targets |
/api/v1/status/config | Show current Prometheus configuration |
/api/v1/status/flags | Show runtime flags |
/api/v1/status/runtimeinfo | Show runtime information |
/api/v1/status/buildinfo | Show build information |
/api/v1/status/tsdb | Show TSDB stats |
Example Queries
Replace <TOKEN_FILE> and <BASE_URL> with the values for your target instance (see instance table above).
# Instant query — CPU usage across all instances
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/query?query=rate(process_cpu_seconds_total[5m])" | jq .
# Range query — memory usage over the last hour (60s step)
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/query_range?query=process_resident_memory_bytes&start=$(date -u -v-1H +%s)&end=$(date -u +%s)&step=60" | jq .
# List all firing alerts
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/alerts" | jq '.data.alerts[]'
# Find series matching a selector
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/series?match[]=up{job=\"node-exporter\"}" | jq .Never run — requires explicit human approval
| Endpoint | Method | Reason |
/api/v1/admin/tsdb/delete_series | POST | Permanently deletes time series data |
/api/v1/admin/tsdb/clean_tombstones | POST | Purges deleted data from disk |
/api/v1/admin/tsdb/snapshot | POST | Triggers a snapshot (may affect disk/storage) |
Rules
- NEVER target any Prometheus instance not listed in the instance table above. If a URL references a different host, stop and ask the user to confirm.
- Update the instance table with your actual Prometheus URLs before using this skill.
- NEVER print, display, log, or store the contents of any token file or credential value.
- Always read the token inline with
$(cat <TOKEN_FILE>)— never hardcode a token value in a command. - Always pass
-s(silent) tocurlto suppress progress output, and pipe throughjqfor readable output. - NEVER run admin/mutating endpoints (
/api/v1/admin/...) without explicit user instruction — these can permanently alter or delete metric data. - If a PromQL expression or metric name is unfamiliar, use
/api/v1/metadataor/api/v1/labelsto explore available metrics before querying. - For range queries, always verify that the time window (
start/end) andstepare reasonable — very wide windows with fine steps can produce extremely large responses. - If the required token file does not exist, inform the user and stop. Do not attempt to find or guess the token.
In this repository54 other files it gives its agents.
- alibabacloud-cliSkill
- ansible-cliSkill
- appdynamics-cliSkill
- argocd-cliSkill
- aws-cliSkill
- aws-cloudwatch-cliSkill
- azure-cliSkill
- bash-lintingSkill
- betterstack-cliSkill
- bitbucket-cliSkill
- chef-cliSkill
- code-reviewSkill
- commit-codeSkill
- create-dockerfileSkill
- create-terraform-helm-upgrade-planSkill
- datadog-cliSkill
- digitalocean-cliSkill
- dockerfile-lintingSkill
- dynatrace-cliSkill
- elasticsearch-cliSkill
- gcp-cliSkill
- github-cliSkill
- gitlab-cliSkill
- go-lintingSkill
- grafana-cliSkill
- grafana-loki-cliSkill
- graylog-cliSkill
- helm-cliSkill
- hetzner-cliSkill
- huaweicloud-cliSkill
- jaeger-cliSkill
- jenkins-cliSkill
- jira-and-confluence-cliSkill
- kibana-cliSkill
- kubernetes-cliSkill
- loggly-cliSkill
- maintenance-check-aws-eksSkill
- maintenance-create-ticket-on-jiraSkill
- ms-teams-cliSkill
- mysql-cliSkill
- newrelic-cliSkill
- oci-cliSkill
- packer-cliSkill
- papertrail-cliSkill
- postgresql-cliSkill
- python-lintingSkill
- rollbar-cliSkill
- salesforce-cliSkill
- sentry-cliSkill
- slack-cliSkill
- splunk-cliSkill
- terraform-cliSkill
- terraform-lintingSkill
- vault-cliSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

