Agent Native

grafana

This skill enables programmatic management of Grafana resources through TypeScript tools and HTTP API calls.

by julianobarbosaCommunityNot reviewed

Community author

Agents
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode
License
MIT (permissive)
Pin
10f76d5pinned Oct 9, 2026
Context cost
about 1,800 tokenswhen the skill loads
GitHub stars
13on julianobarbosa/claude-code-skills
Scripts
2 scripts

What it does

“Comprehensive skill for interacting with Grafana's HTTP API to manage dashboards, data sources, folders, alerting, annotations, users, teams, and organizations. Use when Claude needs to (1) Create, read, update, or delete Grafana dashboards, (2) Manage data sources and connections, (3) Configure alerting rules, contact points, and notification policies, (4) Work with folders and permissions, (5) Manage users, teams, and service accounts, (6) Create or query annotations, (7) Execute queries against data sources, or any other Grafana automation task via API.”
The author's description, from SKILL.md

Generated summary from the skill's own text

This skill enables programmatic management of Grafana resources through TypeScript tools and HTTP API calls. It provides dashboard CRUD operations, data source management, alerting configuration, folder organization, user and team administration, and annotation handling via the DashboardCrud CLI tool and GrafanaClient library.

When to use it

  • Automate creation, updating, or deletion of Grafana dashboards
  • Manage data sources, folders, and alert rules across instances
  • Bulk operations on dashboards like cloning or tagging
  • Query and restore previous dashboard versions

When not to

  • Grafana UI interactions or visual panel editing are simpler
  • Real-time monitoring without dashboard management needs
  • Datasources with strict per-team permissions require special handling

Install

These commands install from the publisher's repository and need no account.

skills CLI

npx skills add julianobarbosa/claude-code-skills --skill grafana

Installs from the repository's default branch, which may have changed since the commit we checked.

GitHub CLI 2.90 or later

gh skill install julianobarbosa/claude-code-skills grafana@10f76d55afd646962f2747b241afb84ea68ca304

Installs the commit we checked (10f76d5).

Copy by hand

Download the folder at 10f76d5 and put it in .claude/skills/grafana for Claude Code and in .agents/skills/grafana for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.

Skill folder on GitHub at 10f76d5

Copy for your agent

A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.

Prompt

Install the agent skill "grafana" by julianobarbosa.

Source, pinned to commit 10f76d55afd646962f2747b241afb84ea68ca304:
https://github.com/julianobarbosa/claude-code-skills/tree/10f76d55afd646962f2747b241afb84ea68ca304/skills/grafana

1. Download that folder at exactly this commit. Do not use the default branch.
2. Copy every file unchanged, keeping the folder structure, into .claude/skills/grafana/ for Claude Code and .agents/skills/grafana/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist.
3. Do not edit the files, and do not run any script in the folder unless I ask you to.
4. When you are done, list the files you copied and where you put them.

Listing and checks: https://www.agentnative.dev/skills/julianobarbosa/grafana

SKILL.md at the pin

---
name: grafana
description: Comprehensive skill for interacting with Grafana's HTTP API to manage dashboards, data sources, folders, alerting, annotations, users, teams, and organizations. Use when Claude needs to (1) Create, read, update, or delete Grafana dashboards, (2) Manage data sources and connections, (3) Configure alerting rules, contact points, and notification policies, (4) Work with folders and permissions, (5) Manage users, teams, and service accounts, (6) Create or query annotations, (7) Execute queries against data sources, or any other Grafana automation task via API.
---

# grafana-skill

Programmatically manage Grafana resources using TypeScript tools and HTTP API workflows.

## Workflow Routing

| Workflow | Trigger | File |
|----------|---------|------|
| **DashboardCrud** | "create dashboard", "update dashboard", "delete dashboard", "list dashboards", "export dashboard" | `Tools/DashboardCrud.ts` |
| **GrafanaClient** | "grafana API", "grafana client", "TypeScript grafana" | `Tools/GrafanaClient.ts` |
| **ApiReference** | "grafana API reference", "grafana endpoints" | `References/` |

## Tools

### DashboardCrud CLI

