grafana-foundation-sdk
Build Grafana dashboards as code with the grafana-foundation-sdk typed builders (TypeScript or Go). Use when creating, modifying, or generating Grafana dashboard JSON programmatically, converting hand-written dashboard JSON to typed code, building monitoring dashboards, or working with Prometheus/Loki queries in dashboards.
Rank
62
Safety
84
Downloads
1.3k
Updated
Oct 10, 2026
Version
0.2.4
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 10, 2026
- Adoption signal
- 1.3K downloadsadoption · observed Oct 10, 2026
- Latest release
- 0.2.4release · observed Aug 21, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s17bp3v1hm1dnkzey0c9tfh02183j0y5:grafana-foundation-sdk- Install using `clawhub skill install s17bp3v1hm1dnkzey0c9tfh02183j0y5:grafana-foundation-sdk` in an isolated environment before connecting it to live workloads.
- No published capability contract is available yet, so validate auth and request/response behavior manually.
- Review the upstream CLAWHUB listing at https://clawhub.ai/tenequm/grafana-foundation-sdk before using production credentials.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-grafana-foundation-sdk/snapshot"
Documentation
CLAWHUB
143,510 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
--- name: grafana-foundation-sdk description: Build Grafana dashboards as code with the grafana-foundation-sdk typed builders (TypeScript or Go). Use when creating, modifying, or generating Grafana dashboard JSON programmatically, converting hand-written dashboard JSON to typed code, building monitoring dashboards, or working with Prometheus/Loki queries in dashboards. metadata: version: "0.2.4" categories: "operations, development" topics: "grafana, dashboards, observability, dashboards-as-code, typescript" upstream: "@grafana/[email protected], github.com/grafana/grafana-foundation-sdk/[email protected]" openclaw: homepage: https://github.com/tenequm/skills/tree/main/skills/grafana-foundation-sdk emoji: "📊" --- # Grafana Foundation SDK The grafana-foundation-sdk provides strongly typed builder libraries for defining Grafana dashboards as code. Instead of writing raw JSON (which is error-prone and hard to review in diffs), you compose dashboards using chained builder calls that produce valid Grafana JSON. The SDK is auto-generated from Grafana's internal CUE schemas via the `cog` tool. It supports Go, TypeScript, Python, PHP, and Java. This skill focuses on **TypeScript** (primary) and **Go** (secondary) since those are the most common choices for infrastructure teams. ## When to use this skill - Creating new Grafana dashboards from scratch - Converting existing hand-written dashboard JSON to typed code - Adding panels, variables, or queries to dashboards - Building reusable dashboard components (helper functions for common panel patterns) - Generating dashboards dynamically based on service lists or configs ## Installation The SDK is published as concrete `v0.0.x` tags (latest: **v0.0.16**). Pin explicitly - it is pre-1.0 and the API churns between releases (see Known Gotchas). **TypeScript:** ```bash npm install '@grafana/grafana-foundation-sdk@~0.0.16' # or pnpm add '@grafana/grafana-foundation-sdk@~0.0.16' ``` **Go:** ```bash go get github.com/grafana/grafana-foundation-sdk/[email protected] ``` ## Core Architecture Everything follows the **builder pattern**: create a builder, chain configuration methods, call `.build()` (TS) or `.Build()` (Go) to produce the final object. The output is standard Grafana dashboard JSON - compatible with Grafana's API, file-based provisioning, and Kubernetes ConfigMaps. Each panel type, query type, and variable type lives in its own package. You import only what you need: ```typescript // Each concern has its own import import { DashboardBuilder, RowBuilder } from '@grafana/grafana-foundation-sdk/dashboard'; import { PanelBuilder as TimeseriesBuilder } from '@grafana/grafana-foundation-sdk/timeseries'; import { PanelBuilder as StatBuilder } from '@grafana/grafana-foundation-sdk/stat'; import { DataqueryBuilder as PromQueryBuilder } from '@grafana/grafana-foundation-sdk/prometheus'; import { DataqueryBuilder as LokiQueryBuilder } from '@grafana/grafana-foundation-sdk/loki'; ``` ##
_meta.json
{
"ownerId": "kn76gpsgjw5chv0xvzbzcb8cxn81x46r",
"slug": "grafana-foundation-sdk",
"version": "0.2.4",
"publishedAt": 1787313713832
}references/patterns.md
# Common Dashboard Patterns
## Table of Contents
1. [Project Structure](#project-structure)
2. [RED Method Dashboard](#red-method-dashboard)
3. [Kubernetes Service Dashboard](#kubernetes-service-dashboard)
4. [Loki Log Panels](#loki-log-panels)
5. [Multi-Datasource Dashboard](#multi-datasource-dashboard)
6. [Dynamic Dashboard Generation](#dynamic-dashboard-generation)
7. [Converting Raw JSON to SDK](#converting-raw-json-to-sdk)
8. [Integration with Helm/ConfigMaps](#integration-with-helmconfigmaps)
---
## Project Structure
For a monorepo with multiple dashboards, keep dashboard generators alongside the monitoring config:
```
ops/
dashboards/
generate.ts # entry point - imports and runs all generators
helpers.ts # shared datasource refs, query helpers, panel defaults
overview.ts # overview dashboard generator
per-service.ts # per-service dashboard generator
package.json # { "type": "module", "scripts": { "generate": "tsx generate.ts" } }
tsconfig.json
deploy/
dashboards/ # generated JSON files go here
```
Or for a single dashboard, a simple standalone script works fine:
```
ops/dashboards/
generate-overview.ts
package.json
```
**package.json:**
```json
{
"type": "module",
"scripts": {
"generate": "tsx generate.ts"
},
"dependencies": {
"@grafana/grafana-foundation-sdk": "^0.0.16"
},
"devDependencies": {
"tsx": "^4.0.0"
}
}
```
---
## RED Method Dashboard
The RED method (Rate, Errors, Duration) is the standard pattern for monitoring request-driven services. Here's a complete implementation:
```typescript
import { DashboardBuilder, RowBuilder, QueryVariableBuilder, ThresholdsConfigBuilder } from '@grafana/grafana-foundation-sdk/dashboard';
import { PanelBuilder as StatBuilder } from '@grafana/grafana-foundation-sdk/stat';
import { PanelBuilder as TimeseriesBuilder } from '@grafana/grafana-foundation-sdk/timeseries';
import { DataqueryBuilder } from '@grafana/grafana-foundation-sdk/prometheus';
import * as common from '@grafana/grafana-foundation-sdk/common';
// --- Helpers ---
const PROM = { type: 'prometheus', uid: 'prometheus' } as const;
function pq(expr: string, legend?: string) {
const q = new DataqueryBuilder().expr(expr);
if (legend) q.legendFormat(legend);
return q;
}
function defaultTimeseries(title: string) {
return new TimeseriesBuilder()
.title(title)
.datasource(PROM)
.height(8)
.span(12)
.fillOpacity(15)
.lineWidth(1)
.showPoints(common.VisibilityMode.Never)
.legend(
new common.VizLegendOptionsBuilder()
.showLegend(true)
.placement(common.LegendPlacement.Bottom)
.displayMode(common.LegendDisplayMode.List)
)
.tooltip(
new common.VizTooltipOptionsBuilder()
.mode(common.TooltipDisplayMode.Multi)
.sort(common.SortOrder.Descending)
);
}
// --- Dashboard ---
function buildREDDashboard(namespace: string, metricPrefreferences/typescript-api.md
# TypeScript API Reference
## Table of Contents
1. [Imports](#imports)
2. [Dashboard Builder](#dashboard-builder)
3. [Panel Types](#panel-types)
4. [Query Builders](#query-builders)
5. [Variable Builders](#variable-builders)
6. [Field Configuration](#field-configuration)
7. [Common Enums](#common-enums)
8. [Go Quick Reference](#go-quick-reference)
---
## Imports
Every concept lives in its own subpath export. Import only what you need:
```typescript
// Dashboard structure
import {
DashboardBuilder,
RowBuilder,
QueryVariableBuilder,
CustomVariableBuilder,
DatasourceVariableBuilder,
DashboardLinkBuilder,
ThresholdsConfigBuilder,
} from '@grafana/grafana-foundation-sdk/dashboard';
// Panel types (each exports PanelBuilder)
import { PanelBuilder as TimeseriesBuilder } from '@grafana/grafana-foundation-sdk/timeseries';
import { PanelBuilder as StatBuilder } from '@grafana/grafana-foundation-sdk/stat';
import { PanelBuilder as GaugeBuilder } from '@grafana/grafana-foundation-sdk/gauge';
import { PanelBuilder as BarGaugeBuilder } from '@grafana/grafana-foundation-sdk/bargauge';
import { PanelBuilder as TableBuilder } from '@grafana/grafana-foundation-sdk/table';
import { PanelBuilder as PieChartBuilder } from '@grafana/grafana-foundation-sdk/piechart';
import { PanelBuilder as BarChartBuilder } from '@grafana/grafana-foundation-sdk/barchart';
import { PanelBuilder as HeatmapBuilder } from '@grafana/grafana-foundation-sdk/heatmap';
import { PanelBuilder as HistogramBuilder } from '@grafana/grafana-foundation-sdk/histogram';
import { PanelBuilder as LogsBuilder } from '@grafana/grafana-foundation-sdk/logs';
import { PanelBuilder as TextBuilder } from '@grafana/grafana-foundation-sdk/text';
import { PanelBuilder as StateTimelineBuilder } from '@grafana/grafana-foundation-sdk/statetimeline';
import { PanelBuilder as StatusHistoryBuilder } from '@grafana/grafana-foundation-sdk/statushistory';
import { PanelBuilder as NodeGraphBuilder } from '@grafana/grafana-foundation-sdk/nodegraph';
import { PanelBuilder as GeoMapBuilder } from '@grafana/grafana-foundation-sdk/geomap';
import { PanelBuilder as XYChartBuilder } from '@grafana/grafana-foundation-sdk/xychart';
import { PanelBuilder as TrendBuilder } from '@grafana/grafana-foundation-sdk/trend';
import { PanelBuilder as CandlestickBuilder } from '@grafana/grafana-foundation-sdk/candlestick';
import { PanelBuilder as CanvasBuilder } from '@grafana/grafana-foundation-sdk/canvas';
import { PanelBuilder as DatagridBuilder } from '@grafana/grafana-foundation-sdk/datagrid';
import { PanelBuilder as AnnotationsListBuilder } from '@grafana/grafana-foundation-sdk/annotationslist';
import { PanelBuilder as DashboardListBuilder } from '@grafana/grafana-foundation-sdk/dashboardlist';
import { PanelBuilder as NewsBuilder } from '@grafana/grafana-foundation-sdk/news';
// Library panels (reference a shared, server-stored panel)
import { LibraryPanelBuilder } from '@grafana/grafana-foundation-sdk/librarypaCHANGELOG.md
# Changelog All notable changes to this skill will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/2.0.0/), and this skill adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [0.2.4] - 2026-08-21 ### Changed - Declared ClawHub browse categories (`operations, development`) and topics in `metadata`, so the release pipeline publishes them instead of leaving the skill in the `other` category. ### Removed - `skill-card.md`. The ClawHub CLI strips a root `skill-card.md` from every publish and the registry generates its own card, so the authored file never reached ClawHub. ## [0.2.3] - 2026-08-07 ### Removed - "Project-Specific Context" section that hardcoded one private repo's Helm chart layout and paths into the published skill. ### Changed - Genericized example queries and provisioning workflow: `namespace="x402"` -> `namespace="myapp"`, private chart paths -> generic `deploy/dashboards/` layout, `helmfile sync` step -> provisioning-mechanism-agnostic wording. ## [0.2.2] - 2026-07-22 ### Added - skill-card.md release record following NVIDIA's skill-card format - metadata.openclaw block (emoji, homepage) for ClawHub display ## [0.2.1] - 2026-07-10 ### Changed - CHANGELOG preamble pinned to Keep a Changelog 2.0.0 (format unchanged; KaC 2.0.0 keeps existing changelogs valid). ## [0.2.0] - 2026-06-05 ### Fixed - Go install string corrected to `go get github.com/grafana/grafana-foundation-sdk/[email protected]` (the canonical tag form per the official docs), replacing the stale `@next+cog-v0.0.x` branch ref. - PieChart legend example now uses `PieChartLegendOptionsBuilder` (from the `piechart` package) instead of `common.VizLegendOptionsBuilder`, which is a type error for piechart panels. ### Added - `metadata.upstream` tracking established (pinned to v0.0.16). - Known gotcha on dashboard schema v1 vs v2: the skill targets v1; `dashboardv2beta1` (k8s apiVersion `dashboard.grafana.app/v2beta1`) exists and is still stabilizing. - Known gotchas on the type-checking gap (builders only checked when wired into a tsconfig; use project-local `npx tsc` for the SDK's ES2024/bundler output) and the regenerate-JSON-after-every-edit discipline. - `units` typed-constants module, `expr` server-side/SQL expressions, `testdata` datasource, and the broader set of core datasource query builders (elasticsearch, cloudwatch, azuremonitor, googlecloudmonitoring, bigquery, athena, parca, grafanapyroscope) in the TypeScript reference. - Additional panel types in the import reference: canvas, datagrid, annotationslist, dashboardlist, news; plus `librarypanel`. ### Changed - Version pins updated to 0.0.16 across SKILL.md (install commands) and references/patterns.md (`package.json` example). Verified against: @grafana/[email protected], github.com/grafana/grafana-foundation-sdk/[email protected] ## [0.1.0] - 2026-06-05 ### Added - Initial release: building Grafana dashboa
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/tenequm/skills/grafana-foundation-sdk",
"sourceUrl": "https://clawhub.ai/tenequm/skills/grafana-foundation-sdk",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T20:42:44.996Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-grafana-foundation-sdk/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-grafana-foundation-sdk/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T20:42:44.996Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.3K downloads",
"href": "https://clawhub.ai/tenequm/grafana-foundation-sdk",
"sourceUrl": "https://clawhub.ai/tenequm/grafana-foundation-sdk",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T20:42:44.996Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "0.2.4",
"href": "https://clawhub.ai/tenequm/grafana-foundation-sdk",
"sourceUrl": "https://clawhub.ai/tenequm/grafana-foundation-sdk",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-08-21T12:01:53.832Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-grafana-foundation-sdk/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-grafana-foundation-sdk/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 0.2.4",
"description": "Updated grafana-foundation-sdk from 0.2.3 to 0.2.4. Changes: - modified `CHANGELOG.md` - modified `SKILL.md` - deleted `skill-card.md`",
"href": "https://clawhub.ai/tenequm/grafana-foundation-sdk",
"sourceUrl": "https://clawhub.ai/tenequm/grafana-foundation-sdk",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-08-21T12:01:53.832Z",
"isPublic": true
}
]
}Record generated Oct 10, 2026.
