$npx -y skills add richard-kim-79/archora-skills --skill figureGenerates complete, runnable visualization code for research figures. Produces matplotlib/seaborn Python scripts for quantitative data and Mermaid diagrams for conceptual relationships, workflows, and taxonomies. Use when the user asks for charts, graphs, visualizations, figures,
| 1 | # Figure Generator |
| 2 | |
| 3 | Generate publication-quality visualization code for research figures. |
| 4 | |
| 5 | ## Figure Types |
| 6 | |
| 7 | | Type | Use for | Format | |
| 8 | |------|---------|--------| |
| 9 | | **matplotlib** | Quantitative data: bar charts, scatter plots, line graphs, heatmaps, box plots | Python | |
| 10 | | **seaborn** | Statistical visualizations: distributions, regressions, pair plots | Python | |
| 11 | | **Mermaid** | Conceptual diagrams: workflows, taxonomies, hierarchies, timelines | Mermaid | |
| 12 | |
| 13 | ## Decision guide |
| 14 | |
| 15 | - Numbers, measurements, time series → **matplotlib/seaborn** |
| 16 | - Concepts, relationships, processes → **Mermaid** |
| 17 | - When in doubt: generate both |
| 18 | |
| 19 | ## Output Format |
| 20 | |
| 21 | ````markdown |
| 22 | ## Figure 1: [Title] |
| 23 | |
| 24 | **Caption:** [Full figure caption as it would appear in a paper — what is shown and the key takeaway] |
| 25 | |
| 26 | **Description:** [What this figure shows and why it matters for the research] |
| 27 | |
| 28 | **Type:** Python (matplotlib/seaborn) |
| 29 | |
| 30 | ```python |
| 31 | import matplotlib.pyplot as plt |
| 32 | import numpy as np |
| 33 | |
| 34 | # [Complete, runnable code with realistic placeholder data] |
| 35 | plt.tight_layout() |
| 36 | plt.savefig('figure1.png', dpi=300) |
| 37 | plt.show() |
| 38 | ``` |
| 39 | ```` |
| 40 | |
| 41 | ## Code requirements |
| 42 | |
| 43 | - **Complete and runnable** — no placeholders like `your_data_here` |
| 44 | - **All imports included** — never reference a library without importing it |
| 45 | - **Realistic placeholder data** — use domain-appropriate values and ranges |
| 46 | - **Publication quality** — `dpi=300`, proper axis labels, legend, title |
| 47 | - **Accessible colors** — avoid red/green only distinctions |
| 48 | |
| 49 | ## Validation (always run after generating Python code) |
| 50 | |
| 51 | Before presenting code to the user, validate syntax with Python's AST parser: |
| 52 | |
| 53 | ```bash |
| 54 | python -c "import ast; ast.parse(open('figure1.py').read()); print('✅ Syntax OK')" |
| 55 | ``` |
| 56 | |
| 57 | If the check fails, fix the syntax error and re-validate before showing the result. |
| 58 | |
| 59 | **For inline code blocks**, validate with: |
| 60 | ```python |
| 61 | import ast |
| 62 | code = """ |
| 63 | # paste generated code here |
| 64 | """ |
| 65 | try: |
| 66 | ast.parse(code) |
| 67 | print("✅ Syntax OK") |
| 68 | except SyntaxError as e: |
| 69 | print(f"❌ Syntax error: {e}") |
| 70 | ``` |
| 71 | |
| 72 | > Note: AST validation checks syntax only — it does not catch runtime errors (e.g. wrong data shapes). Always include comments explaining how to adapt placeholder data to real data. |
| 73 | |
| 74 | ## How to run |
| 75 | |
| 76 | **Python figures:** |
| 77 | ```bash |
| 78 | pip install matplotlib seaborn numpy |
| 79 | python figure1.py |
| 80 | ``` |
| 81 | |
| 82 | **Mermaid diagrams:** |
| 83 | - Paste into [mermaid.live](https://mermaid.live) |
| 84 | - Or use any Markdown renderer that supports Mermaid (Obsidian, GitHub, etc.) |