Best use case
scientific-diagram-generation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Teams using scientific-diagram-generation should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/scientific-diagram-generation/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How scientific-diagram-generation Compares
| Feature / Agent | scientific-diagram-generation | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
This skill provides specific capabilities for your AI agent. See the About section for full details.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Scientific Diagram Generation
AI-powered scientific illustration generation using Gemini Image models. Creates publication-quality mechanism diagrams, pathway illustrations, and scientific figures.
## API Configuration
| Parameter | Value |
|-----------|-------|
| **Provider** | Google Gemini via yunwu.ai relay |
| **Model** | `gemini-3.1-flash-image-preview` |
| **Base URL** | `https://yunwu.ai/v1beta/models` |
| **Full Endpoint** | `https://yunwu.ai/v1beta/models/gemini-3.1-flash-image-preview:generateContent` |
| **Auth** | `Authorization: Bearer <LLM_API_KEY>` |
| **API Key env var** | `LLM_API_KEY` (Gemini series key) |
| **Response** | Image in `candidates[].content.parts[].inlineData.data` (base64 PNG) |
## API Call Structure
```bash
curl -X POST "https://yunwu.ai/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LLM_API_KEY" \
-d '{
"contents": [{"role": "user", "parts": [{"text": "YOUR_PROMPT_HERE"}]}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"]
}
}'
```
## Python Implementation
```python
import httpx, base64
API_KEY = "your-gemini-key"
MODEL = "gemini-3.1-flash-image-preview"
URL = f"https://yunwu.ai/v1beta/models/{MODEL}:generateContent"
async def generate(prompt: str) -> bytes:
payload = {
"contents": [{"role": "user", "parts": [{"text": prompt}]}],
"generationConfig": {"responseModalities": ["TEXT", "IMAGE"]}
}
async with httpx.AsyncClient(timeout=120) as c:
r = await c.post(URL, json=payload,
headers={"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}"})
r.raise_for_status()
for cand in r.json().get("candidates", []):
for part in cand["content"]["parts"]:
if "inlineData" in part:
return base64.b64decode(part["inlineData"]["data"])
return b""
```
## Style Presets
### Publication Style (default)
```
Cell/Nature/Science publication style. Realistic cell morphology with smooth
membranes. Activation arrows: solid black. Inhibition: red T-bar. Secretion:
dashed arrow. Proteins as colored ovals. Receptors as Y-shapes on membranes.
Clean, professional, suitable for journal figures.
```
### Vector-Friendly Style
```
Flat vector style with clean outlines and solid color fills. No gradients,
textures, or noise. High contrast. Easy to edit in Adobe Illustrator or Inkscape.
```
### Infographic Style
```
Modern infographic style with grid layout. Rounded rectangles for cells.
Circles for molecules. 3-5 accent colors maximum. Clean geometric shapes.
```
## Core Prompt Rules (append to every prompt)
```
CRITICAL RULES FOR SCIENTIFIC DIAGRAM GENERATION:
1. BIOLOGICAL COMPLETENESS: Name all cell types, receptors, ligands, molecules,
transcription factors. Include activation, inhibition, binding, phosphorylation,
secretion, translocation.
2. VISUAL COMPOSITION: Describe spatial layout (top/bottom/left/right). Define
compartments (membrane, cytoplasm, nucleus, extracellular). Choose layout flow.
3. FONT: Use Arial or clean sans-serif for ALL labels. Never decorative fonts.
4. TEXT LABELS: Title Case for all labels. Never ALL CAPS. Gene/protein
abbreviations kept as-is (PD-L1, IFN-γ, JAK).
5. BACKGROUND: Pure white #FFFFFF. No gradients, textures, or vignettes.
6. EDITABILITY: Elements clearly separated with sharp edges. No overlapping.
Easy post-editing.
```
## SketchGraph Schema (for structured bio diagrams)
### BioNode Types
`cell`, `protein`, `receptor`, `mRNA`, `DNA`, `complex`, `small_molecule`, `vesicle`, `exosome`, `antibody`, `other`
### BioEdge Actions
`activate`, `inhibit`, `bind`, `phosphorylate`, `secrete`, `recruit`, `translocate`, `transcribe`, `degrade`, `upregulate`, `downregulate`
### Compartments
`membrane`, `cytoplasm`, `nucleus`, `extracellular_space`, `mitochondria`, `endoplasmic_reticulum`, `golgi`
## Prompt Templates
### Template 1: Mechanism Diagram
```
Generate a scientific mechanism diagram:
[DESCRIPTION OF THE MECHANISM]
STYLE: [publication / vector_friendly / infographic]
[CORE_PROMPT_RULES]
EXACT TEXT LABELS to render (use these exact strings, do NOT change
capitalization): ["Label1", "Label2", ...]
```
### Template 2: Signaling Pathway
```
Generate a signaling pathway diagram showing:
- Ligand: [name] binding to receptor: [name] on [cell type]
- Intracellular cascade: [kinase1] → [kinase2] → [transcription factor]
- Downstream effects: [gene expression changes]
- Compartments: extracellular, membrane, cytoplasm, nucleus
STYLE: publication
[CORE_PROMPT_RULES]
```
### Template 3: Tumor Microenvironment
```
Generate a tumor microenvironment diagram showing:
- Central: tumor cells (irregular shape, dark)
- Surrounding: [immune cells, fibroblasts, endothelial cells]
- Key interactions: [list of interactions with arrow types]
- Secreted factors: [cytokines, chemokines with dashed arrows]
Layout: radial, tumor at center
STYLE: publication
[CORE_PROMPT_RULES]
```
### Template 4: Cell Biology Overview
```
Generate a cell biology diagram showing:
- Cell with organelles: nucleus, mitochondria, ER, Golgi, lysosomes
- Process: [e.g., autophagy, apoptosis, protein trafficking]
- Key molecules at each step: [list]
- Arrows showing process flow
STYLE: publication
[CORE_PROMPT_RULES]
```
### Template 5: Non-Bio Scientific Diagram (GENERAL)
```
Generate a scientific diagram (bypassing SketchGraph, direct prompting):
[DESCRIPTION — can be circuit diagram, chemical reaction scheme,
geological cross-section, physics experiment setup, etc.]
STYLE RULES:
- White background #FFFFFF
- Arial font for all labels
- Title Case for labels
- Clean, professional, publication quality
- No decorative elements
```
## Retry Logic
The API may return 429 (rate limit) or 5xx errors. Recommended retry:
- Attempt 1: immediate
- Attempt 2: wait 15 seconds
- Attempt 3: wait 30 seconds
- Max 3 attempts
## Output
- Format: PNG (default), can request JPEG
- Resolution: ~1024x1024 (model default)
- File size: typically 800KB-1.5MB
- Save to: `~/.scienceclaw/workspace/diagrams/diagram_{uuid}.png`
## Tips for Best Results
1. **Be specific**: "TREM2 receptor on macrophage" > "a receptor on a cell"
2. **Name everything**: Every molecule, cell, and arrow should have a label
3. **Specify compartments**: "extracellular space", "cytoplasm", "nucleus"
4. **Use exact label injection**: Always provide a list of exact text labels
5. **Keep it focused**: One mechanism per diagram, not an entire pathway map
6. **Iterate**: If the first result isn't perfect, refine the prompt and regenerateRelated Skills
scientific-writing
Assist with scientific paper writing, LaTeX formatting, abstract drafting, review responses, grant proposals, and academic communication. Use when user asks to write/edit a paper section, draft an abstract, format in LaTeX, respond to reviewer comments, write a grant proposal, or improve academic writing. Triggers on "write abstract", "draft introduction", "LaTeX", "reviewer response", "grant proposal", "improve my writing", "paper draft", "methods section".
scientific-visualization
Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.
scientific-summarization
Summarize and simplify scientific literature, educational content, and research papers
scientific-slides
Build slide decks and presentations for research talks. Use this for making PowerPoint slides, conference presentations, seminar talks, research presentations, thesis defense slides, or any scientific talk. Provides slide structure, design templates, timing guidance, and visual validation. Works with PowerPoint and LaTeX Beamer.
scientific-schematics
Create publication-quality scientific diagrams using Nano Banana 2 AI with smart iterative refinement. Uses Gemini 3.1 Pro Preview for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.
scientific-retrieval
Retrieve and recommend relevant documents from financial, historical, and scientific archives
scientific-reasoning
Mathematical and physical reasoning with formal proof construction and problem solving
scientific-problem-selection
This skill should be used when scientists need help with research problem selection, project ideation, troubleshooting stuck projects, or strategic scientific decisions. Use this skill when users ask to pitch a new research idea, work through a project problem, evaluate project risks, plan research strategy, navigate decision trees, or get help choosing what scientific problem to work on. Typical requests include "I have an idea for a project", "I'm stuck on my research", "help me evaluate this project", "what should I work on", or "I need strategic advice about my research".
scientific-prediction
Predict material properties, economic indicators, and scientific outcomes using computational models
scientific-manuscript
COPYRIGHT NOTICE
scientific-generation
Generate scientific code, protocols, and domain-specific text with quality control
scientific-critical-thinking
Evaluate scientific claims and evidence quality. Use for assessing experimental design validity, identifying biases and confounders, applying evidence grading frameworks (GRADE, Cochrane Risk of Bias), or teaching critical analysis. Best for understanding evidence quality, identifying flaws. For formal peer review writing use peer-review.