```bash
# Set environment variables
export GRAFANA_URL="https://grafana.example.com"
export GRAFANA_TOKEN="your-service-account-token"

# List dashboards
bun run Tools/DashboardCrud.ts list
bun run Tools/DashboardCrud.ts list --query production --tag monitoring

# Get dashboard by UID
bun run Tools/DashboardCrud.ts get abc123

# Export dashboard to JSON
bun run Tools/DashboardCrud.ts export abc123 --output dashboard.json

# Create dashboard from JSON file
bun run Tools/DashboardCrud.ts create --file dashboard.json --folder my-folder

# Update dashboard
bun run Tools/DashboardCrud.ts update abc123 --file updated.json --message "Updated panels"

# Clone dashboard
bun run Tools/DashboardCrud.ts clone abc123 --title "Production Copy" --folder prod-folder

# View version history
bun run Tools/DashboardCrud.ts versions abc123

# Restore to previous version
bun run Tools/DashboardCrud.ts restore abc123 --version 5

# Delete dashboard
bun run Tools/DashboardCrud.ts delete abc123
```

### GrafanaClient TypeScript Library

```typescript
import { GrafanaClient, createGrafanaClient } from './Tools/GrafanaClient';

// Initialize from environment variables
const client = createGrafanaClient();

// Or with explicit config
const client = new GrafanaClient({
  baseUrl: 'https://grafana.example.com',
  token: 'your-service-account-token',
  orgId: 1, // optional
});

// Dashboard operations
const dashboards = await client.searchDashboards({ query: 'production', tag: 'monitoring' });
const dashboard = await client.getDashboardByUid('abc123');
const saved = await client.saveDashboard({ dashboard: myDashboard, folderUid: 'folder-uid' });
await client.deleteDashboard('abc123');

// Version management
const versions = await client.getDashboardVersions('abc123');
await client.restoreDashboardVersion('abc123', 5);

// Folders, Data sources, Alerting, Annotations also available
```

## Authentication

```bash
# Service Account Token (Recommended)
export GRAFANA_TOKEN="glsa_xxxxxxxxxxxxxxxxxxxx"

# Multi-Organization Header
curl -H "Authorization: Bearer $GRAFANA_TOKEN" \
     -H "X-Grafana-Org-Id: 2" \
     https://grafana.example.com/api/org
```

## Quick API Reference

| Resource | List | Get | Create | Update | Delete |
|----------|------|-----|--------|--------|--------|
| Dashboards | `GET /api/search` | `GET /api/dashboards/uid/:uid` | `POST /api/dashboards/db` | `POST /api/dashboards/db` | `DELETE /api/dashboards/uid/:uid` |
| Folders | `GET /api/folders` | `GET /api/folders/:uid` | `POST /api/folders` | `PUT /api/folders/:uid` | `DELETE /api/folders/:uid` |
| Data Sources | `GET /api/datasources` | `GET /api/datasources/uid/:uid` | `POST /api/datasources` | `PUT /api/datasources/uid/:uid` | `DELETE /api/datasources/uid/:uid` |
| Alert Rules | `GET /api/v1/provisioning/alert-rules` | `GET /api/v1/provisioning/alert-rules/:uid` | `POST /api/v1/provisioning/alert-rules` | `PUT /api/v1/provisioning/alert-rules/:uid` | `DELETE /api/v1/provisioning/alert-rules/:uid` |

## Reference Documentation

- **[Dashboards](References/Dashboards.md)**: Complete dashboard CRUD, versions, permissions
- **[DataSources](References/DataSources.md)**: Data source management, queries, health checks
- **[Alerting](References/Alerting.md)**: Alert rules, contact points, notification policies
- **[Folders](References/Folders.md)**: Folder management and permissions
- **[Annotations](References/Annotations.md)**: Create, query, update annotations
- **[UsersTeams](References/UsersTeams.md)**: User management, team operations
- **[CommonPatterns](References/CommonPatterns.md)**: Error handling, pagination, utilities

## Examples

**Example 1: List and export dashboards**
```
User: "List all production dashboards and export them"
→ bun run Tools/DashboardCrud.ts list --tag production
→ For each: bun run Tools/DashboardCrud.ts export <uid>
→ Returns list of exported JSON files
```

**Example 2: Create dashboard from JSON**
```
User: "Create a new dashboard from this JSON file"
→ bun run Tools/DashboardCrud.ts create --file dashboard.json --folder monitoring
→ Returns new dashboard UID and URL
```

**Example 3: Clone dashboard to another folder**
```
User: "Clone the CPU dashboard to the production folder"
→ bun run Tools/DashboardCrud.ts clone cpu-uid --title "CPU Prod" --folder prod-folder
→ Returns cloned dashboard details
```

