Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
grafana avatar

Generate Resource Stubs

  • 2 installs
  • 524 repo stars
  • Updated August 4, 2026
  • grafana/gcx

generate-resource-stubs skill documents Use when the user wants to create new Grafana dashboard or alert rule Go files from scratch, generate typed stubs, add a new dashboard to a project, or write grafana-foundation-sdk

About

generate-resource-stubs skill documents Use when the user wants to create new Grafana dashboard or alert rule Go files from scratch, generate typed stubs, add a new dashboard to a project, or write grafana-foundation-sdk builder code. Triggers on "new dashboard", "generate dashboard", "add dashboard", "create alert rule", "generate stub",. name: generate-resource-stubs description: >

  • Use when the user wants to create new Grafana dashboard or alert rule Go files from scratch, generate typed stubs, add a
  • Platform-specific setup patterns for generate-resource-stubs.
  • Evidence-backed steps from upstream SKILL.md.
  • When-to-use criteria for generate-resource-stubs versus alternatives.

Generate Resource Stubs by the numbers

  • 2 all-time installs (skills.sh)
  • Ranked #1,138 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

generate-resource-stubs capabilities & compatibility

Capabilities
generate resource stubs quick start · generate resource stubs when to use guidance · generate resource stubs integration patterns
Works with
grafana
From the docs

What generate-resource-stubs says it does

Use when the user wants to create new Grafana dashboard or alert rule Go
SKILL.md
files from scratch, generate typed stubs, add a new dashboard to a project,
SKILL.md
npx skills add https://github.com/grafana/gcx --skill generate-resource-stubs

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2
repo stars524
Last updatedAugust 4, 2026
Repositorygrafana/gcx

How do I use generate-resource-stubs correctly?

Use when the user wants to create new Grafana dashboard or alert rule Go files from scratch, generate typed stubs, add a new dashboard to a project, or write grafana-foundation-sdk builder code. Trigg

Who is it for?

Teams implementing generate-resource-stubs workflows from the catalog.

Skip if: Skip when requirements clearly match a different specialized stack.

When should I use this skill?

User asks about generate-resource-stubs, use when the user wants to create new grafana dashboard or alert rule go files from scratc.

What you get

Working generate-resource-stubs setup with validated configuration and next steps.

Files

SKILL.mdMarkdownGitHub ↗

Generate Typed Resource Stubs

Generate ready-to-edit Go files for dashboards and alert rules using gcx dev generate. The generated code uses the grafana-foundation-sdk builder pattern and compiles without modification.

Quick Start

# Dashboard stub
gcx dev generate dashboards/my-service-overview.go

# Alert rule stub
gcx dev generate alerts/high-cpu-usage.go

# Batch generation
gcx dev generate dashboards/a.go dashboards/b.go alerts/c.go

How Type Inference Works

The resource type is inferred from the immediate parent directory:

DirectoryType
dashboards/ or dashboard/dashboard
alerts/, alertrules/, or alertrule/alertrule

Override with --type when the directory doesn't match:

gcx dev generate internal/monitoring/cpu-alert.go --type alertrule

Output

  • Filename is normalized to snake_case: my-dashboard.gomy_dashboard.go
  • Function name is CamelCase: my-dashboardMyDashboard()
  • Package name is derived from the parent directory

After Generation: Building Real Dashboards

The generated stub is a starting point. See references/foundation-sdk-guide.md for the full builder API reference to customize your dashboards and alerts.

Dashboard Customization Cheat Sheet

import (
    dashboard "github.com/grafana/grafana-foundation-sdk/go/dashboardv2beta1"
    "github.com/grafana/grafana-foundation-sdk/go/prometheus"
    "github.com/grafana/grafana-foundation-sdk/go/timeseries"
)

builder := dashboard.NewDashboardBuilder("My Dashboard").
    Tags([]string{"team:platform", "env:production"}).
    Editable(true).
    // Add a panel
    Panel("requests-panel",
        dashboard.NewPanelBuilder().
            Title("Request Rate").
            Visualization(timeseries.NewVisualizationBuilder()).
            Data(
                dashboard.NewQueryGroupBuilder().
                    Target(
                        dashboard.NewTargetBuilder().Query(
                            prometheus.NewDataqueryBuilder().
                                Expr(`rate(http_requests_total[$__rate_interval])`).
                                LegendFormat("{{method}} {{status}}"),
                        ),
                    ),
            ),
    ).
    // Layout
    AutoGridLayout(
        dashboard.AutoGrid().
            WithItem("requests-panel"),
    )

return dashboard.Manifest("my-dashboard", builder)

Alert Rule Customization Cheat Sheet

import (
    "github.com/grafana/grafana-foundation-sdk/go/alerting"
    "github.com/grafana/grafana-foundation-sdk/go/resource"
)

rule := alerting.NewRuleBuilder("High CPU Usage").
    Condition("A").
    For("5m").
    FolderUID("my-folder").
    RuleGroup("cpu-alerts").
    Labels(map[string]string{
        "severity": "critical",
        "team":     "platform",
    }).
    Annotations(map[string]string{
        "summary":     "CPU usage above 90% for 5 minutes",
        "description": "Instance {{ $labels.instance }} has high CPU usage.",
    })

Common Issues

IssueFix
"cannot infer resource type"Directory name doesn't match known types; use --type dashboard or --type alertrule
"file already exists"Delete the existing file first or use a different name
Need to add to registryManually add the function call to your All() function in all.go

Related skills

FAQ

What does generate-resource-stubs do?

generate-resource-stubs skill documents Use when the user wants to create new Grafana dashboard or alert rule Go files from scratch, generate typed stubs, add a new dashboard to a project, or write grafana-foundation-sdk builder code.

When should I use generate-resource-stubs?

User asks about generate-resource-stubs, use when the user wants to create new grafana dashboard or alert rule go files from scratc.

Is this skill safe to install?

Review the Security Audits panel on this page before installing in production.

DevOps & CI/CDmonitoring

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.