Skip to content
diagram logo

Nano Banana - Diagram Generation

diagram

Generate publication-quality technical diagrams using Nano Banana Pro (Gemini 3 Pro Image) with AI-powered quality review. Smart iteration only regenerates when quality is below threshold.

SKILL.md

Full skill instructions

Nano Banana - Diagram Generation

Overview

Generate any technical diagram by describing it in natural language. Nano Banana Pro automatically creates publication-quality diagrams with intelligent quality review.

Key Features:

  • 🍌 Smart Iteration: Only regenerates if quality is below threshold (saves API calls)
  • 🎯 Document-Type Aware: Different quality standards for different document types
  • 🔍 AI Quality Review: Gemini 3 Pro reviews each generation for professional standards
  • 📊 Publication-Ready: High contrast, readable fonts, colorblind-friendly

When to Use This Skill

Use this skill when you need:

  • Architecture Diagrams: System designs, microservices, C4 models
  • Flowcharts: Process flows, decision trees, user journeys
  • Data Models: ERD diagrams, schema visualizations
  • Sequence Diagrams: API interactions, message flows
  • Infrastructure Diagrams: Cloud architecture, deployment topologies
  • Pipeline Diagrams: CI/​CD, data pipelines, ML workflows
  • Any Technical Visualization: Describe it, Nano Banana creates it

Quick Start

# Generate an architecture diagram
python skills/​diagram/​scripts/​generate_diagram.py "Microservices architecture with API gateway, auth service, and database" -o architecture.png --doc-type architecture

# Generate a flowchart for a presentation
python skills/​diagram/​scripts/​generate_diagram.py "User authentication flow with OAuth2" -o auth_flow.png --doc-type presentation

# Generate with verbose output
python skills/​diagram/​scripts/​generate_diagram.py "Database schema for e-commerce" -o schema.png -v

Document Types & Quality Thresholds

Different documents have different quality requirements. Nano Banana automatically adjusts:

Document TypeThresholdBest For
specification8.5/​10Technical specs, PRDs
architecture8.0/​10Architecture documents
proposal8.0/​10Business proposals
journal8.5/​10Academic publications
conference8.0/​10Conference papers
thesis8.0/​10Dissertations
grant8.0/​10Grant proposals
sprint7.5/​10Sprint planning
report7.5/​10Technical reports
preprint7.5/​10arXiv, bioRxiv
readme7.0/​10README files
poster7.0/​10Academic posters
presentation6.5/​10Slides, talks
default7.5/​10General purpose

Smart Iteration: If the first generation scores above the threshold, no second iteration is performed. This saves time and API costs.

Diagram Examples

System Architecture

python generate_diagram.py "Three-tier web application architecture with:
- React frontend
- Node.js API layer with load balancer
- PostgreSQL database with read replicas
- Redis cache layer
- CDN for static assets" -o three_tier.png --doc-type architecture

Sequence Diagram

python generate_diagram.py "Sequence diagram showing OAuth2 authorization code flow:
1. User clicks login
2. App redirects to auth server
3. User authenticates
4. Auth server returns code
5. App exchanges code for token
6. App accesses protected resource" -o oauth_flow.png --doc-type specification

Data Flow

python generate_diagram.py "Data pipeline showing:
- Data ingestion from multiple sources (API, files, streaming)
- ETL processing with Apache Spark
- Data warehouse (Snowflake)
- BI dashboards and ML model training" -o pipeline.png --doc-type report

C4 Model - Container Diagram

python generate_diagram.py "C4 Container diagram for e-commerce platform:
- Web App (React SPA)
- Mobile App (React Native)
- API Gateway (Kong)
- Order Service (Python)
- Payment Service (Go)
- Inventory Service (Java)
- PostgreSQL Database
- Redis Cache
- RabbitMQ Message Queue" -o c4_container.png --doc-type architecture

How It Works

  1. Initial Generation: Nano Banana Pro (Gemini 3 Pro Image) generates the diagram
  2. Quality Review: Gemini 3 Pro evaluates on 5 criteria:
    • Technical Accuracy (0-2 pts)
    • Clarity and Readability (0-2 pts)
    • Label Quality (0-2 pts)
    • Layout and Composition (0-2 pts)
    • Professional Appearance (0-2 pts)
  3. Decision: If score ≥ threshold → Done! If score < threshold → Iterate
  4. Improvement: Feedback is incorporated into an improved prompt
  5. Regeneration: New diagram generated with improvements (max 2 iterations)