**Example 4: Restore dashboard version**
```
User: "Restore dashboard abc123 to version 5"
→ bun run Tools/DashboardCrud.ts versions abc123
→ bun run Tools/DashboardCrud.ts restore abc123 --version 5
→ Dashboard restored, new version created
```

**Example 5: Programmatic bulk update**
```typescript
User: "Write TypeScript to bulk update dashboard tags"
→ Uses GrafanaClient library:
   const client = createGrafanaClient();
   const dashboards = await client.searchDashboards({ tag: 'old-tag' });
   for (const dash of dashboards) {
     const full = await client.getDashboardByUid(dash.uid);
     full.dashboard.tags = full.dashboard.tags.filter(t => t !== 'old-tag');
     full.dashboard.tags.push('new-tag');
     await client.saveDashboard({ dashboard: full.dashboard, message: 'Updated tags' });
   }
```

## Error Handling

| Code | Description |
|------|-------------|
| 200 | Success |
| 400 | Bad request (invalid JSON, missing required fields) |
| 401 | Unauthorized (invalid/missing token) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Not found |
| 409 | Conflict (resource already exists) |
| 412 | Precondition failed (version mismatch) |

## Tips

1. **Use UIDs over IDs**: UIDs are portable across Grafana instances
2. **Include version for updates**: Prevents overwriting concurrent changes
3. **Use `overwrite: true` carefully**: Only when you want to force-update
4. **Service accounts over API keys**: API keys are deprecated in newer Grafana versions

---

## Gotchas

- **Datasource permission**: viewers can see the panel but get "query forbidden" if the datasource has explicit per-team permissions — confusing for non-admin users.
- **Variable interpolation**: `$__interval` and `$__name` are interpreted differently in legacy vs newer query backends; same dashboard JSON behaves differently.
- **Provisioning datasources via YAML** under `/etc/grafana/provisioning`: edits via UI are silently reverted on file re-read; pick one source of truth.
- **API tokens are per-org** — multi-org Grafana setups need separate tokens; a global "admin" token doesn't span orgs.
- **Annotation queries with missing time-field return zero annotations** without error — debug by checking the raw query response, not the panel.
- **Alert rule state lives in the Grafana DB, not in Prometheus** — rolling Grafana back loses alert state history.

From julianobarbosa/claude-code-skills at 10f76d5, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.

View SKILL.md on GitHub at 10f76d5

Files

11 files, 104 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.

Skill folder on GitHub at 10f76d5
All Observability skills
  • dd-code-generation

    This skill enables agents to interact with Datadog through the pup CLI tool for immediate queries and operations, or generate code for integrating Datadog…

    by DatadogOfficial publisher

    Claude Code, Codex, Cursor +3 · about 4.3K tokens · pinned 6 days ago

  • sentry-fix-stack-traces

    This skill helps fix unreadable stack traces in Sentry by uploading the correct debug artifacts (source maps for JavaScript/TypeScript, or debug files like…

    by SentryOfficial publisher

    Claude Code, Codex, Cursor +4 · about 1.1K tokens · pinned 6 days ago

  • planetscale-codebase-sqlcommenter-instrumentation

    This skill inspects a application codebase to detect its language, framework, ORM, and deployment configuration, then recommends SQLCommenter-compatible query…

    by PlanetScaleOfficial publisher

    Claude Code, Codex, Cursor +4 · about 1.2K tokens · pinned 6 days ago

  • axiom-sre

    An expert SRE investigator skill that performs incident response, root cause analysis, and production debugging through hypothesis-driven methodology and…

    by axiomhqCommunity

    Contains scripts

    Claude Code, Codex, Cursor +3 · about 7.1K tokens · pinned 6 days ago

  • groundcover-cli

    Invoke the groundcover CLI to manage observability resources like dashboards, monitors, and silences, and to query logs, traces, metrics, and Kubernetes data…

    by paymogCommunity

    Claude Code, Codex, Cursor +4 · about 8K tokens · pinned 6 days ago

  • debugging-executions

    Debug workflow execution failures by inspecting failed nodes, re-running executions, and comparing expected versus actual values.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +3 · about 2.5K tokens · pinned 6 days ago

The skills listed here are third-party software, collected from public GitHub repositories as a catalog of recent skills and provided as is. Agent Native does not write or control them and is not responsible for any harm, loss or damage caused by installing or using them. Labels and checks describe what we saw at one commit and are not a guarantee. Read a skill's files before you run it. Terms of use