generate-resource-stubs

Generate Go stubs for Grafana dashboards and alert rules.

535|42|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/grafana/gcx --skill generate-resource-stubs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-resource-stubs
Source: https://github.com/grafana/gcx/tree/main/claude-plugin/skills/generate-resource-stubs
Command: npx skills add https://github.com/grafana/gcx --skill generate-resource-stubs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating Grafana dashboards and alert rules from scratch often involves repetitive boilerplate. This Skill generates ready-to-edit Go stubs that follow the grafana-foundation-sdk patterns, speeding up setup and ensuring consistency.

Core Features & Use Cases

  • Inferred resource types: dashboards from dashboards/ (or dashboard/) directories and alerts from alerts/ (or alertrules/ or alertrule/).
  • Boilerplate generation: produces compilable Go stubs that follow the grafana-foundation-sdk builder patterns.
  • Quick-start scaffolding: supports rapid creation of new dashboards and alert rules with a single command.

Quick Start

Run gcx dev generate with a target path to create a typed Go stub.

Frequently Asked Questions about generate-resource-stubs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate Grafana dashboard boilerplate in Go?

You can generate Grafana dashboard boilerplate by running a generate command targeting a dashboards directory, which produces ready-to-edit Go stubs using grafana-foundation-sdk builder patterns.

Does the Grafana foundation SDK support scaffolding alert rules?

Yes, the Grafana foundation SDK supports scaffolding alert rules by generating compilable Go stubs from an alerts directory to speed up setup and ensure consistency.

How do I create ready-to-edit Go stubs for Grafana alerts?

To create ready-to-edit Go stubs for Grafana alerts, run a generate command with a target path inside an alerts or alertrules directory to automatically infer the resource type and output the file.

Can I generate Grafana builder code without specifying the resource type?

Yes, you can generate Grafana builder code without specifying the resource type because the generator infers whether to build dashboards or alerts from the immediate parent directory name.

Why does my generated Grafana stub output the wrong resource type?

Generated Grafana stubs infer the resource type from the immediate parent directory, so if your target path is not inside a dashboards or alerts directory, the output may not match your intended resource.

What is the best way to scaffold Grafana dashboards using Go?

The best way to scaffold Grafana dashboards using Go is to generate compilable stubs that follow grafana-foundation-sdk builder patterns, ensuring rapid creation and structural consistency across resources.