grafana-dashboard-validation/SKILL.md
Pre-deployment validation for Grafana dashboards to catch errors before they reach production.
npx skillsauth add snqb/my-skills grafana-dashboard-validationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Pre-deployment validation for Grafana dashboards to catch errors before they reach production.
Trigger Patterns:
monitoring/grafana/dashboards/.json files with Grafana panel structureUse Proactively When:
# After any dashboard edit
python scripts/validate_dashboard.py --quick path/to/dashboard.json
# Validate all dashboards against live Prometheus
python scripts/validate_dashboard.py --all
# Single dashboard with full checks
python scripts/validate_dashboard.py path/to/dashboard.json
# Quick validation with JSON output
python scripts/validate_dashboard.py --quick --json --all
# Parse results
python scripts/validate_dashboard.py --quick --json --all | jq '.[] | select(.success==false)'
# Copy from this skill to project
cp ~/.claude/skills/grafana-dashboard-validation/validate_dashboard.py scripts/
# Or download latest version
curl -o scripts/validate_dashboard.py \
https://raw.githubusercontent.com/YOUR_ORG/grafana-tools/main/validate_dashboard.py
#!/bin/bash
# scripts/sync_grafana.sh
# Always validate first
python scripts/validate_dashboard.py --all || {
echo "❌ Validation failed. Fix errors or use --force to override"
exit 1
}
# Then sync
rsync -av monitoring/grafana/ user@server:/path/to/grafana/
# .git/hooks/pre-commit
if git diff --cached --name-only | grep -q "dashboards.*\.json"; then
python scripts/validate_dashboard.py --quick --all || exit 1
fi
Check if validation exists:
# Look for validator
ls -la scripts/validate_dashboard.py 2>/dev/null || echo "No validator found"
# If missing, add it
if [ ! -f scripts/validate_dashboard.py ]; then
echo "📝 Adding dashboard validator to project..."
cp ~/.claude/skills/grafana-dashboard-validation/validate_dashboard.py scripts/
fi
# Check if metric exists
curl -s http://prometheus:9090/api/v1/label/__name__/values | jq '.data[] | select(contains("your_metric"))'
# Common causes:
# 1. Metric not yet created (deploy app first)
# 2. Wrong metric name (check spelling)
# 3. Prometheus not scraping (check targets)
# Test query directly
curl -g 'http://prometheus:9090/api/v1/query?query=your_promql_here'
# Common causes:
# 1. No data in time range (normal for new deploy)
# 2. Wrong label filters
# 3. Missing service
# Validate syntax
promtool check query "your_promql_here"
# Common issues:
# 1. Unbalanced parentheses
# 2. Invalid function names
# 3. Wrong aggregation syntax
Must Fix (Errors):
Should Fix (Warnings):
Informational:
name: Validate Dashboards
on:
pull_request:
paths:
- 'monitoring/grafana/dashboards/**'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install requests
- run: python scripts/validate_dashboard.py --quick --json --all
validate-dashboards:
stage: test
script:
- python scripts/validate_dashboard.py --quick --all
only:
changes:
- monitoring/grafana/dashboards/**
# .git/hooks/pre-push
#!/bin/bash
if git diff --name-only origin/main HEAD | grep -q "dashboards.*\.json"; then
echo "Validating dashboards before push..."
python scripts/validate_dashboard.py --all || {
echo "Push blocked: Dashboard validation failed"
exit 1
}
fi
# After editing any dashboard.json
print("I'll validate that dashboard to catch any issues...")
subprocess.run(["python", "scripts/validate_dashboard.py", "--quick", "path/to/dashboard.json"])
# Always run before sync
print("Let me validate all dashboards before deploying...")
result = subprocess.run(["python", "scripts/validate_dashboard.py", "--all"])
if result.returncode != 0:
print("Found issues - let me help fix them...")
# After generating dashboard JSON
with open("new_dashboard.json", "w") as f:
json.dump(dashboard_config, f, indent=2)
# Immediately validate
print("Validating the generated dashboard...")
subprocess.run(["python", "scripts/validate_dashboard.py", "--quick", "new_dashboard.json"])
For large deployments (>50 dashboards), use quick mode in CI and full mode manually.
Required Python packages:
requests (for Prometheus API)json (standard library)pathlib (standard library)argparse (standard library)No external tools required for quick mode.
This skill provides fail-fast feedback for Grafana dashboards:
Always validate before deploying. The 30 seconds spent validating saves hours of debugging broken dashboards in production.
documentation
Enrich Markdown articles with inline Wikipedia links. First mention of each notable entity gets a hyperlink. Use when asked to add wiki links, enrich, or add references to .md files.
development
Structured visual QA: screenshot → batch issues → fix all → verify. Replaces the 300-cycle screenshot→edit death spiral. Optional bishkek review as exit gate. Use when building/polishing UI with browser testing, or when user asks for N iterations/reviews.
development
Find complex code, analyze intent, recommend battle-tested library replacements. Uses radon/eslint for detection, GitHub quality search for alternatives.
research
Research real-world UI patterns from curated galleries (Collect UI, Component Gallery, Mobbin). Use when exploring what exists: dropdowns, accordions, inputs, navigation, cards, modals, etc.