AgentSkillsCN

diagram

以 Gruvbox 暗色主题配色风格生成图表、图形与绘图。支持 PlantUML(ER 图、类图/序列图/组件图)以及 gnuplot(函数图像、数据可视化、柱状图、波形图、基准测试)。

SKILL.md
--- frontmatter
name: diagram
description: Generate diagrams, charts, and plots styled with Gruvbox dark theme colors. Supports PlantUML (ERDs, class/sequence/component diagrams) and gnuplot (function plots, data visualizations, charts, waveforms, benchmarks).
argument-hint: <what-to-diagram>
allowed-tools: Bash(plantuml *), Bash(feh *), Bash(gnuplot *), Write, Read

Diagram & Plot Generator (Gruvbox Dark Theme)

Generate PlantUML diagrams and gnuplot visualizations with a consistent Gruvbox dark theme.

Arguments

  • $ARGUMENTS: Description of what the user wants to visualize (optional)

If no arguments provided, ask the user what they want to visualize.

Instructions

Step 0: Choose the right tool

Based on what the user wants to visualize, select the appropriate tool:

Use gnuplot for:

  • Function plots (sin, cos, polynomials, custom functions)
  • Waveforms and signal comparisons
  • Data series / scatter plots / histograms / bar charts
  • Mathematical visualizations
  • Performance benchmarks and time series
  • Anything with numeric axes or data-driven charts

Use PlantUML for:

  • Entity-relationship diagrams (ERDs)
  • Class diagrams, type hierarchies
  • Sequence diagrams, request/response flows
  • Component / deployment / architecture diagrams
  • State machines, activity / workflow diagrams
  • Flowcharts

Then follow the corresponding section below.


gnuplot Path

  1. Understand the request: Determine the plot type, data source, axis labels, and title.

  2. Determine output path: If not specified, use docs/<name>.gnuplot for the script and docs/<name>.png for the image.

  3. Create the gnuplot script using the theme template from template.gnuplot:

    • Copy the full styling preamble (terminal, colors, border, grid, tics, key, labels)
    • Set set output '<png-path>' to the desired PNG output path
    • Use the named color variables (col_red, col_green, col_yellow, etc.) for plot lines and fills
    • Set a descriptive title with set title "{/:Bold Your Title}" tc rgb '#fabd2f' font ',16'
    • Add axis labels, ranges, and tics as needed
  4. Generate the PNG by running: gnuplot <script-path> 2>&1

  5. Verify generation succeeded:

    • Check the PNG file exists: test -f <png-path> && stat --format="%s bytes" <png-path>
    • If gnuplot reported errors, diagnose and fix the script
  6. Display the result (only after verification succeeds): feh <generated-png-path> &


PlantUML Path

  1. Understand the request: Based on what the user wants to diagram, infer the best diagram type:

    • Database schemas, tables, relationships → ERD (entity-relationship)
    • Code structure, types, inheritance → Class diagram
    • Request/response flows, API calls, interactions → Sequence diagram
    • System architecture, services, modules → Component diagram
    • Workflows, state machines, lifecycles → State or Activity diagram
  2. Determine output path: If not specified, use a sensible default like docs/<name>.puml

  3. Create the PlantUML file using the theme template from template.puml

  4. Generate the PNG by running: plantuml -tpng <output-path> 2>&1

  5. Verify generation succeeded:

    • Important: PlantUML names the output file based on @startuml <name>, not the input filename
    • If @startuml foo is in docs/bar.puml, the output will be docs/foo.png
    • To match input filename, use @startuml without a name, or match the name to the filename
    • Check the PNG file exists: test -f <png-path> && stat --format="%s bytes" <png-path>
    • If the file doesn't exist, run with -v flag to see where output is written
    • If plantuml reported errors, diagnose and fix the .puml file
  6. Display the result (only after verification succeeds): feh <generated-png-path> &


Color Palette Reference

See colors.md for the full Gruvbox color palette with both PlantUML and gnuplot variable names.

Quick Reference

  • Background: #282828 (bg), #32302f (bg0_s), #3c3836 (bg1)
  • Foreground: #ebdbb2 (fg), #d5c4a1 (fg2)
  • Red: #fb4934 (bright), #cc241d (normal)
  • Green: #b8bb26 (bright), #98971a (normal)
  • Yellow: #fabd2f (bright), #d79921 (normal)
  • Blue: #83a598 (bright), #458588 (normal)
  • Purple: #d3869b (bright), #b16286 (normal)
  • Aqua: #8ec07c (bright), #689d6a (normal)
  • Orange: #fe8019 (bright), #d65d0e (normal)

Styling Guidelines

  • Use #32302f for element backgrounds (slightly lighter than main bg)
  • Use #3c3836 for headers/sections
  • Use #83a598 (blue) for borders and relationships
  • Use #fabd2f (yellow) for titles and entity names
  • Use #8ec07c (aqua) for data types
  • Use #fb4934 (red) for required/important markers
  • Use #fe8019 (orange) for keys (PK, FK)
  • Use #d3869b (purple) for constraints
  • Use #b8bb26 (green) for relationship labels