/claude-kit:grafana-dashboards-and-alertsfrom Claude Kit SDLC
Builds production Grafana dashboards and alerting rules with PromQL, RED metrics, template variables, and dashboard-as-code provisioning.
Ships in Claude Kit SDLC. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build production-quality Grafana dashboards and alerting rules following proven conventions from large-scale multi-cluster observability deployments. This skill covers the entire lifecycle: JSON model structure, template variables for portability, RED metrics PromQL patterns, unified alerting with label-based routing, and dashboard-as-code provisioning.
Modern observability deployments typically use:
Golden rule: Always select datasources via a $datasource template variable of type
"datasource", not a hardcoded UID. This makes dashboards portable across Prometheus instances and
environments (prod/staging/dev). Panel datasource config:
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
}
Grafana dashboards are JSON documents. Common schemaVersion values: 30, 38, 41.
Top-level structure:
title, uid (unique identifier), tags[] (for organization/search)schemaVersion (Grafana model version)time: default time range ({ "from": "now-1h", "to": "now" })templating.list[]: template variables (datasource selector, cluster/service cascades)annotations.list[]: event overlays (deployments, incidents)links[]: dashboard cross-linkspanels[]: visualization elementsPanel structure:
{
"type": "timeseries", // or "table", "stat", "row", "nodeGraph"
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
"datasource": { "type": "prometheus", "uid": "${datasource}" },
"targets": [ /* queries */ ],
"fieldConfig": {
"defaults": {
"unit": "reqps",
"thresholds": { /* ... */ }
}
},
"options": { /* panel-type-specific options */ }
}
Query targets (Prometheus):
{
"refId": "A",
"expr": "sum(rate(http_requests_total{service=\"$service\"}[$__rate_interval]))",
"legendFormat": "{{method}} {{status}}"
}
Row panels group related visualizations. Collapse/expand rows to organize large dashboards.
nodeGraph panels render the Tempo service graph (distributed trace topology).
See references/dashboard-json-and-templating.md for exhaustive model details.
Template variables make dashboards dynamic and reusable. Key patterns:
Datasource selector (always include):
name: datasource
type: datasource
query: prometheus
current: { value: <default-uid> }
Cascading label_values queries (cluster → service hierarchy):
# Top-level dimension
name: cluster
type: query
datasource: ${datasource}
query: label_values(cluster)
# Dependent dimension (filters on parent)
name: service
type: query
datasource: ${datasource}
query: label_values(traces_spanmetrics_calls_total{cluster="$cluster"}, "service")
Custom variables for structured filters:
name: span_kind
type: custom
options:
- { text: "Web", value: "SPAN_KIND_SERVER" }
- { text: "Consumer", value: "SPAN_KIND_CONSUMER" }
- { text: "Internal", value: "SPAN_KIND_INTERNAL" }
Multi-select with All (where cardinality allows):
multi: true
includeAll: true
allValue: .*
Macros in queries:
$__rate_interval — adaptive rate window (typically 4×scrape interval)$__range — dashboard's current time range (for increase())$__interval — aggregation step for groupingTemplate variables cascade: changing $cluster re-queries downstream vars ($service).
Three proven sources for Rate/Error/Duration metrics:
Throughput (requests/sec):
sum(irate(nginx_ingress_controller_requests{exported_service=~"$service"}[$__rate_interval]))
by (exported_service)
Average latency:
avg(rate(nginx_ingress_controller_request_duration_seconds_sum{exported_service=~"$service"}[$__rate_interval]))
/ avg(rate(nginx_ingress_controller_request_duration_seconds_count{exported_service=~"$service"}[$__rate_interval]))
Percentiles (p90/p95/p99):
histogram_quantile(0.95,
sum(rate(nginx_ingress_controller_request_duration_seconds_bucket{exported_service=~"$service"}[$__rate_interval]))
by (le))
Total requests over dashboard range:
sum(increase(nginx_ingress_controller_requests{exported_service=~"$service"}[$__range]))
by (exported_service)
Rate (requests/minute):
sum(rate(traces_spanmetrics_calls_total{cluster="$cluster", service="$service", span_kind="$span_kind"}[$__rate_interval]))
by (span_kind) * 60
Latency percentiles:
histogram_quantile(0.95,
sum(rate(traces_spanmetrics_latency_bucket{cluster="$cluster", service="$service", span_kind="$span_kind"}[$__rate_interval]))
by (le))
Error ratio:
sum(increase(traces_spanmetrics_calls_total{cluster="$cluster", service="$service", span_kind="$span_kind", status_code="STATUS_CODE_ERROR"}[$__range]))
/ sum(increase(traces_spanmetrics_calls_total{cluster="$cluster", service="$service", span_kind="$span_kind"}[$__range]))
Per-operation breakdown:
sum(rate(traces_spanmetrics_calls_total{cluster="$cluster", service="$service", span_kind="$span_kind"}[$__range]))
by (span_name)
CPU usage vs limit:
sum(rate(container_cpu_usage_seconds_total{container=~"$container", container!="POD"}[$__rate_interval]))
by (container, pod)
/ sum(kube_pod_container_resource_limits_cpu_cores{container=~"$container"})
by (container, pod)
Memory usage vs limit:
sum(container_memory_usage_bytes{container=~"$container", container!="POD"})
by (container, pod)
/ sum(kube_pod_container_resource_limits_memory_bytes{container=~"$container"})
by (container, pod)
Container restarts:
round(sum(increase(kube_pod_container_status_restarts_total{container=~"$container"}[$__rate_interval]))
by (container, pod))
Key PromQL guidelines:
$__rate_interval for rate/irate (adapts to scrape frequency)$__range for increase() over dashboard's time windowcontainer!="POD" to exclude Kubernetes pause containershistogram_quantile requires by (le) grouping on the bucket selectorSee references/red-metrics-queries.md for deeper PromQL guidance.
Grafana's unified alerting replaces legacy dashboard alerts. Rules are multi-stage:
Rule structure (alert YAML):
- title: SRE-otel-collector-ExporterFailures-gt-0
condition: C
data:
- refId: A
queryType: ''
model:
expr: count(up{job="opentelemetry-collector"} == 1)
datasourceUid: ${PROMETHEUS_DS}
- refId: B
queryType: ''
relativeTimeRange: { from: 300, to: 0 }
datasourceUid: __expr__
model:
type: reduce
expression: A
reducer: last
- refId: C
queryType: ''
datasourceUid: __expr__
model:
type: threshold
expression: B
conditions:
- evaluator: { params: [0], type: gt }
for: 1m
noDataState: Alerting
execErrState: Alerting
folderUID: <alerting-folder-uid>
labels:
severity: critical
system: otel-collector
alert_type: infra
slack_0: platform-alerts
annotations:
__dashboardUid__: <dashboard-uid>
__panelId__: "42"
message: "OTel collector exporter failures detected"
value: "{{ $values.C }}"
Multi-stage flow:
Labels drive routing and context:
severity: critical, warning, infosystem: service/component name (otel-collector, kafka, postgres, etc.)alert_type: infra, application, businessslack_0, webhook_0, pagerduty_0 (notification policy matches these)usage, deployment_type, panel (additional context)Annotations enrich alert detail:
__dashboardUid__ + __panelId__: deep-link back to the source panel (ALWAYS include)message: human-readable summaryvalue: template the firing metric value ({{ $values.C }})alert_type: duplicate the label for message contextNaming convention:
SRE-<system>-<Condition>-<op>-<threshold>
Examples:
SRE-kafka-minion-TopicLagIncreasing-gt-0SRE-mongodb-ReplicaSetHealthDegraded-lt-3SRE-postgres-ConnectionPoolExhaustion-gt-80pctContact points and notification policies:
slack, webhook, pagerduty (configured in Grafana UI or provisioning)slack_0=platform-alerts → Slack contact pointCommon PromQL for alerting:
# Service availability (target count)
count(up{job="my-service"} == 1)
# Consumer lag (Kafka, per topic/group)
sum by (group_id, topic_name)(kminion_kafka_consumer_group_topic_partition_lag)
# Replica health (MongoDB)
mongodb_mongod_replset_member_health
# Error rate threshold
sum(rate(http_requests_total{status=~"5.."}[5m]))
/ sum(rate(http_requests_total[5m])) > 0.01
See references/unified-alerting.md for provisioning alerts as code.
Folder structure (organize ~137 dashboards):
Tagging conventions:
sre-automation, autogen, kubernetes-mixin — provisioned dashboardsprometheus, kafka, temporal, cost, utilizationDashboards as code (provisioning):
Many production dashboards are tagged autogen or have an org-provisioned marker. This means they
are provisioned from files, not hand-edited in the UI. Editing a provisioned dashboard in the
UI is an anti-pattern — changes are lost on the next provisioning sync.
Provisioning setup (provisioning/dashboards/dashboards.yaml):
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: 'Platform/SRE'
type: file
options:
path: /var/lib/grafana/dashboards
Store dashboard JSON files in git under dashboards/platform/ or similar. CI/CD syncs them to
Grafana's provisioning directory. Update a dashboard: edit the JSON in git, commit, redeploy.
Datasource provisioning (provisioning/datasources/prometheus.yaml):
apiVersion: 1
datasources:
- name: Prometheus-Prod
type: prometheus
access: proxy
url: http://prometheus.monitoring.svc.cluster.local:9090
isDefault: true
jsonData:
timeInterval: 30s
Alert provisioning: Unified alerting rules can be provisioned via:
POST /api/v1/provisioning/alert-rules)Store alert YAML in git alongside dashboards. Notification policies and contact points provision similarly.
See references/provisioning-and-organization.md for full workflow.
Two complete worked examples live verbatim in red-dashboard-skeleton.md:
rate(...) * 60 per-minute) and a p95 latency
panel (histogram_quantile over span-metrics buckets), both driven by ${datasource}.for
window, explicit noDataState, severity/routing labels, and __dashboardUid__/__panelId__
annotations deep-linking the alert to its panel.Hardcoded datasource UID in panel config instead of ${datasource} variable. Breaks
portability across Prometheus instances or environments. Always use a datasource template var.
Label typos in PromQL group-by (e.g., by (continer) instead of by (container)). Silently
changes cardinality and series matching. Lint queries before deploying.
Broad service matching via name regex (e.g., exported_service=~".*app.*|.*main.*") instead
of precise label selectors or template variables. Fragile, slow, and matches unintended services.
Editing provisioned (autogen) dashboards in the UI. Changes are overwritten on the next provisioning sync. Edit the JSON in git and redeploy.
Alerts without __dashboardUid__ and __panelId__ annotations. Responders cannot jump to
the offending panel. Always deep-link alerts to their source dashboard.
Missing for duration on noisy alerts. A 5-minute for window prevents flapping on
transient spikes. Tune per metric volatility.
No fallback noDataState. If the metric disappears, should the alert fire (Alerting), stay
quiet (OK), or go to a distinct state (NoData)? Choose intentionally.
Overly-granular label cardinality in dashboards. Summing by pod across 1000 replicas
creates 1000 series. Aggregate at service/deployment level unless debugging a specific pod.
README.md (opens in a new tab)references/dashboard-json-and-templating.md (opens in a new tab)references/provisioning-and-organization.md (opens in a new tab)references/red-dashboard-skeleton.md (opens in a new tab)references/red-metrics-queries.md (opens in a new tab)references/repo-evidence.md (opens in a new tab)references/unified-alerting.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
127 skills in this plugin
/accessibility-reviewUI accessibility (WCAG) review — keyboard operability, focus, ARIA semantics, color contrast, touch targets. Returns prioritized fixes. Distinct from performance/visual review./alembic-migrationsAlembic migration setup and patterns for async SQLAlchemy — async engine + run_sync in env.py, autogenerate, RLS/multi-tenant migrations. Use for alembic init, writing migrations, or debugging migration errors./anthropic-vertex-integrationClaude on Vertex AI via the AnthropicVertex SDK — lazy ADC client init, env-based project/region resolution, async helpers, backoff retry. Use when calling Claude via GCP Vertex AI (not direct Anthropic API).npx claudepluginhub ajyadav013/claude-kit --plugin claude-kitOther plugins' skills for the same job