add-datasource
Use for the implementation workflow that adds gcx CLI support for a datasource type not registered in internal/datasources/providers — query client, command…
Investigate Grafana alerts to determine why they are firing, their scope, and impact. Use when the user asks about a specific alert, wants to understand alert behavior, or needs to diagnose why an alert is in a firing or pending state. Trigger on phrases like "why is this alert
$ npx -y skills add grafana/gcx --skill investigate-alert --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/investigate-alertContext preview
The summary Claude sees to decide when to auto-load this skill.
Investigate Grafana alerts to determine why they are firing, their scope, and impact. Use when the user asks about a specific alert, wants to understand alert behavior, or needs to diagnose why an alert is in a firing or pending state. Trigger on phrases like "why is this alert
name: investigate-alert description: Investigate Grafana alerts to determine why they are firing, their scope, and impact. Use when the user asks about a specific alert, wants to understand alert behavior, or needs to diagnose why an alert is in a firing or pending state. Trigger on phrases like "why is this alert firing", "investigate this alert", "what is this alert rule doing", or a named alert rule. For triaging what is actively paging in OnCall (alert groups, ack/silence/resolve) use oncall-triage instead.
Investigate Grafana alerts by analyzing state, querying datasources, and identifying next steps. Be concise and direct - these are experienced operators who need actionable information, not hand-holding.
1. Stop early for non-actionable scenarios (recording rules, healthy inactive alerts) 2. Be concise - no fluff, no excessive formatting, no obvious advice 3. Trust the user's expertise - no timelines, no patronizing suggestions 4. Focus on actionable information
User needs gcx installed with configured context and appropriate permissions. If gcx is not configured, use the setup-gcx skill first.
Check context if needed (`gcx config view`). If multiple contexts exist and none specified, ask which to use.
Fetch the alert by listing all alerts and filtering by name. Replace `<AlertName>` with the actual alert name:
gcx alert rules list -o json | jq -r '.[] | .rules[]? | select(.name == "<AlertName>")'
Server-side filters (use instead of downloading all rules and filtering with jq):
Filter by name, state, cluster/environment as relevant. If multiple matches, list them and ask which to investigate. Inform the user which context you're using.
Check the `type` field:
Check the `state` field:
You should use the datasourceUID from the alert when you can.
If you need to query a different datasource (e.g., Loki for log correlation), resolve its UID first:
gcx datasources list --type loki
Annotation URLs often reference datasources by name — always resolve to UID before querying.
Query the datasource. Use -o json to get the data for yourself. Use with a graph visualization for showing a summary to the user:
# Prometheus gcx metrics query -d <datasource-uid> '<query>' --from now-1h --to now --step 1m -o json gcx metrics query -d <datasource-uid> '<query>' --from now-1h --to now --step 1m -o graph # Loki gcx logs query -d <datasource-uid> '<query>' --from now-1h --to now -o json gcx logs query -d <datasource-uid> '<query>' --from now-1h --to now -o graph
Analyze the results: What's the current value? Spike or gradual? When did it start?
Extract from annotations:
Provide concise analysis:
Based on the error class, suggest follow-up queries to the user:
Recommend incident creation if there's customer impact.
List specific next actions - queries to run, deployments to check, metrics to examine. If there are queries for logs or metrics you can run, then ask the user if they want you to run them. If infrastructure changes are a suspected cause, suggest to the user that you could investigate any infra-as-code repos, if they point you to them.
If the next suggested actions include looking at logs in any way, use gcx to do it.
For recording rules or healthy inactive alerts (early exit):
This is a [recording rule / inactive alert]. [One sentence what it monitors]. State: [state]. Health: [health]. Want to see more details?
For firing/pending alerts (full investigation):
Alert: <name> State: firing [in <cluster/env>] Monitors: <brief what it checks> [Show graph visualization] Current value: <value> Trend: <spike/gradual/sustained> Likely causes: - <cause 1> - <cause 2> Impact: <who/what affected> Runbook: <link> Dashboard: <link> Next actions: - <action 1> - <action 2> [If customer impact:] Recommend creating an incident - <why>.
Use minimal formatting. Avoid excessive bold text. No timelines like "within 24 hours". Trust the user to prioritize.
Grafana — in your terminal and your agentic coding environment. gcx works with Grafana Cloud, Enterprise, and OSS (Grafana 12+). See the compatibility matrix for details. Query production. Investigate alerts. Let the Assistant root-cause issues.
Repo: grafana/gcx
Use for the implementation workflow that adds gcx CLI support for a datasource type not registered in internal/datasources/providers — query client, command…
Use for the implementation workflow once a capability is already classified as a Grafana Cloud product provider (SLO, OnCall, Synthetic Monitoring, k6, ML,…
Regenerate the gcx marketing bento-box slide (slide.html) with verified commands from the current codebase. Builds a fresh binary and reflects against the…
Guides a contributor and their coding agent through adding or extending a capability in the grafana/gcx codebase: deciding whether a new command is needed and…
Reference for porting a Grafana Cloud product from the legacy grafana-cloud-cli into a gcx provider — adapter, schema/example registration, CRUD redirect…