Output Files

For an output path of diagram.png, you'll get:

  • diagram_v1.png - First iteration
  • diagram_v2.png - Second iteration (if needed)
  • diagram.png - Final version (copy of best iteration)
  • diagram_review_log.json - Quality scores and review details

Configuration

Environment Variable (Recommended)

export OPENROUTER_API_KEY='your_api_key_here'

.env File

Create a .env file in your project:

OPENROUTER_API_KEY=your_api_key_here

Get Your API Key

  1. Go to https://openrouter.ai/keys
  2. Create a new API key
  3. Add credits to your account

Tips for Better Diagrams

Be Specific

# ❌ Too vague
"System diagram"

# ✅ Specific and detailed
"Microservices architecture diagram showing user service, order service, and payment service communicating via REST APIs, with a shared PostgreSQL database and Redis cache"

Include Relationships

# ✅ Good - describes connections
"Data flow diagram showing:
- User uploads file to S3
- Lambda triggered on upload
- Lambda processes and stores metadata in DynamoDB
- SNS notifies downstream services"

Specify Style When Needed

# ✅ Style hints
"Flowchart with decision diamonds for the loan approval process, using green for approved paths and red for rejected paths"

Python API

from skills.diagram.scripts.generate_diagram_ai import NanoBananaGenerator

generator = NanoBananaGenerator(verbose=True)
results = generator.generate_iterative(
    user_prompt="Kubernetes cluster architecture with ingress, services, and pods",
    output_path="k8s_arch.png",
    iterations=2,
    doc_type="architecture"
)

print(f"Final Score: {results['final_score']}/​10")
print(f"Early Stop: {results['early_stop']}")

Integration with Other Skills

  • Use with sprint planning to visualize user story workflows
  • Use with architecture research to diagram ADR decisions
  • Use with building blocks to visualize component relationships
  • Use with competitive analysis to create comparison diagrams

Troubleshooting

"OPENROUTER_API_KEY not found"

Set the environment variable or create a .env file. See Configuration section.

Low Quality Scores

  • Add more detail to your prompt
  • Specify relationships between components
  • Use a higher threshold document type to force more iterations

Generation Timeout

Complex diagrams may take up to 2 minutes. The timeout is set to 120 seconds per API call.

Cost Considerations

  • Gemini 3 Pro Image: ~$2/​M input, ~$12/​M output tokens
  • Simple diagram (1 iteration): ~$0.05-0.15
  • Complex diagram (2 iterations): ~$0.10-0.30
  • Smart iteration saves costs by stopping early when quality is sufficient

More Design skills

brandkit logo
Design

brandkit

Premium brand-kit image generation for high-end identity systems, logo concepts, and visual-world presentations.

92.7K 345.8K
View

Premium website design-to-code skill that generates visual references first, then builds faithful frontend implementations.

92.7K 341.7K
View

Premium frontend image direction for landing pages and marketing sites, generating one distinct horizontal image per section.

92.7K 337.8K
View

Premium mobile app screen concepts and flows with clean hierarchy, strong imagery, and distinctive art direction.

92.7K 331.8K
View

Emil Kowalski's philosophy on UI polish, component design, and the invisible details that make software feel good.

43.5K 323.4K
View

Frontend design and iteration for production-grade interfaces, from concept to ship.

76.8K 313.3K
View

Reverse-engineer design tokens from public websites into starter token files for your project.

232 129.9K
View
Animate logo
Design

Animate

Builds an animation from scratch by making the decisions in the order that determines whether it feels right.

43.5K 117.9K
View

Create 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.

179.7K 114.2K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

Design AI tools

Maze Guru logo
Images

Maze Guru

Chat-to-edit AI studio for product photos, portraits, branding, and video.

Freemium
View
R
Design

RoomGPT

Generate your dream room in seconds.

Paid
View

Redesign your interior in seconds using AI

Paid
View
Reroom logo
Design

Reroom

Transform rooms with AI-generated designs.

Freemium
View
Jife logo
Design

Jife

Transform Your Space with AI-Powered Japanese Interior Designs by Jife

Paid
View
Visily logo
Design

Visily

AI-powered wireframes for non-designers.

Free
View

Revolutionize Property Viewing with AI-Generated Floor Plans and Virtual Tours

Paid
View
Archsynth logo
Design

Archsynth

Transform sketches into stunning architectural renders with AI.

Paid
View