generate-resource-stubs

Generate typed Go stub files for Grafana dashboards and alert rules using gcx.

1|Updated May 25, 2020
One-click install
npx skills add https://github.com/titaneric/dotfiles --skill generate-resource-stubs-titaneric
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-resource-stubs
Source: https://github.com/titaneric/dotfiles/tree/main/dot_agents/skills/generate-resource-stubs
Command: npx skills add https://github.com/titaneric/dotfiles --skill generate-resource-stubs-titaneric

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing Grafana dashboards and alert rules as Go code with the grafana-foundation-sdk requires repetitive boilerplate before any real design work begins. This Skill scaffolds ready-to-edit, compilable Go stub files so you can skip the setup and start customizing panels, queries, and alert conditions immediately. ## Core Features & Use Cases - Typed Stub Generation: Run gcx dev generate to create dashboard or alert rule Go files that compile without modification. - Automatic Type Inference: Resource type is inferred from the parent directory (dashboards/ or alerts/), with a --type flag override for custom layouts. - Naming Normalization: Filenames are converted to snake_case and function names to CamelCase automatically. - Use Case: You need three new alert rules for CPU, memory, and disk monitoring. Generate all three stubs in one batch command, then customize each with the foundation-sdk builder patterns from the included reference guide. ## Quick Start Ask the assistant to generate a dashboard stub at dashboards/my-service-overview.go using gcx dev generate.

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 a Grafana dashboard stub in Go?

Run gcx dev generate with a path inside a dashboards directory, such as gcx dev generate dashboards/my-service-overview.go. The tool creates a compilable Go file using the grafana-foundation-sdk builder pattern with a normalized filename and CamelCase function name.

How to create alert rule boilerplate with grafana-foundation-sdk?

Place the target file under an alerts/, alertrules/, or alertrule/ directory and run gcx dev generate on it. The generated stub uses alerting.NewRuleBuilder with condition, duration, labels, and annotations ready for customization.

What does 'cannot infer resource type' mean in gcx generate?

This error occurs when the file's parent directory does not match a known type like dashboards/ or alerts/. Fix it by passing the --type flag explicitly, for example --type dashboard or --type alertrule.

Can I generate multiple dashboard or alert stubs at once?

Yes, gcx dev generate accepts multiple file paths in a single command for batch generation. For example, pass dashboards/a.go dashboards/b.go alerts/c.go together to scaffold all three files.

When should I use stub generation versus designing a full dashboard?

Stub generation only scaffolds compilable Go files and stops there. For designing actual panels, variables, queries, and layout with datasource discovery, use the create-dashboard skill after generating the stub.