grafana-clilisted
Install: claude install-skill abdullahkhawer/devops-skills
# Grafana CLI Skill
Use the instance and rules below when constructing all Grafana API commands.
## Instances
Update the table below with your Grafana instance URLs and corresponding token file paths:
| Environment | Base URL | Token File |
|---|---|---|
| Production | `https://<your-grafana-prod-url>` | `~/.grafana/prod.token` |
| Staging | `https://<your-grafana-staging-url>` | `~/.grafana/staging.token` |
If the target instance is unclear, ask the user before running any command.
## Prerequisites (one-time setup by user)
Generate a Grafana 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:
1. Navigate to `<BASE_URL>` → **Administration** → **Users and access** → **Service accounts** → **Add service account**
2. Enter a display name and role, then click **Create**
3. On the service account page, click **Add service account token** and copy the generated token
4. Save it:
```bash
mkdir -p ~/.grafana && 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):
```bash
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/<endpoint>" | jq .
```
Example (production):
```bash
curl -s -H "Authorization: Bearer $(cat ~/.grafana/prod.token)" \
"https://<your-