// "Create publication-quality scientific diagrams using Nano Banana Pro AI with iterative refinement. AI generation is the default method for all diagram types. Generates high-fidelity images with automatic quality review. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations."
| name | scientific-schematics |
| description | Create publication-quality scientific diagrams using Nano Banana Pro AI with iterative refinement. AI generation is the default method for all diagram types. Generates high-fidelity images with automatic quality review. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations. |
| allowed-tools | ["Read","Write","Edit","Bash"] |
Scientific schematics and diagrams transform complex concepts into clear visual representations for publication. This skill uses Nano Banana Pro AI for all diagram generation.
How it works:
Simply describe what you want, and Nano Banana Pro creates it. All diagrams are stored in the figures/ subfolder and referenced in papers/posters.
Create any scientific diagram by simply describing it. Nano Banana Pro handles everything automatically:
# Generate any scientific diagram from a description
python scripts/generate_schematic.py "CONSORT participant flow diagram with 500 screened, 150 excluded, 350 randomized" -o figures/consort.png
# Neural network architecture
python scripts/generate_schematic.py "Transformer encoder-decoder architecture showing multi-head attention, feed-forward layers, and residual connections" -o figures/transformer.png
# Biological pathway
python scripts/generate_schematic.py "MAPK signaling pathway from EGFR to gene transcription" -o figures/mapk_pathway.png
# Custom iterations for complex diagrams
python scripts/generate_schematic.py "Complex circuit diagram with op-amp, resistors, and capacitors" -o figures/circuit.png --iterations 5
What happens behind the scenes:
Output: Three versions (v1, v2, v3) plus a detailed review log with quality scores and critiques.
Set your OpenRouter API key:
export OPENROUTER_API_KEY='your_api_key_here'
Get an API key at: https://openrouter.ai/keys
Effective Prompts for Scientific Diagrams:
✓ Good prompts (specific, detailed):
✗ Avoid vague prompts:
Key elements to include:
Scientific Quality Guidelines (automatically applied):
For reproducible, version-controlled diagrams with full programmatic control, use the traditional code-based approach.
This skill should be used when:
Simply describe your diagram in natural language. Nano Banana Pro generates it automatically:
python scripts/generate_schematic.py "your diagram description" -o output.png
That's it! The AI handles:
Works for all diagram types:
No coding, no templates, no manual drawing required.
The AI generation system uses a sophisticated three-iteration refinement process:
Prompt Construction:
Scientific diagram guidelines + User request
Example internal prompt:
Create a high-quality scientific diagram with:
- Clean white background
- High contrast for readability
- Clear labels (minimum 10pt font)
- Professional typography
- Colorblind-friendly colors
- Proper spacing
USER REQUEST: CONSORT participant flow diagram showing screening,
exclusion, randomization, and analysis phases with participant counts
Output: diagram_v1.png
AI Quality Review:
Example critique:
Score: 7/10
Strengths:
- Clear flow from top to bottom
- Good use of colors
- All phases labeled
Issues:
- Participant counts (n=X) are too small to read
- "Excluded" box overlaps with arrow
- Would benefit from reasons for exclusion
Suggestions:
- Increase font size for all numbers to at least 12pt
- Add more vertical spacing between boxes
- Include exclusion criteria in a separate annotation box
Improved Prompt:
[Original guidelines + user request]
ITERATION 2: Address these improvements:
- Increase font size for participant counts to 12pt minimum
- Add vertical spacing to prevent overlaps
- Include exclusion criteria in annotation box
Output: diagram_v2.png
Second Review:
Final Generation:
Output: diagram_v3.png (final version)
All iterations are saved with a JSON review log:
{
"user_prompt": "CONSORT participant flow diagram...",
"iterations": [
{
"iteration": 1,
"image_path": "figures/consort_v1.png",
"score": 7.0,
"critique": "..."
},
{
"iteration": 2,
"image_path": "figures/consort_v2.png",
"score": 8.5,
"critique": "..."
},
{
"iteration": 3,
"image_path": "figures/consort_v3.png",
"score": 9.5,
"critique": "..."
}
],
"final_score": 9.5
}
from scripts.generate_schematic_ai import ScientificSchematicGenerator
# Initialize generator
generator = ScientificSchematicGenerator(
api_key="your_openrouter_key",
verbose=True
)
# Generate with iterative refinement
results = generator.generate_iterative(
user_prompt="Transformer architecture diagram",
output_path="figures/transformer.png",
iterations=3
)
# Access results
print(f"Final score: {results['final_score']}/10")
print(f"Final image: {results['final_image']}")
# Review individual iterations
for iteration in results['iterations']:
print(f"Iteration {iteration['iteration']}: {iteration['score']}/10")
print(f"Critique: {iteration['critique']}")
# Basic usage
python scripts/generate_schematic.py "diagram description" -o output.png
# Custom iterations (1-10)
python scripts/generate_schematic.py "complex diagram" -o diagram.png --iterations 5
# Verbose output (see all API calls and reviews)
python scripts/generate_schematic.py "flowchart" -o flow.png -v
# Provide API key via flag
python scripts/generate_schematic.py "diagram" -o out.png --api-key "sk-or-v1-..."
1. Be Specific About Layout:
✓ "Flowchart with vertical flow, top to bottom"
✓ "Architecture diagram with encoder on left, decoder on right"
✓ "Circular pathway diagram with clockwise flow"
2. Include Quantitative Details:
✓ "Neural network with input layer (784 nodes), hidden layer (128 nodes), output (10 nodes)"
✓ "Flowchart showing n=500 screened, n=150 excluded, n=350 randomized"
✓ "Circuit with 1kΩ resistor, 10µF capacitor, 5V source"
3. Specify Visual Style:
✓ "Minimalist block diagram with clean lines"
✓ "Detailed biological pathway with protein structures"
✓ "Technical schematic with engineering notation"
4. Request Specific Labels:
✓ "Label all arrows with activation/inhibition"
✓ "Include layer dimensions in each box"
✓ "Show time progression with timestamps"
5. Mention Color Requirements:
✓ "Use colorblind-friendly colors"
✓ "Grayscale-compatible design"
✓ "Color-code by function: blue for input, green for processing, red for output"
python scripts/generate_schematic.py \
"CONSORT participant flow diagram for randomized controlled trial. \
Start with 'Assessed for eligibility (n=500)' at top. \
Show 'Excluded (n=150)' with reasons: age<18 (n=80), declined (n=50), other (n=20). \
Then 'Randomized (n=350)' splits into two arms: \
'Treatment group (n=175)' and 'Control group (n=175)'. \
Each arm shows 'Lost to follow-up' (n=15 and n=10). \
End with 'Analyzed' (n=160 and n=165). \
Use blue boxes for process steps, orange for exclusion, green for final analysis." \
-o figures/consort.png
python scripts/generate_schematic.py \
"Transformer encoder-decoder architecture diagram. \
Left side: Encoder stack with input embedding, positional encoding, \
multi-head self-attention, add & norm, feed-forward, add & norm. \
Right side: Decoder stack with output embedding, positional encoding, \
masked self-attention, add & norm, cross-attention (receiving from encoder), \
add & norm, feed-forward, add & norm, linear & softmax. \
Show cross-attention connection from encoder to decoder with dashed line. \
Use light blue for encoder, light red for decoder. \
Label all components clearly." \
-o figures/transformer.png --iterations 3
python scripts/generate_schematic.py \
"MAPK signaling pathway diagram. \
Start with EGFR receptor at cell membrane (top). \
Arrow down to RAS (with GTP label). \
Arrow to RAF kinase. \
Arrow to MEK kinase. \
Arrow to ERK kinase. \
Final arrow to nucleus showing gene transcription. \
Label each arrow with 'phosphorylation' or 'activation'. \
Use rounded rectangles for proteins, different colors for each. \
Include membrane boundary line at top." \
-o figures/mapk_pathway.png
python scripts/generate_schematic.py \
"IoT system architecture block diagram. \
Bottom layer: Sensors (temperature, humidity, motion) in green boxes. \
Middle layer: Microcontroller (ESP32) in blue box. \
Connections to WiFi module (orange box) and Display (purple box). \
Top layer: Cloud server (gray box) connected to mobile app (light blue box). \
Show data flow arrows between all components. \
Label connections with protocols: I2C, UART, WiFi, HTTPS." \
-o figures/iot_architecture.png
If you have existing TikZ .tex files that need compilation:
# Compile TikZ diagram to PDF
python scripts/compile_tikz.py diagram.tex -o diagram.pdf
# Compile and generate PNG
python scripts/compile_tikz.py diagram.tex --png --dpi 300
# Compile and preview
python scripts/compile_tikz.py diagram.tex --preview
For details on using compile_tikz.py, run:
python scripts/compile_tikz.py --help
The main entry point supports both AI and code-based generation:
# AI generation (default)
python scripts/generate_schematic.py "diagram description" -o output.png
# Explicit AI method
python scripts/generate_schematic.py "diagram description" -o output.png --method ai
# Code-based generation
python scripts/generate_schematic.py "1. Step one\n2. Step two" -o flow.tex --method code --type flowchart
# Custom iterations for AI
python scripts/generate_schematic.py "complex diagram" -o diagram.png --iterations 5
# Verbose mode
python scripts/generate_schematic.py "diagram" -o out.png -v
Method Selection:
--method ai: Use Nano Banana Pro with iterative refinement (default)--method code: Use traditional code-based generationCode-Based Types:
--type flowchart: Generate TikZ flowchart--type circuit: Generate circuit diagram--type pathway: Generate biological pathwaycompile_tikz.pyStandalone TikZ compilation utility with quality checks:
# Compile TikZ to PDF with verification
python scripts/compile_tikz.py flowchart.tex -o flowchart.pdf --verify
# Generate PNG with quality report
python scripts/compile_tikz.py flowchart.tex -o flowchart.pdf --png --dpi 300 --verify
# Preview with quality overlay
python scripts/compile_tikz.py flowchart.tex --preview --show-quality
Note: The Nano Banana Pro AI generation system includes automatic quality review in its iterative refinement process. Each iteration is evaluated for scientific accuracy, clarity, and accessibility.
\input{} for TikZ, \includegraphics{} for externalProblem: ! Package tikz Error: I do not know the key '/tikz/...
\usetikzlibrary{...} to preambleProblem: Overlapping text or elements
--iterations 5 for better refinementauto_spacing=True in pathway generator for automatic adjustmentProblem: Arrows not connecting properly
(node.east), (node.north), etc.Problem: Schemdraw elements not aligning
.at() method for precise positioningauto_spacing to prevent overlapsProblem: Matplotlib text rendering issues
plt.rcParams['text.usetex'] = True for LaTeX renderingProblem: Export quality poor
python scripts/compile_tikz.py diagram.tex --png --dpi 300Problem: Elements overlap after generation
detect_overlaps() function to identify problem regionsiterative_diagram_refinement(create_function)Problem: False positive overlap detection
detect_overlaps(image_path, threshold=0.98)Problem: Generated image quality is low
--iterations 5Problem: Colorblind simulation shows poor contrast
Problem: High-severity overlaps detected
Problem: Visual report generation fails
Image.open(path).verify()Problem: Colors indistinguishable in grayscale
verify_accessibility(image_path)Problem: Text too small when printed
validate_resolution(image_path)Problem: Accessibility checks consistently fail
Load these files for comprehensive information on specific topics:
references/tikz_guide.md - Complete TikZ syntax, positioning, styles, and techniquesreferences/diagram_types.md - Catalog of scientific diagram types with examplesreferences/best_practices.md - Publication standards and accessibility guidelinesreferences/python_libraries.md - Guide to Schemdraw, NetworkX, and Matplotlib for diagramsTikZ and LaTeX
Python Libraries
Publication Standards
This skill works synergistically with:
Before submitting diagrams, verify:
run_quality_checks() and achieved PASS statusquality_reports/ directory\ref{} points to correct figure)Choose AI Generation (Nano Banana Pro) if:
Choose Code-Based Generation if:
| Aspect | AI Generation | Code-Based |
|---|---|---|
| Time to first result | 2-3 minutes | 15-30 minutes |
| Iterations | Automatic (3 rounds) | Manual |
| Quality review | Automatic by AI | Manual or scripted |
| Customization | Natural language | Full programmatic control |
| Reproducibility | Prompt-based | Code-based (exact) |
| Learning curve | Low (just describe) | Medium-High (learn libraries) |
| Output format | PNG/JPG | PDF/SVG/EPS/PNG |
| Version control | Prompt + images | Source code + outputs |
| Best for | Quick iteration, complex visuals | Reproducible research, data-driven |
Many users find success with a hybrid workflow:
For AI Generation:
# Required
export OPENROUTER_API_KEY='your_api_key_here'
# Get key at: https://openrouter.ai/keys
For Code-Based Generation:
# Install Graphviz
brew install graphviz # macOS
sudo apt-get install graphviz # Linux
# Install Python packages
pip install graphviz schemdraw networkx matplotlib
Simplest possible usage (AI):
python scripts/generate_schematic.py "your diagram description" -o output.png
Simplest possible usage (Code):
python scripts/generate_schematic.py "1. Step one\n2. Step two" -o flow.tex --method code
Use this skill to create clear, accessible, publication-quality diagrams that effectively communicate complex scientific concepts. The AI-powered workflow with iterative refinement ensures diagrams meet professional standards, while the code-based approach provides exact reproducibility for research publications.