From grafana-app-sdk
Authors CUE kind definitions for grafana-app-sdk apps: schemas, versioning, field constraints, named types, custom routes, and codegen configuration. Scaffolds kinds and runs code generation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/grafana-app-sdk:cue-kind-definitionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
```bash
# 1. Scaffold the kind files
grafana-app-sdk project kind add MyKind --overwrite
# Produces kinds/mykind.cue + kinds/mykind_v1alpha1.cue + updates kinds/manifest.cue.
# 2. Edit the generated .cue files — fill in schema.spec / schema.status fields
# 3. Generate types and clients
grafana-app-sdk generate
# 4. Verify the generated artifacts exist
ls pkg/generated/ # should contain new types for MyKind
If generate fails with CUE errors:
string field assigned an int), unresolved reference between version files.cue source, re-run grafana-app-sdk generate. Never edit files under pkg/generated/ — they're overwritten on every run.# 1. Copy the existing version file
cp kinds/mykind_v1alpha1.cue kinds/mykind_v1.cue
# 2. Edit kinds/mykind_v1.cue — rename the top-level object (e.g. myKindv1) and adjust the schema
# 3. Register the new version in kinds/manifest.cue
# Add a versions["v1"]: { schema: myKindv1 } entry
# 4. Re-generate
grafana-app-sdk generate
# 5. Verify both versions were generated — per-version Go types live under pkg/generated/<group>/<version>/
ls pkg/generated/ # should list both version directories (e.g. v1alpha1/ v1/)
# Optionally inspect the CRD spec under definitions/ to confirm both versions appear in `spec.versions[]`
Breaking changes (removing fields, changing types, adding required fields) must go into a new version — never modify a stable version (v1, v2) in place.
The CLI produces a flat layout under kinds/:
kinds/
├── manifest.cue # App manifest + version list declarations
├── mykind.cue # Common (cross-version) kind metadata
└── mykind_v1alpha1.cue # v1alpha1 schema + codegen config
For multi-version kinds, additional version files sit alongside (mykind_v1.cue, etc.). For very large kind sets (10+ kinds), consider the per-kind subdirectory layout — full kind anatomy reference in references/kind-layout.md.
Three layers per kind:
// kinds/mykind.cue
package kinds
myKind: {
kind: "MyKind" // Required: PascalCase kind name
// other cross-version fields (scope, pluralName, validation, mutation, conversion, …)
// Full field reference in references/kind-layout.md.
}
// kinds/mykind_v1alpha1.cue
package kinds
myKindv1alpha1: myKind & {
schema: {
spec: { // desired state — user-set
title: string
description: string | *""
count: int & >=0
enabled: bool | *true
}
status: { // observed state — operator-set
lastObservedGeneration: int | *0
state: string | *""
message: string | *""
}
}
codegen: {
ts: { enabled: true }
go: { enabled: true }
}
}
// kinds/manifest.cue
package kinds
App: {
appName: "my-app"
versions: {
"v1alpha1": { schema: myKindv1alpha1 }
}
}
Control what gets generated per kind per version:
codegen: {
ts: { enabled: true | false } // TypeScript types
go: { enabled: true | false } // Go types + client
}
Disabling go for frontend-only apps avoids unused Go code. Disabling ts for backend-only resources reduces bundle size. Both default to true when omitted.
references/kind-layout.md — full common-metadata field reference + app manifest fields + per-kind subdirectory layoutreferences/schema-types.md — CUE schema field types (basic types, constraints, regex, enums, maps, lists) + #-prefixed named type definitionsreferences/custom-routes.md — kind-level + version-level custom routes + handler registration in app.gonpx claudepluginhub grafana/skills --plugin grafana-app-sdkExplains grafana-app-sdk concepts: CLI usage, project structure, deployment modes (standalone operator, grafana/apps, frontend-only), and the workflow for initializing apps on the Grafana App Platform.
Scaffolds new Go projects for Grafana resources-as-code using gcx dev scaffold. Generates repo structure with CI/CD, main.go, and dashboard examples. Triggers on 'new project', 'scaffold', 'get started with gcx'.
Scaffolds Grafana plugin projects (panel, data source, app, backend) using @grafana/create-plugin. Automates Docker dev environment setup with hot-reload and plugin configuration for v12.x+.