Convert Mermaid diagrams and Markdown tables to images (PNG) for platforms that don't support rich formatting. Use when user asks to "convert to image", "export as PNG", "make this an image", or has content for X/Twitter that needs visual exports.
npx skills add https://github.com/sugarforever/01coder-agent-skills --skill diagram-to-image
Convert Mermaid diagrams and Markdown tables to PNG images via the mermaid-red API (diagramless.xyz). Produces high-quality, styled output with custom themes — no heavy local dependencies needed.
Use this skill when:
The bundled script uses Node.js built-in fetch (Node 18+). No npm install needed.
# The render script is bundled with this skill:
SKILL_DIR=~/.claude/skills/diagram-to-image/scripts
ls $SKILL_DIR/diagram-to-image.mjs
IMPORTANT: Determine the best output location based on context. Follow this decision tree:
If user explicitly mentions a path or filename, use that.
Check for common image/asset directories in the current project:
# Check for existing image directories (in order of preference)
ls -d ./images ./assets ./img ./static ./public/images ./assets/images 2>/dev/null | head -1
Use the first existing directory found. Common patterns:
./images/ - General projects./assets/ - Web projects./assets/images/ - Structured web projects./public/images/ - Next.js, React projects./static/ - Hugo, other static site generators./img/ - Short form conventionIf user is writing an article or document:
images/ subdirectory if appropriateAnalyze the conversation to determine:
auth-flow.png, user-journey.png)If no context clues:
Create meaningful filenames based on content analysis:
| Content Pattern | Example Filename |
|----------------|------------------|
| flowchart with auth/login | auth-flow.png |
| sequenceDiagram with API | api-sequence.png |
| erDiagram | entity-relationship.png |
| pie chart about X | x-distribution.png |
| gantt chart | project-timeline.png |
| Table with comparison | comparison-table.png |
| Table with data | data-table.png |
Rules:
diagram.png or image.pngBefore converting, gather context:
# Example logic (implement mentally, not as literal script)
if user_specified_path:
output_path = user_specified_path
elif exists("./images"):
output_path = "./images/{generated_name}.png"
elif exists("./assets"):
output_path = "./assets/{generated_name}.png"
elif exists("./public/images"):
output_path = "./public/images/{generated_name}.png"
else:
output_path = "./{generated_name}.png"
# For Mermaid diagrams
cat > /tmp/diagram.mmd << 'DIAGRAM_EOF'
<mermaid content>
DIAGRAM_EOF
# For Markdown tables
cat > /tmp/table.md << 'TABLE_EOF'
<table content>
TABLE_EOF
The API auto-detects content type (mermaid vs table). Both use the same command.
Using the bundled script:
# Mermaid diagram
node ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs /tmp/diagram.mmd -o <output_path>.png
# Markdown table
node ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs /tmp/table.md -o <output_path>.png
# With custom theme
node ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs /tmp/diagram.mmd -o <output_path>.png --theme ocean
# Force content type (if auto-detect gets it wrong)
node ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs /tmp/table.md -o <output_path>.png --type table
Available options:
--theme <name> — default, dark, forest, neutral, ocean, emerald, midnight, slate, lavender, blueprint--type <type> — auto (default), mermaid, table--scale <n> — 1-4 (default: 2, for 2x DPI)--bg <color> — Background color (default: white, use "transparent" for no bg)--server <url> — Override server (default: https://diagramless.xyz)Piping from stdin also works:
echo "graph TD; A-->B" | node ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs -o out.png
cat /tmp/table.md | node ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs --type table -o table.png
After conversion, tell the user:
Context: User is in a project that has ./images/ directory, discussing authentication.
User: "Convert this to an image"
flowchart TD
A[Login] --> B{Valid?}
B -->|Yes| C[Dashboard]
B -->|No| D[Error]
Action:
./images/ existslogin-flow.png/tmp/diagram.mmdnode ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs /tmp/diagram.mmd -o ./images/login-flow.pngContext: User mentioned writing an article about AI agents for X.
User: "Make this a PNG with ocean theme"
flowchart LR
User --> Agent --> Tools --> Response
Action:
/tmp/diagram.mmdnode ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs /tmp/diagram.mmd -o ./ai-agent-flow.png --theme oceanUser: "Export this table as image"
| Model | Speed | Accuracy |
|-------|-------|----------|
| GPT-4 | Slow | High |
| Claude | Fast | High |
Action:
/tmp/table.mdnode ~/.claude/skills/diagram-to-image/scripts/diagram-to-image.mjs /tmp/table.md -o ./model-comparison.png(auto-detects as table)
User: "Save this diagram to ~/Desktop/my-chart.png"
Action: Use exactly ~/Desktop/my-chart.png as output path.
--type mermaid or --type table explicitly--server http://localhost:3000Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Improves the quality of images, especially screenshots, by enhancing resolution, sharpness, and clarity. Perfect for preparing images for presentations, documentation, or social media posts.
Downloads videos from YouTube and other platforms for offline viewing, editing, or archival. Handles various formats and quality options.
Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
Microscopy data management platform. Access images via Python, retrieve datasets, analyze pixels, manage ROIs/annotations, batch processing, for high-content screening and microscopy workflows.
Python library for working with DICOM (Digital Imaging and Communications in Medicine) files. Use this skill when reading, writing, or modifying medical imaging data in DICOM format, extracting pixel data from medical images (CT, MRI, X-ray, ultrasound), anonymizing DICOM files, working with DICOM metadata and tags, converting DICOM images to other formats, handling compressed DICOM data, or processing medical imaging datasets. Applies to tasks involving medical image analysis, PACS systems, radiology workflows, and healthcare imaging applications.
This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.
Take sugarforever/diagram-to-image from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm.
Without those the skill loads but fails at the first command.