| name | Spruce Example |
| description | Improve AG Charts gallery examples to professional quality standards with theme compatibility and PREVis evaluation. Use when creating or refining gallery examples, when user asks to "spruce up" an example, or when improving example quality. |
Spruce Example
This skill guides you through improving AG Charts gallery examples using a structured workflow that ensures professional quality, theme compatibility, and measurable visual quality improvements.
When to Use This Skill
- Creating a new gallery example
- Improving an existing gallery example
- User requests to "spruce up", "improve", or "refine" an example
- Example needs better data visualization practices
- Example needs theme compatibility (light/dark mode)
Prerequisites
- Development server must be running (
nx dev) - Puppeteer available for visual analysis
- Access to previs-evaluator agent for PREVis evaluation
Workflow
Step 0: Load Required Documentation
Read these files FIRST (located in tools/prompts/commands/spruce-example/):
core-rules.md- Mandatory rules for theme compatibilityvisual-analysis.md- PREVis evaluation workflowtroubleshooting.md- Quick fixes for common issues
Step 1: Baseline Visual Analysis
Complete ALL before proceeding:
- Navigate to
https://localhost:4600/charts/gallery/examples/[example-name]with Puppeteer - Take initial screenshot (this will be visible in your conversation context)
- Run PREVis evaluation via previs-evaluator agent:
- Launch previs-evaluator (NOT data-viz-designer)
- Explicitly state in the Task prompt: "Screenshot is already provided above, DO NOT navigate or capture new screenshots"
- The previs-evaluator lacks Puppeteer tools, preventing redundant screenshot capture
- Record baseline PREVis score
- Document identified issues
🛑 CRITICAL: Stop if Puppeteer fails - do not proceed with code-only analysis.
Step 2: Load Feature Modules
Based on PREVis issues identified, load ONLY relevant modules from tools/prompts/commands/spruce-example/features/:
| Issue Type | Load Module |
|---|---|
| Tooltip issues (poor comparison, missing tooltips) | tooltips.md |
| Visual hierarchy (flat appearance, hard to track) | axes.md |
| Value-based differentiation (no thresholds, unclear zones) | segmentation.md |
| Data readability (values unclear, overlapping labels) | data-labels.md |
| Legend problems (obscures data, too much space) | legends.md |
| Missing context (no baseline/target, no annotations) | reference-lines.md |
| Advanced needs (maps, Sankey, gauges) | enterprise.md |
| Styling enhancements (varied emphasis) | recent-features.md |
| Code quality (repetitive config) | theme-overrides.md |
Step 3: Implementation
Verify BEFORE making changes:
- ✅ NO hardcoded colors (hex, rgb, named colors)
- ✅ NO font properties (fontSize, fontWeight, fontFamily, fontStyle)
- ✅ NO styles.css or CSS files
- ✅ Using specific chart type (e.g.,
AgCartesianChartOptions, notAgChartOptions) - ✅ All axes have
typespecified
Apply improvements:
- Focus on structural enhancements (tooltips, bands, formatters)
- Let theme handle ALL visual styling
- Use
highlight.*properties (not deprecatedhighlightStyle) - Add
headingto all tooltip configurations - Minimize footnotes - only add if absolutely essential (footnotes reduce visualization space)
Step 4: Validation (MANDATORY)
Run these commands IN ORDER:
Generate example:
nx run ag-charts-website-gallery_[example-name]_main.ts:generate🚨 CRITICAL - Validate example:
nx run ag-charts-website-gallery_[example-name]_main.ts:typecheckIf this fails → REVERT ALL CHANGES
Visual verification:
- Take final screenshot with Puppeteer (it will be visible in your conversation)
- Run final PREVis evaluation via previs-evaluator agent (following handoff pattern from Step 1)
- Record final PREVis score
- Score MUST NOT decrease (if decreased → REVERT)
Generate thumbnail:
nx generate-thumbnails ag-charts-website
Completion Checklist
Cannot mark complete until ALL checked:
- PREVis score maintained or improved
- NO hardcoded colors or fonts in code
- Footnotes minimized (only essential ones kept)
-
nx run ag-charts-website-gallery_[example-name]_main.ts:typecheckPASSED - Thumbnails generated successfully
- Works in both light and dark themes
Critical Rules
- Theme compatibility is paramount - When in doubt, remove styling and let the theme handle it
- Always run visual validation - PREVis score must not decrease
- TypeScript must compile - If typecheck fails, revert all changes immediately
- Zero tolerance for hardcoded styling - No colors, fonts, or CSS files allowed
Failure Handling
If validation fails, check tools/prompts/commands/spruce-example/troubleshooting.md, then:
- PREVis score decreased → Revert all changes immediately
- Typecheck failed → Check axes[].type, remove colors/fonts, or revert
- TypeScript errors → Use specific chart types (see troubleshooting.md)
- Thumbnail generation failed → Check for runtime errors
- Dark mode broken → Search for hardcoded colors and remove them
Example Path Mappings
Gallery examples:
- Repo path:
packages/ag-charts-website/src/content/gallery/_examples/${exampleName}/ - Dev server:
https://localhost:4600/charts/gallery/examples/${exampleName}
Related Documentation
- Main workflow command:
tools/prompts/commands/spruce-example.md - Examples guide:
tools/prompts/guides/examples.md - Testing guide:
tools/prompts/guides/testing.md
Example Usage
When the user says:
- "Spruce up the sales-data example"
- "Improve the bar-chart gallery example"
- "Make this example look more professional"
This skill will automatically activate and guide you through the structured workflow above.
Remember: This is a structured workflow - follow steps in order and don't skip validation!