
Generating Visual Diagrams
- 2.3k installs
- 763 repo stars
- Updated July 24, 2026
- forcedotcom/sf-skills
generating-visual-diagrams is a Salesforce skill that renders ERDs, UI mockups, and architecture images using Gemini Nano Banana Pro.
About
generating-visual-diagrams produces rendered Salesforce visuals rather than text Mermaid diagrams. It covers visual ERDs, LWC and Experience Cloud mockups, architecture illustrations, and image edits using the Gemini Nano Banana Pro extension. A hard prerequisites gate runs check-prerequisites.sh before any generation, routing failures to gemini-cli-setup guidance. Interview-first workflow loads question banks for ERD, UI, architecture, and edit tasks unless the user requests quick mode with 1K draft defaults. The recommended loop drafts at 1K with gemini --yolo /generate, iterates with /edit, then exports final 2K or 4K images via generate_image.py. Default ERD style follows architect.salesforce.com aesthetics with dark borders and cloud accent colors. Out-of-scope tasks delegate to generating-mermaid-diagrams, generating-custom-object, generating-lwc-components, or generating-apex skills. Error recovery covers missing GEMINI_API_KEY, failed yolo runs, missing nanobanana extension installation, and fallback to generate_image.py scripts.
- Rendered PNG and SVG ERDs, mockups, and architecture images via Nano Banana Pro.
- Prerequisites check gate before any image generation attempt.
- Interview-first workflow with quick-mode 1K draft defaults.
- Iterate with /edit then upscale via generate_image.py at 2K or 4K.
- Default architect.salesforce.com ERD aesthetic and delegation boundaries.
Generating Visual Diagrams by the numbers
- 2,300 all-time installs (skills.sh)
- +7 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #130 of 1,896 Design & UI/UX skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
generating-visual-diagrams capabilities & compatibility
- Capabilities
- prerequisites validation before image generation · interview driven prompt gathering for erd and ui · 1k draft generation and /edit iteration workflow · 2k and 4k export via generate_image.py · architect.salesforce.com default erd styling
- Works with
- gcp
- Use cases
- ui design · presentations · documentation
- Runs
- Runs locally
- Pricing
- Bring your own API key
npx skills add https://github.com/forcedotcom/sf-skills --skill generating-visual-diagramsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2.3k |
|---|---|
| repo stars | ★ 763 |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 24, 2026 |
| Repository | forcedotcom/sf-skills ↗ |
How do I generate presentation-ready Salesforce ERDs or LWC mockups as PNG images instead of text diagrams?
Generate rendered PNG or SVG Salesforce visuals such as ERDs, UI mockups, and architecture diagrams via Nano Banana Pro.
Who is it for?
Salesforce architects needing rendered ERDs, Experience Cloud mockups, or slide-ready architecture visuals.
Skip if: Skip for Mermaid text diagrams, Apex code, or non-visual documentation tasks.
When should I use this skill?
User asks for PNG or SVG ERDs, UI mockups, wireframes, or says generate image or create mockup for Salesforce.
What you get
Interviewed prompts, 1K draft iterations, and final high-resolution images with architect.salesforce.com styling.
- architecture diagram
- integration flow visual
Files
generating-visual-diagrams: Salesforce Visual AI Skill
Use this skill when the user needs rendered visuals, not text diagrams: ERDs, UI mockups, architecture illustrations, slide-ready images, or image edits using Nano Banana Pro.
Scope
In scope:
- PNG / SVG-style rendered image output
- Visual ERDs and architecture diagrams
- LWC or Experience Cloud mockups / wireframes
- Image edits on previously generated visuals
Out of scope — delegate instead:
- Mermaid or text-only diagrams → generating-mermaid-diagrams
- Object / field metadata discovery for ERDs → generating-custom-object or generating-custom-field
- LWC implementation after the mockup is approved → generating-lwc-components
- Apex review / implementation → generating-apex
---
Hard Gate: Prerequisites First
Run the prerequisites check before using the skill:
scripts/check-prerequisites.shIf prerequisites fail, stop and route the user to setup guidance in:
- references/gemini-cli-setup.md
---
Required Inputs
Ask for or infer before generating:
| Input | Default if not provided |
|---|---|
| Image type | ERD |
| Subject scope and key entities / systems | Ask the user |
| Target quality | Draft (1K) |
| Preferred style | architect.salesforce.com aesthetic |
| Aspect ratio | Default (no override) |
| Quick mode or interview mode | Interview mode |
---
Interview-First Workflow
Unless the user asks for quick / simple / just generate, ask clarifying questions first using the question bank in references/interview-questions.md.
| Request type | Ask about |
|---|---|
| ERD / schema | objects, visual style, purpose, extras |
| UI mockup | component type, object/context, device/layout, style |
| architecture image | systems, boundaries, protocols, emphasis |
| image edit | what to keep, what to change, output quality |
Quick mode defaults (triggered by "quick", "simple", "just generate", "fast"):
- professional style, 1K draft, legend included, one image first then iterate
---
Recommended Workflow
1. Run prerequisites check
Run scripts/check-prerequisites.sh and confirm all required tools pass before proceeding.
2. Gather inputs
- object list / metadata (delegate to
generating-custom-object/generating-custom-fieldif needed) - purpose: draft vs presentation vs documentation
- desired aesthetic — read references/architect-aesthetic-guide.md for ERDs
- aspect ratio / resolution
3. Run interview or use quick-mode defaults
Load references/interview-questions.md for the matching question set (ERD, LWC, architecture, code review).
4. Build a concrete prompt
Good prompts specify subject, composition, color treatment, labels/legends, and output quality goal.
5. Generate a fast draft at 1K
gemini --yolo "/generate 'Your prompt here'"Open the result and review layout before spending on higher resolution.
6. Iterate using edits
gemini --yolo "/edit 'Specific change instruction'"Use /edit for small adjustments — cheaper than regenerating. See references/iteration-workflow.md.
7. Generate final at 2K/4K using the Python script
Run scripts/generate_image.py when layout is confirmed:
uv run scripts/generate_image.py -p "Refined prompt" -f "output.png" -r 4K8. Error recovery
- If
gemini --yoloreturns no image: re-run once; if it fails again, fall back to the Python script path. - If the Python script fails with
GEMINI_API_KEY not found: verify the key is exported in your shell profile (~/.zshrcon macOS/zsh,~/.bashrcon Linux) and the terminal session is refreshed. - If the extension is missing: run
gemini extensions install nanobananaand re-run the prerequisites check.
---
Default Style Guidance
For ERDs, default to the architect.salesforce.com aesthetic unless the user asks otherwise:
- dark border + light fill cards
- cloud-specific accent colors
- clean labels and relationship lines
- presentation-ready whitespace and hierarchy
Full style specification: references/architect-aesthetic-guide.md
---
Common Patterns
| Pattern | Default approach |
|---|---|
| visual ERD | get metadata if available, then render a draft first |
| LWC mockup | load assets/lwc/data-table.md, assets/lwc/record-form.md, or assets/lwc/dashboard-card.md for the matching template |
| architecture illustration | load assets/architecture/integration-flow.md; emphasize systems and flows |
| image refinement | use /edit for small changes before regenerating |
| final production asset | switch to script-driven 2K/4K generation via scripts/generate_image.py |
| Apex / LWC code review | load assets/review/apex-review.md or assets/review/lwc-review.md for the review prompt template |
---
Output Expectations
Deliverables produced by this skill:
- Draft image (
<name>.png) — 1K resolution rendered viagemini --yolo "/generate ..."for layout review - Final image (
<name>.png) — 2K or 4K resolution rendered viascripts/generate_image.pyonce composition is approved - Edit iteration (
<name>.png) — incremental refinement viagemini --yolo "/edit ..."without full regeneration
After delivering each image:
- Open the file in Preview or attach it in the session for multimodal review
- Ask the user whether to iterate on layout, labeling, or color before finalizing
- Only proceed to high-res output after draft composition is confirmed
---
Rules / Constraints
| Rule | Rationale |
|---|---|
| Always run prerequisites check before any generation | Missing tools produce silent failures |
| Always draft at 1K before generating at 4K | Cost and time savings; composition changes at high res are wasteful |
Use /edit for incremental changes, not full regeneration | Cheaper and faster for small adjustments |
Never commit GEMINI_API_KEY to version control | Key is personal and tied to billing |
Delegate text diagrams to generating-mermaid-diagrams | This skill owns rendered images only |
---
Gotchas
| Issue | Resolution |
|---|---|
| Edit not applying correctly | Be specific: reference existing elements by name; one change at a time |
| 4K output looks different from 1K draft | Use exact same prompt text; minor variations are normal model behavior |
gemini --yolo fails silently | Check that the Nano Banana extension is installed: gemini extensions list |
| Image dimensions wrong | Set --aspect-ratio explicitly in scripts/generate_image.py using -a "16:9" |
| RGBA image causes errors in Python script | Script auto-converts RGBA→RGB; ensure Pillow is installed via uv |
---
Cross-Skill Integration
| Need | Delegate to | Reason |
|---|---|---|
| Mermaid first draft or text diagram | generating-mermaid-diagrams | faster structural diagramming |
| Object / field discovery for ERD | generating-custom-object / generating-custom-field | accurate schema grounding |
| Turn mockup into real LWC component | generating-lwc-components | implementation after design |
| Apex review / implementation | generating-apex | code-quality follow-up |
---
Reference File Index
| File | When to read |
|---|---|
| references/gemini-cli-setup.md | Prerequisites fail — Gemini CLI / Nano Banana setup guidance |
| references/interview-questions.md | Step 3 — load question set matching the request type |
| references/iteration-workflow.md | Step 6 — draft-to-final iteration patterns and cost tips |
| references/architect-aesthetic-guide.md | Step 4 — ERD color palettes, box styles, prompt templates |
| references/examples-index.md | Step 4 — example prompts for ERD, LWC, architecture, code review |
| assets/erd/core-objects.md | Step 4 — prompt template for core CRM objects (Account, Contact, Opportunity, Case) |
| assets/erd/custom-objects.md | Step 4 — prompt template for custom object ERDs |
| assets/lwc/data-table.md | Step 4 — prompt template for lightning-datatable mockups |
| assets/lwc/record-form.md | Step 4 — prompt template for lightning-record-form mockups |
| assets/lwc/dashboard-card.md | Step 4 — prompt template for dashboard card / metric tile mockups |
| assets/architecture/integration-flow.md | Step 4 — prompt template for integration architecture diagrams |
| assets/review/apex-review.md | Step 4 — Gemini review prompt template for Apex code |
| assets/review/lwc-review.md | Step 4 — Gemini review prompt template for LWC components |
| scripts/check-prerequisites.sh | Step 1 — run to verify all required tools are installed |
| scripts/generate_image.py | Step 7 — run for 2K/4K resolution output and image editing with resolution control |
Architecture Template: Integration Flow
Prompt Template
Professional Salesforce integration architecture diagram:
SYSTEMS:
[List systems with types and icons]
INTEGRATION PATTERNS:
[List integrations with protocols and directions]
COMPONENTS:
- API Gateway (if applicable)
- Authentication layer
- Middleware/ESB (if applicable)
- Error handling/retry logic
STYLING:
- Cloud icon for Salesforce
- Server icons for external systems
- Arrows with protocol labels
- Color coding by system type
- Professional diagram style
FORMAT:
- Landscape orientation
- Left-to-right or hub-spoke layout
- Include legendExample
gemini "/generate 'Salesforce integration architecture diagram:
Systems:
1. Salesforce (cloud icon, blue)
2. MuleSoft (middleware icon, purple)
3. SAP ERP (server icon, orange)
Flows:
1. Salesforce --REST--> MuleSoft --BAPI--> SAP
- Account/Contact sync (bidirectional)
2. SAP --Events--> MuleSoft --Platform Events--> Salesforce
- Invoice updates
Include:
- OAuth 2.0 authentication badges
- Error queue for failed messages
Style: Professional, clean lines, pastel colors'"ERD Template: Core Salesforce Objects (Architect.salesforce.com Style)
Default Style
All ERDs now use the official architect.salesforce.com aesthetic by default:
- Dark border + light translucent fill boxes
- Header banner with Salesforce logo
- LEGEND bar with ENTITIES and RELATIONSHIPS
- Labeled relationship lines
- Footer with copyright
See references/architect-aesthetic-guide.md for full specification.
---
Prompt Template (Architect.salesforce.com Style)
Create a Salesforce Core CRM ERD in the EXACT architect.salesforce.com style:
PAGE TITLE (very top, large bold text):
'Core CRM Overview Data Model'
HEADER SECTION (below title):
- Left: Salesforce cloud logo + 'SALESFORCE PLATFORM Overview' in dark teal (#0B827C) banner box
- Center: LEGEND with 'ENTITIES' section showing:
* Cloud Entity box (dark teal #0B827C border, light teal ~25% opacity fill)
* Related Entity box (dark teal border, lighter fill)
* External Entity box (black border, white fill)
- Right: 'RELATIONSHIPS' section showing notation symbols for Parent/Child, Required, Optional, Many-to-Many
BOX STYLING - CRITICAL:
- DARK BORDER: Solid 2px border in dark teal (#0B827C)
- LIGHT TRANSLUCENT FILL: Same teal hue at ~25% opacity
- Rounded corners (8-12px radius)
- Text in dark gray/black on the light fill
ENTITY BOX FORMAT:
┌─────────────────────────┐
│ Logical Name │ (Bold, larger)
│ APIName │ (Smaller, italic, gray)
│ • Field1 │ (Bullet points)
│ • Field2 │
└─────────────────────────┘
OBJECTS TO INCLUDE (all with dark teal border + light teal fill):
- Account (center position):
Account
Account
• Account Number
• Name
• Industry
• Type
- Contact (linked to Account):
Contact
Contact
• Name
• Email
• Title
• Phone
- Opportunity (linked to Account):
Opportunity
Opportunity
• Name
• Amount
• Close Date
• StageName
- Case (linked to Account and Contact):
Case
Case
• CaseNumber
• Type
• Priority
• Status
RELATIONSHIP LINES:
- Thin black lines with text labels ON the lines
- Contact → Account: "child of" (crow's foot on Contact side)
- Opportunity → Account: "child of" (crow's foot on Opportunity side)
- Case → Account: "related to" (crow's foot on Case side)
- Case → Contact: "related to" (optional)
- STRAIGHT LINES ONLY (horizontal and vertical, no diagonals)
FOOTER:
Left: '©2024 Salesforce - Subject to change without notice'
Right: 'Last modified: [current date]'
CRITICAL: Dark teal borders with LIGHT translucent teal fill - NOT solid filled boxes.---
Usage
# Quick draft at 1K (iterate here)
gemini --yolo "/generate '[paste prompt above]'"
open ~/nanobanana-output/*.png # Review and refine
# Final at 4K (when satisfied)
uv run scripts/generate_image.py \
-p "[your refined prompt]" \
-f "core-crm-erd.png" \
-r 4K
open ~/nanobanana-output/*core-crm*.png---
Cloud Color Reference
| Cloud | Border Color | Fill (~25% opacity) |
|---|---|---|
| Sales Cloud | #0B827C (Teal) | Light Teal |
| Service Cloud | #9E2A7D (Magenta) | Light Pink |
| Platform | #5A67D8 (Purple) | Light Purple |
---
Resolution Guide
| Phase | Resolution | Use Case |
|---|---|---|
| Draft | 1K (CLI) | Quick iteration, prompt refinement |
| Final | 4K (Python) | Documentation, presentations |
Tip: Iterate at 1K until layout is correct, then generate 4K final.
ERD Template: Custom Objects
Prompt Template
Professional Salesforce ERD diagram showing custom objects:
OBJECTS:
[List custom objects with relationships]
COLOR CODING:
- Standard Objects: Blue (#bae6fd fill, #0369a1 border)
- Custom Objects: Orange (#fed7aa fill, #c2410c border)
- External Objects: Green (#a7f3d0 fill, #047857 border)
RELATIONSHIPS:
- Lookup (LK): Dashed arrow, optional parent
- Master-Detail (MD): Solid thick arrow, cascade delete
STYLING:
- Clean white background
- Pastel fill colors with dark borders
- Relationship labels on arrows
- Professional diagram layout
- Include color legend
FORMAT:
- Auto-layout based on relationships
- Primary objects centered
- Child objects positioned below/right of parentsExample
# Draft at 1K (iterate here)
gemini --yolo "/generate 'Salesforce ERD for real estate app:
- Property__c (orange, center): Main custom object
- Listing__c (orange, right): Master-Detail to Property__c
- Showing__c (orange, below): Lookup to both Property__c and Contact
Orange boxes for custom objects, blue for standard (Contact).
Include legend. Professional style.'"
open ~/nanobanana-output/*.png # Review and refine
# Final at 4K (when satisfied)
uv run scripts/generate_image.py \
-p "Salesforce ERD for real estate app..." \
-f "realestate-erd.png" \
-r 4KResolution Guide
| Phase | Resolution | Use Case |
|---|---|---|
| Draft | 1K (CLI) | Quick iteration, prompt refinement |
| Final | 4K (Python) | Documentation, presentations |
Tip: Iterate at 1K until layout is correct, then generate 4K final.
LWC Template: Dashboard Card Mockup
Prompt Template
Salesforce Lightning dashboard card/tile mockup:
CARD TYPE: [metric/chart/list/progress]
METRIC CARD:
- Large metric value
- Label below
- Trend indicator: up/down arrow with percentage
- Sparkline mini chart (optional)
- Icon in corner
CHART CARD:
- Chart type: [bar/line/pie/donut]
- Legend position
- Data labels on hover
LIST CARD:
- Title with "View All" link
- 3-5 list items
- Each item: icon, primary text, secondary text
STYLING:
- SLDS card component
- White background with subtle shadow
- Rounded corners
- Header with title and action menuExample: Metric Card
gemini "/generate 'Salesforce dashboard metric card:
- Large number: $1.2M
- Label: Total Pipeline Value
- Trend: +12% (green up arrow)
- Icon: Opportunity icon (top-right)
- Sparkline: Show 7-day trend mini chart
Style: SLDS card, white background, subtle shadow'"LWC Template: Data Table Mockup
Prompt Template
Salesforce Lightning Web Component data table mockup:
COMPONENT: lightning-datatable style
HEADER:
- Component title: "[Title]"
- Search box (right-aligned)
- Action buttons: New, Refresh, Export
COLUMNS:
[List columns with types]
SAMPLE DATA:
- Show 5-7 sample rows with realistic data
- Include row selection checkboxes
- Show sorting arrows on sortable columns
STYLING:
- SLDS (Salesforce Lightning Design System)
- Zebra striping on rows
- Hover highlight
- Blue header bar
- White background
ACTIONS:
- Row-level action menu (three dots)
- Bulk action buttons when rows selected
FORMAT:
- Desktop view (1200px width)
- Full component with card wrapper
- Include pagination footerExample
gemini "/generate 'Salesforce LWC data table mockup:
Title: Recent Opportunities
Columns:
1. Opportunity Name (link)
2. Account Name (text)
3. Amount (currency, right-aligned)
4. Stage (picklist badge)
5. Close Date (date)
6. Owner (user with avatar)
Sample data: Show 5 realistic opportunities
Include: Search, New button, row actions menu
Style: SLDS, professional, clean
Pagination: 1-5 of 127'"LWC Template: Record Form Mockup
Prompt Template
Salesforce Lightning Web Component record form mockup:
COMPONENT: lightning-record-form style
HEADER:
- Object icon and label
- Edit/Save/Cancel buttons (right)
- Record name as title
LAYOUT:
- Two-column layout for desktop
- Responsive single column for mobile
SECTIONS:
[Define sections with fields]
FIELD TYPES:
- Text inputs with labels above
- Picklists as dropdown
- Lookups with search icon
- Date pickers with calendar
- Currency with formatting
- Checkboxes for boolean
STYLING:
- SLDS record page styling
- Compact spacing
- Blue section headers
- Required field indicators (*)
- Help text icons where applicableExample
gemini "/generate 'Salesforce LWC record form mockup:
Object: Opportunity
Mode: Edit
Sections:
1. Opportunity Information:
- Opportunity Name* (text)
- Account Name* (lookup with search)
- Type (picklist)
- Lead Source (picklist)
2. Amount & Dates:
- Amount (currency)
- Close Date* (date picker)
- Stage* (picklist)
- Probability (percentage)
Footer: Save and Cancel buttons
Style: SLDS, professional, desktop view'"Apex Code Review Template
Gemini Review Prompt
Review this Apex code for best practices and issues:
CODE:
[paste code here]
REVIEW CATEGORIES:
1. BULKIFICATION
- SOQL queries in loops
- DML operations in loops
- Governor limit risks
- Collection usage
2. SECURITY
- CRUD permissions check
- FLS enforcement
- Sharing model compliance
- Injection vulnerabilities
3. BEST PRACTICES
- Trigger handler pattern
- One trigger per object
- Separation of concerns
- Proper exception handling
4. PERFORMANCE
- Selective SOQL queries
- Index usage
- Unnecessary computation
5. MAINTAINABILITY
- Code comments
- Method length
- Test coverage considerations
OUTPUT FORMAT:
JSON with summary, issues array, bestPractices array, and scoreUsage
gemini "Review this Apex trigger for issues: [paste code]" -o jsonSeverity Guidelines
| Severity | Criteria |
|---|---|
| High | Security, governor limits, data integrity |
| Medium | Performance, best practices |
| Low | Style, minor improvements |
LWC Code Review Template
Gemini Review Prompt
Review this Lightning Web Component for best practices:
JAVASCRIPT:
[paste JS code]
HTML TEMPLATE:
[paste HTML code]
REVIEW CATEGORIES:
1. ACCESSIBILITY (A11Y)
- ARIA labels and roles
- Keyboard navigation
- Screen reader compatibility
2. PERFORMANCE
- Wire service usage
- Rendering optimization
- Event handling
3. SECURITY
- Locker Service compliance
- XSS prevention
4. BEST PRACTICES
- Component lifecycle
- Error handling
- Data binding
5. SALESFORCE PATTERNS
- Lightning Data Service
- Navigation service
- Toast notifications
OUTPUT FORMAT:
JSON with summary, issues array, accessibility score, and overall scoreUsage
gemini "Review this LWC component: [paste code]" -o jsonCredits & Acknowledgments
This skill leverages cutting-edge AI technologies and tools to enable visual content generation in Salesforce development workflows.
---
Technologies & Tools
Google Gemini
Key capabilities:
- Gemini 3 Pro multimodal AI model
- Image generation via Nano Banana Pro extension
- Code review and analysis capabilities
- Documentation research and summarization
Gemini CLI
Key features:
- Command-line access to Gemini models
- Extension support (Nano Banana)
- Non-interactive mode with --yolo flag
- JSON output for programmatic use
Nano Banana Pro
Gemini image generation extension.
Key features:
- High-quality image generation
- ERD and diagram creation
- UI/UX mockup generation
- Architecture visualization
---
Display Technologies
timg
Terminal image viewer.
Key features:
- Kitty graphics protocol support
- Multiple format support (PNG, JPG, GIF)
- Inline terminal display
Kitty Graphics Protocol
High-fidelity image rendering protocol for modern terminals.
Key features:
- High-fidelity image display in terminals
- Supported by Ghostty, Kitty, WezTerm
- Enables visual content in CLI workflows
Ghostty Terminal
Modern GPU-accelerated terminal emulator.
Key features:
- Kitty graphics protocol support
- Cross-platform (macOS, Linux)
- High performance rendering
---
Salesforce Resources
Salesforce Lightning Design System (SLDS)
- Design patterns for LWC mockups
- Color palettes and typography
- Component specifications
Salesforce Developers Platform
- API documentation
- Best practices guides
- Platform architecture references
generating-visual-diagrams
AI-powered visual content generation for Salesforce development. Generate ERD diagrams, LWC mockups, and architecture visuals using Gemini 3 Pro Image (Nano Banana Pro).
Features
- Visual ERD Generation: Create actual rendered ERD diagrams (not just Mermaid code)
- LWC/UI Mockups: Generate wireframes and component mockups following SLDS
- Gemini Code Review: Parallel code review while Claude continues working
- Documentation Research: Parallel Salesforce documentation research via Gemini
Prerequisites
IMPORTANT: Run the prerequisites check before using this skill:
scripts/check-prerequisites.sh| Requirement | Description | How to Install |
|---|---|---|
| Ghostty Terminal | Required for Kitty graphics protocol | Download from the Ghostty website |
| GEMINI_API_KEY | Personal API key for Nano Banana Pro | Generate via Google AI Studio |
| Gemini CLI | Command-line interface for Gemini | npm install -g @google/gemini-cli |
| Nano Banana Extension | Image generation extension | gemini extensions install nanobanana |
| timg | Terminal image viewer with Kitty support | brew install timg |
Quick Start
1. Set up your API key
Add to ~/.zshrc:
export GEMINI_API_KEY="your-personal-api-key"
export NANOBANANA_MODEL=gemini-3-pro-image-preview2. Invoke the skill
Skill: generating-visual-diagrams
Request: "Generate an ERD diagram showing Account, Contact, and Opportunity relationships"3. View the result
Images are displayed inline using Kitty graphics protocol (Ghostty) or via Claude's multimodal vision using the Read tool.
Use Cases
| Use Case | Example Request |
|---|---|
| ERD Diagrams | "Generate a visual ERD for Account, Contact, Opportunity" |
| LWC Mockups | "Create a mockup for an Account list datatable component" |
| Code Review | "Get Gemini's review of this Apex trigger" |
| Doc Research | "Research the Flow best practices in Salesforce docs" |
Cross-Skill Integration
| Related Skill | When to Use |
|---|---|
| generating-mermaid-diagrams | Convert Mermaid to visual rendering |
| generating-custom-object | Query object/field data before generating ERDs |
| generating-lwc-components | Generate mockups for LWC components |
| generating-apex | Review Apex code via Gemini sub-agent |
Documentation
- Gemini CLI Setup
Security Notes
NEVER commit your GEMINI_API_KEY to version control
- Store API key in
~/.zshrconly (not in project files) - The key is personal and tied to your Google account billing
Requirements
- Ghostty terminal (for Kitty graphics)
- Gemini CLI with Nano Banana extension
- GEMINI_API_KEY environment variable
- timg (for terminal image display)
<!-- Parent: generating-visual-diagrams/SKILL.md -->
Official Salesforce Architect ERD Aesthetic Guide
Reference for generating ERDs matching the architect.salesforce.com visual style. This is the default style for all ERD diagrams generated by generating-visual-diagrams.
---
Cloud-Specific Color Palettes
Each Salesforce cloud has its own brand color. The skill auto-detects which cloud to use based on the objects requested.
| Cloud | Border Color | Fill (~25% opacity) | Detect By Objects |
|---|---|---|---|
| Sales Cloud | #0B827C (Teal) | Light Teal | Lead, Opportunity, Quote, Campaign, Order |
| Service Cloud | #9E2A7D (Magenta) | Light Pink | Case, Knowledge, Entitlement, Swarm, Incident |
| Platform | #5A67D8 (Purple) | Light Purple | Account, Contact only (no cloud-specific objects) |
| Industries/Scheduler | #BA4383 (Pink) | Light Pink | ServiceTerritory, WorkType, Shift, ServiceResource |
| Nonprofit Cloud | #032D60 (Navy) | Light Gray | Survey, Donation, Program objects |
---
The Signature Box Style: "Dark Border + Light Fill"
This is the defining visual pattern of architect.salesforce.com diagrams:
| Property | Value |
|---|---|
| Border | Solid 2px in cloud's brand color |
| Fill | Same hue at ~25% opacity (translucent) |
| Corners | Rounded (8-12px radius) |
| Text | Dark gray/black on light fill |
Visual Example
┌─────────────────────────┐
│ ░░░░░░░░░░░░░░░░░░░░░░░ │ ← Light translucent fill
│ ░ Opportunity ░ │ ← Bold logical name
│ ░ Opportunity ░ │ ← Smaller italic API name
│ ░ • Name ░ │ ← Key fields with bullets
│ ░ • Amount ░ │
│ ░ • Close Date ░ │
└─────────────────────────┘
↑ Dark solid border---
Page Structure
1. Page Title (Top)
Large bold text centered at the very top:
- Format:
"[Cloud Name] Overview Data Model" - Example:
"Sales Cloud Overview Data Model"
2. Header Banner
Below the title, a horizontal banner containing:
┌──────────────────────────────────────────────────────────────────────────────┐
│ [salesforce] SALES CLOUD │ LEGEND: │
│ Overview │ ENTITIES │ RELATIONSHIPS │
│ │ [boxes...] │ [symbols...] │
└──────────────────────────────────────────────────────────────────────────────┘Left Section:
- Salesforce cloud logo
- "[CLOUD NAME] Overview" in dark background
Center Section - ENTITIES:
- Cloud Entity (dark border + light fill)
- Related Entity (dark border + light fill)
- External Entity (black border + white fill)
Right Section - RELATIONSHIPS:
- Parent to Child (Many-to-One)
- Required to Required (One-to-One)
- Optional to Optional (Zero-or-One to Zero-or-One)
- Many-to-Many
3. Main Diagram Area
The ERD with objects and relationship lines.
4. Footer
┌──────────────────────────────────────────────────────────────────────────────┐
│ ©2024 Salesforce - Subject to change without notice Last modified: [DATE]│
└──────────────────────────────────────────────────────────────────────────────┘---
Entity Box Format
Each object box contains:
┌─────────────────────────┐
│ Opportunity │ ← Bold logical name (larger font)
│ Opportunity │ ← API name (smaller, italic, gray)
│ • Name │ ← Key field 1 with bullet
│ • Amount │ ← Key field 2 with bullet
│ • Close Date │ ← Key field 3 with bullet
│ • StageName │ ← Key field 4 (optional)
└─────────────────────────┘Recommended Fields by Object
| Object | Key Fields |
|---|---|
| Account | Account Number, Name, Industry, Type |
| Contact | Name, Email, Title, Phone |
| Lead | Name, Company, Status, Rating |
| Opportunity | Name, Amount, Close Date, StageName |
| Campaign | Name, Type, Status, StartDate |
| Case | CaseNumber, Type, Priority, Status |
| Quote | Name, ExpirationDate, Status |
| Order | OrderNumber, EffectiveDate, Status |
| Product2 | Name, ProductCode, IsActive |
---
Relationship Line Labels
Always include descriptive text labels on relationship lines.
| Relationship Type | Label Examples |
|---|---|
| Parent-Child | "child of", "parent of" |
| Lookup | "related to" |
| Junction | "member of", "participant in" |
| Conversion | "converts to", "promoted to" |
| Association | "assigned to", "owned by" |
Line Styling
| Property | Value |
|---|---|
| Stroke width | 1-2px |
| Color | Black (#000000) |
| Direction | Straight horizontal or vertical only (NO diagonals) |
| Crow's foot | On "many" side of relationship |
| Bar | On "one" side (required) |
| Circle + Bar | On "one" side (optional) |
---
Master Prompt Template
Use this template when generating ERDs:
Create a Salesforce [CLOUD_NAME] ERD in the EXACT architect.salesforce.com style:
PAGE TITLE (very top, large bold text):
'[Cloud Name] Overview Data Model'
HEADER SECTION (below title):
- Left: Salesforce cloud logo + '[CLOUD_NAME] Overview' in dark [COLOR] (#[HEX]) banner box
- Center: LEGEND with 'ENTITIES' section showing:
* Cloud Entity box (dark [COLOR] border, light [COLOR] ~25% opacity fill)
* Related Entity box (dark border, lighter fill)
* External Entity box (black border, white fill)
- Right: 'RELATIONSHIPS' section showing notation symbols
BOX STYLING - CRITICAL:
- DARK BORDER: Solid 2px border in dark [COLOR] (#[HEX])
- LIGHT TRANSLUCENT FILL: Same [COLOR] hue at ~25% opacity
- Rounded corners (8-12px radius)
- Text in dark gray/black on the light fill
ENTITY BOX FORMAT:
┌─────────────────────────┐
│ Logical Name │ (Bold, larger)
│ APIName │ (Smaller, italic, gray)
│ • Field1 │ (Bullet points)
│ • Field2 │
└─────────────────────────┘
OBJECTS TO INCLUDE:
[List objects with their fields]
RELATIONSHIP LINES:
- Thin black lines with text labels ON the lines
- 'child of' / 'parent of' / 'related to' labels
- Crow's foot on many side, bar on one side
- STRAIGHT LINES ONLY (horizontal and vertical)
FOOTER:
Left: '©[YEAR] Salesforce - Subject to change without notice'
Right: 'Last modified: [DATE]'
CRITICAL: Dark [COLOR] borders with LIGHT translucent [COLOR] fill.---
Cloud-Specific Templates
Sales Cloud
COLOR: Teal #0B827C
OBJECTS: Lead, Account, Contact, Opportunity, Campaign, CampaignMember,
Quote, Order, Product2, PricebookEntry, TerritoryService Cloud
COLOR: Magenta #9E2A7D
OBJECTS: Case, Knowledge, KnowledgeArticle, Entitlement, Asset,
ServiceContract, WorkOrder, Swarm, Incident, ProblemPlatform (Generic)
COLOR: Purple #5A67D8
OBJECTS: Account, Contact, User, Custom Objects---
Quick Reference Checklist
ARCHITECT.SALESFORCE.COM ERD CHECKLIST
═══════════════════════════════════════
☐ Page title at very top ("[Cloud] Overview Data Model")
☐ Header banner with Salesforce logo + "[CLOUD] Overview"
☐ Legend bar (ENTITIES + RELATIONSHIPS sections)
☐ DARK border in cloud's brand color
☐ LIGHT translucent fill (~25% opacity)
☐ Entity boxes: Name + API Name + bullet fields
☐ Labeled relationship lines ("child of", "related to")
☐ Crow's foot notation for many-side
☐ Straight lines only (no diagonals)
☐ Footer with copyright + last modified date
☐ Clean white background---
Version History
| Version | Changes |
|---|---|
| 1.0 | Initial version with Sales Cloud, Service Cloud, Platform styles |
<!-- Parent: generating-visual-diagrams/SKILL.md -->
Examples
Example prompts and outputs for generating-visual-diagrams.
ERD Examples
# Basic CRM ERD
gemini --yolo "/generate 'Salesforce ERD diagram: Account (blue), Contact (green), Opportunity (yellow). Show relationships with arrows. Clean white background.'"
# Custom Object ERD
gemini --yolo "/generate 'ERD diagram for custom objects: Project__c, Task__c, Resource__c. Master-detail and lookup relationships shown.'"LWC Mockup Examples
# Data Table Mockup
gemini --yolo "/generate 'Lightning datatable mockup showing Account records with columns: Name, Industry, Annual Revenue. Include search bar and pagination.'"
# Record Form Mockup
gemini --yolo "/generate 'Salesforce Lightning record form for Contact object. Show Name, Email, Phone, Account lookup fields.'"Architecture Examples
# Integration Flow
gemini --yolo "/generate 'Integration architecture diagram: Salesforce to ERP sync via MuleSoft. Show Platform Events, Named Credentials, External Services.'"Output Location
Generated images are saved to ~/nanobanana-output/
<!-- Parent: generating-visual-diagrams/SKILL.md -->
Gemini CLI Setup for generating-visual-diagrams
Prerequisites
1. Authenticate with Google
# Start Gemini CLI - opens browser for OAuth
gemini
# Select "Login with Google" when prompted
# Credentials cached at ~/.gemini/oauth_creds.json2. Install Nano Banana Extension
gemini extensions install nanobanana3. Install timg for Image Display
brew install timg4. Configure Environment
Add to ~/.zshrc:
export NANOBANANA_MODEL=gemini-3-pro-image-preview
export PATH="$HOME/.local/bin:$PATH"---
Verification
# Check Gemini CLI
gemini --version
# Check Nano Banana
gemini extensions list
# Check timg
which timg
# Test image generation
gemini "/generate 'A blue circle on white background'"
timg ~/gemini-images/*.png---
File Locations
| File | Purpose |
|---|---|
~/.gemini/settings.json | Gemini CLI settings |
~/.gemini/oauth_creds.json | OAuth tokens |
~/.gemini/extensions/nanobanana/ | Nano Banana extension |
~/gemini-images/ | Generated images |
<!-- Parent: generating-visual-diagrams/SKILL.md -->
Interview Questions Reference
This document defines the questions Claude should ask (via AskUserQuestion) before generating images with generating-visual-diagrams.
---
How to Use This Reference
When a user requests an image, Claude should:
1. Detect image type from the request 2. Find the matching question set below 3. Invoke AskUserQuestion with those questions 4. Build prompt using the answers 5. Generate image with optimized parameters
Skip Interview Triggers
Skip questions and use defaults when user says:
- "quick" - e.g., "Quick ERD of Account-Contact"
- "simple" - e.g., "Simple LWC mockup"
- "just generate" - e.g., "Just generate an architecture diagram"
- "fast" - e.g., "Fast ERD draft"
---
ERD Diagram Questions
When to Use
User mentions: ERD, entity relationship, data model, object relationships, schema diagram
Questions
{
"questions": [
{
"question": "Which objects should be included in the ERD?",
"header": "Objects",
"multiSelect": false,
"options": [
{
"label": "Core CRM (Recommended)",
"description": "Account, Contact, Opportunity, Case - standard sales/service objects"
},
{
"label": "Sales Cloud",
"description": "Lead, Campaign, Quote, Order, PriceBook, Product"
},
{
"label": "Service Cloud",
"description": "Case, Knowledge, Entitlement, Asset, ServiceContract"
},
{
"label": "Custom objects",
"description": "I'll specify the custom objects to include"
}
]
},
{
"question": "What visual style do you prefer?",
"header": "Style",
"multiSelect": false,
"options": [
{
"label": "Architect.salesforce.com (Recommended)",
"description": "Official Salesforce style: dark border + light fill, header banner, legend bar"
},
{
"label": "Whiteboard",
"description": "Hand-drawn look, casual feel for brainstorming"
},
{
"label": "Technical",
"description": "Detailed with field names and data types"
},
{
"label": "Minimalist",
"description": "Simple boxes, focus on relationships only"
}
]
},
{
"question": "What's the primary purpose of this ERD?",
"header": "Purpose",
"multiSelect": false,
"options": [
{
"label": "Documentation (4K)",
"description": "High quality for wikis, docs, long-term reference"
},
{
"label": "Quick draft (1K)",
"description": "Fast iteration, refine the prompt first"
},
{
"label": "Presentation",
"description": "Slides for stakeholders, clean and simple"
},
{
"label": "Architecture review",
"description": "Technical discussion with developers/architects"
}
]
},
{
"question": "Any special requirements? (Select all that apply)",
"header": "Extras",
"multiSelect": true,
"options": [
{
"label": "Include legend",
"description": "Add a legend explaining colors and relationship types"
},
{
"label": "Show field names",
"description": "Display key fields inside each object box"
},
{
"label": "Color-code by type",
"description": "Standard=blue, Custom=orange, External=green"
},
{
"label": "None",
"description": "Use default styling without extras"
}
]
}
]
}Answer-to-Prompt Mapping
| Answer | Prompt Addition |
|---|---|
| Core CRM | "Account, Contact, Opportunity, Case with standard relationships" |
| Sales Cloud | "Lead, Campaign, Quote, Order, PriceBook, Product with conversion flows" |
| Service Cloud | "Case, Knowledge, Entitlement, Asset, ServiceContract hierarchy" |
| Architect.salesforce.com | "Official architect.salesforce.com style: page title, header banner with Salesforce logo, LEGEND bar (ENTITIES + RELATIONSHIPS), dark border + light translucent fill boxes (~25% opacity), labeled relationship lines, footer with copyright" |
| Whiteboard | "Hand-drawn sketch style, informal, whiteboard aesthetic" |
| Technical | "Include field names, data types, API names in each box" |
| Documentation (4K) | Use Python script with -r 4K, include full header + legend |
| Quick draft (1K) | Use CLI or Python with -r 1K |
| Include legend | "Include LEGEND bar at top with ENTITIES and RELATIONSHIPS sections" |
| Color-code | "Auto-detect cloud color: Sales=Teal #0B827C, Service=Magenta #9E2A7D, Platform=Purple #5A67D8" |
Default Values (for Skip Mode)
- Objects: Core CRM
- Style: Architect.salesforce.com
- Purpose: Quick draft (1K)
- Extras: Include legend
---
LWC Component Mockup Questions
When to Use
User mentions: LWC, Lightning Web Component, component mockup, wireframe, UI mockup, form, table, card
Questions
{
"questions": [
{
"question": "What type of component do you need?",
"header": "Component",
"multiSelect": false,
"options": [
{
"label": "Data table (Recommended)",
"description": "List view with columns, sorting, row actions"
},
{
"label": "Record form",
"description": "Create/edit form with fields and sections"
},
{
"label": "Dashboard card",
"description": "Metrics, charts, or KPI tiles"
},
{
"label": "Custom layout",
"description": "I'll describe the specific layout needed"
}
]
},
{
"question": "Which Salesforce object is this for?",
"header": "Object",
"multiSelect": false,
"options": [
{
"label": "Account",
"description": "Customer/company records"
},
{
"label": "Contact",
"description": "Individual person records"
},
{
"label": "Opportunity",
"description": "Sales deals and pipeline"
},
{
"label": "Custom object",
"description": "I'll specify the object name"
}
]
},
{
"question": "Where will this component be used?",
"header": "Context",
"multiSelect": false,
"options": [
{
"label": "Lightning Record Page (Recommended)",
"description": "Embedded on Account, Contact, etc. detail pages"
},
{
"label": "Lightning App Page",
"description": "Home page, dashboard, or custom app"
},
{
"label": "Experience Cloud",
"description": "Customer/partner portal (community)"
},
{
"label": "Standalone app",
"description": "Full-page Lightning app or utility bar"
}
]
},
{
"question": "Style preferences? (Select all that apply)",
"header": "Style",
"multiSelect": true,
"options": [
{
"label": "SLDS standard",
"description": "Standard Lightning Design System styling"
},
{
"label": "Dense/compact",
"description": "Reduced spacing for data-heavy views"
},
{
"label": "Mobile-responsive",
"description": "Adapts to mobile screen sizes"
},
{
"label": "Card-based",
"description": "Elevated card container with shadow"
}
]
}
]
}Answer-to-Prompt Mapping
| Answer | Prompt Addition |
|---|---|
| Data table | "Lightning datatable with columns, header with search, row actions menu" |
| Record form | "Lightning record form with sections, field labels, Save/Cancel buttons" |
| Dashboard card | "SLDS card component with metric value, label, trend indicator" |
| Lightning Record Page | "Component sized for record page sidebar or main content" |
| Experience Cloud | "Portal-friendly styling, user-facing design" |
| Dense/compact | "Compact spacing, reduced padding, data-dense layout" |
| Mobile-responsive | "Responsive design, single column on mobile" |
Default Values (for Skip Mode)
- Component: Data table
- Object: Account
- Context: Lightning Record Page
- Style: SLDS standard
---
Architecture/Integration Diagram Questions
When to Use
User mentions: architecture, integration, system diagram, data flow, API flow, authentication flow
Questions
{
"questions": [
{
"question": "What type of diagram do you need?",
"header": "Diagram",
"multiSelect": false,
"options": [
{
"label": "Integration flow (Recommended)",
"description": "System-to-system data synchronization"
},
{
"label": "Data flow",
"description": "Entity movement between systems"
},
{
"label": "Authentication flow",
"description": "OAuth, JWT, SSO sequence diagram"
},
{
"label": "Event-driven",
"description": "Platform Events, CDC, pub/sub architecture"
}
]
},
{
"question": "Which systems are involved?",
"header": "Systems",
"multiSelect": false,
"options": [
{
"label": "Salesforce + ERP",
"description": "SAP, Oracle, NetSuite, Microsoft Dynamics"
},
{
"label": "Salesforce + Marketing",
"description": "Marketo, Pardot, HubSpot, Marketing Cloud"
},
{
"label": "Salesforce + Custom APIs",
"description": "Internal services, microservices, legacy systems"
},
{
"label": "Multiple systems",
"description": "I'll specify the systems involved"
}
]
},
{
"question": "What protocols/patterns are used? (Select all that apply)",
"header": "Protocols",
"multiSelect": true,
"options": [
{
"label": "REST APIs",
"description": "JSON over HTTP, most common pattern"
},
{
"label": "Platform Events / CDC",
"description": "Salesforce event-driven integration"
},
{
"label": "MuleSoft / iPaaS",
"description": "Integration platform as middleware"
},
{
"label": "SOAP / Legacy",
"description": "XML-based, enterprise protocols"
}
]
},
{
"question": "What elements should be highlighted? (Select all that apply)",
"header": "Elements",
"multiSelect": true,
"options": [
{
"label": "Auth badges",
"description": "Show OAuth 2.0, JWT, API Key on connections"
},
{
"label": "Error handling",
"description": "Retry logic, dead letter queues, fallbacks"
},
{
"label": "Data transforms",
"description": "Mapping, conversion, enrichment steps"
},
{
"label": "Timing/frequency",
"description": "Sync intervals, batch schedules"
}
]
}
]
}Answer-to-Prompt Mapping
| Answer | Prompt Addition |
|---|---|
| Integration flow | "System integration diagram with bidirectional data flow arrows" |
| Authentication flow | "OAuth 2.0 sequence diagram with token exchange steps" |
| Salesforce + ERP | "Salesforce (cloud icon) connected to ERP (server icon)" |
| REST APIs | "REST/JSON labels on connection arrows" |
| Platform Events | "Platform Events pub/sub with event bus in center" |
| Auth badges | "OAuth 2.0 / JWT badges on integration arrows" |
| Error handling | "Error queue and retry logic shown as separate path" |
Default Values (for Skip Mode)
- Diagram: Integration flow
- Systems: Salesforce + Custom APIs
- Protocols: REST APIs
- Elements: Auth badges
---
Code Review Questions (Gemini Sub-Agent)
When to Use
User mentions: review, code review, check my code, analyze, audit, best practices
Questions for Apex Review
{
"questions": [
{
"question": "What type of Apex code is this?",
"header": "Code Type",
"multiSelect": false,
"options": [
{
"label": "Trigger",
"description": "Before/after trigger on an object"
},
{
"label": "Batch job",
"description": "Batch Apex for large data processing"
},
{
"label": "Service class",
"description": "Business logic, utility, or helper class"
},
{
"label": "Controller",
"description": "Aura/LWC controller or VF controller"
}
]
},
{
"question": "What should the review focus on?",
"header": "Focus",
"multiSelect": true,
"options": [
{
"label": "Bulkification",
"description": "SOQL/DML in loops, governor limits"
},
{
"label": "Security",
"description": "CRUD/FLS checks, injection vulnerabilities"
},
{
"label": "Performance",
"description": "Query optimization, caching, efficiency"
},
{
"label": "Best practices",
"description": "Naming, structure, patterns, testability"
}
]
}
]
}---
Quick Reference Card
| Image Type | Trigger Keywords | Questions |
|---|---|---|
| ERD | ERD, entity, data model, schema | Objects, Style, Purpose, Extras |
| LWC Mockup | LWC, component, mockup, wireframe | Component, Object, Context, Style |
| Architecture | architecture, integration, flow | Diagram, Systems, Protocols, Elements |
| Code Review | review, analyze, check, audit | Code Type, Focus |
---
Example: Full Interview Flow
User Says
"I need an ERD for my Service Cloud implementation"
Claude Invokes AskUserQuestion
Objects: Core CRM / Sales Cloud / Service Cloud / Custom
Style: Professional / Whiteboard / Technical / Minimalist
Purpose: Documentation / Quick draft / Presentation / Review
Extras: Legend / Field names / Color-code / NoneUser Selects
- Objects: Service Cloud
- Style: Professional
- Purpose: Documentation
- Extras: Legend, Color-code
Claude Builds Prompt
Professional Salesforce ERD diagram showing Service Cloud objects:
- Case (blue, center): Main service object
- Knowledge (green, right): Linked articles
- Entitlement (yellow, left): Service level agreements
- Asset (orange, below): Customer-owned products
- ServiceContract (purple, top): Contract management
Relationships:
- Case → Knowledge (Lookup, dashed arrow)
- Case → Asset (Lookup, dashed arrow)
- Asset → ServiceContract (Master-Detail, solid arrow)
Color coding: Standard objects (blue), Service objects (green/yellow)
Include legend in bottom-right corner.
Clean white background, SLDS styling.Claude Generates
uv run scripts/generate_image.py \
-p "[prompt above]" \
-f "service-cloud-erd.png" \
-r 4K<!-- Parent: generating-visual-diagrams/SKILL.md -->
Iteration Workflow: Draft → Final
Best practices for cost-effective image generation with generating-visual-diagrams.
Why Iterate at Low Resolution?
| Resolution | Time | API Cost | Use Case |
|---|---|---|---|
| 1K | ~3s | $ | Drafts, prompt refinement, layout testing |
| 2K | ~5s | $$ | Medium quality, quick presentations |
| 4K | ~10s | $$$ | Production, documentation, final deliverables |
Key Insight: Get the prompt right at 1K before spending on 4K generation.
---
The Workflow
┌─────────────────────────────────────────────────────────────┐
│ DRAFT PHASE (1K) │
│ │
│ 1. Generate initial image with CLI │
│ gemini --yolo "/generate 'Your prompt...'" │
│ │
│ 2. Review in Preview │
│ open ~/nanobanana-output/*.png │
│ │
│ 3. Is the layout correct? ─────────────────┐ │
│ │ │ │
│ ▼ No ▼ Yes │
│ Refine prompt or use /edit Continue │
│ └──────────────────────────────────────►│ │
└─────────────────────────────────────────────┼───────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ FINAL PHASE (4K) │
│ │
│ 4. Generate production quality with Python script │
│ uv run scripts/generate_image.py \ │
│ -p "Your refined prompt" \ │
│ -f "final-output.png" \ │
│ -r 4K │
│ │
│ 5. Open and use │
│ open ~/nanobanana-output/*final-output*.png │
└─────────────────────────────────────────────────────────────┘---
Common Iteration Patterns
Pattern 1: Prompt Refinement
# Attempt 1: Too generic
gemini --yolo "/generate 'Account ERD'"
# Result: Missing relationships, wrong colors
# Attempt 2: Add specifics
gemini --yolo "/generate 'Account ERD with Contact and Opportunity, blue boxes'"
# Result: Better, but legend missing
# Attempt 3: Add styling details
gemini --yolo "/generate 'Salesforce ERD: Account (blue, center), Contact (green),
Opportunity (yellow). Master-detail = thick arrow. Lookup = dashed. Include legend.'"
# Result: Perfect layout!
# Final: Generate at 4K
uv run scripts/generate_image.py \
-p "Salesforce ERD: Account (blue, center)..." \
-f "crm-erd-final.png" \
-r 4KPattern 2: Edit-Based Iteration
# Start with basic ERD
gemini --yolo "/generate 'Account-Contact ERD'"
# Edit to add more objects
gemini --yolo "/edit 'Add Opportunity linked to Account with master-detail'"
# Edit to improve styling
gemini --yolo "/edit 'Add legend, use Salesforce Lightning blue (#0176D3)'"
# Final at 4K
uv run scripts/generate_image.py \
-p "Account-Contact-Opportunity ERD with legend, SLDS colors" \
-f "final-erd.png" \
-r 4KPattern 3: Python Script for Editing
# Generate at 1K
uv run scripts/generate_image.py \
-p "Dashboard mockup with charts" \
-f "dashboard-v1.png"
# Edit with resolution control
uv run scripts/generate_image.py \
-p "Add a KPI summary bar at the top" \
-i ~/nanobanana-output/*dashboard-v1*.png \
-f "dashboard-v2.png" \
-r 2K
# Final version
uv run scripts/generate_image.py \
-p "Polish: add subtle shadows, round corners on cards" \
-i ~/nanobanana-output/*dashboard-v2*.png \
-f "dashboard-final.png" \
-r 4K---
Timestamp Filenames
The Python script automatically adds timestamps for easy versioning:
~/nanobanana-output/
├── 2026-01-13-10-30-15-erd-v1.png # First attempt
├── 2026-01-13-10-32-45-erd-v2.png # After edit
├── 2026-01-13-10-35-00-erd-final.png # Production 4KTip: Use descriptive filenames like crm-erd.png - the timestamp is auto-prepended.
---
When to Use Each Method
| Method | Best For |
|---|---|
| CLI (`gemini --yolo`) | Quick drafts, simple edits, style exploration |
| CLI `/edit` | Iterative refinements of existing images |
| Python script | 4K output, precise resolution control, automated workflows |
---
Cost Optimization Tips
1. Never generate 4K on first attempt - always draft at 1K first 2. Use `/edit` for small changes - cheaper than regenerating 3. Batch similar requests - get all ERDs right before final generation 4. Save working prompts - reuse successful prompt patterns 5. Use `--seed` for reproducibility - same seed = similar output
---
Troubleshooting
Image doesn't match prompt
- Add more specific details (colors, positions, relationships)
- Use SLDS color codes:
#0176D3(blue),#04844B(green),#FFB75D(yellow) - Specify layout: "center", "top-right", "below parent"
Edit not applying correctly
- Be specific about what to change
- Reference existing elements: "Move the Account box to center"
- One change at a time for precision
4K output looks different from 1K draft
- Use exact same prompt text
- Consider using
--seedfor consistency - Minor variations are normal due to model behavior
#!/bin/bash
# check-prerequisites.sh - Verify generating-visual-diagrams requirements before use
# Returns 0 if all required checks pass, 1 if any required fail
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
GRAY='\033[0;90m'
NC='\033[0m'
ERRORS=0
WARNINGS=0
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE} 📸 SF-IMAGEN PREREQUISITES CHECK${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e "${GRAY} REQUIRED:${NC}"
# Check 1: macOS (required for Preview app)
echo -n " Checking macOS (for Preview app)... "
if [[ "$OSTYPE" == "darwin"* ]]; then
echo -e "${GREEN}✓ macOS detected${NC}"
else
echo -e "${RED}✗ Not macOS${NC}"
echo -e " ${YELLOW}→ generating-visual-diagrams uses macOS Preview app for image display${NC}"
echo -e " ${YELLOW}→ Current OS: $OSTYPE${NC}"
ERRORS=$((ERRORS + 1))
fi
# Check 2: Gemini API Key
echo -n " Checking GEMINI_API_KEY... "
if [[ -n "$GEMINI_API_KEY" ]]; then
# Mask the key for display
MASKED_KEY="${GEMINI_API_KEY:0:10}...${GEMINI_API_KEY: -4}"
echo -e "${GREEN}✓ Set ($MASKED_KEY)${NC}"
else
echo -e "${RED}✗ Not set${NC}"
echo -e " ${YELLOW}→ Nano Banana Pro requires a personal API key${NC}"
echo -e " ${YELLOW}→ Get one at: https://aistudio.google.com/apikey${NC}"
echo -e " ${YELLOW}→ Add to ~/.zshrc: export GEMINI_API_KEY=\"your-key\"${NC}"
ERRORS=$((ERRORS + 1))
fi
# Check 3: Gemini CLI
echo -n " Checking Gemini CLI... "
if command -v gemini &> /dev/null; then
GEMINI_VERSION=$(gemini --version 2>/dev/null | head -1 || echo "installed")
echo -e "${GREEN}✓ $GEMINI_VERSION${NC}"
else
echo -e "${RED}✗ Not installed${NC}"
echo -e " ${YELLOW}→ Install: npm install -g @google/gemini-cli${NC}"
ERRORS=$((ERRORS + 1))
fi
# Check 4: Nano Banana Extension
echo -n " Checking Nano Banana extension... "
if gemini extensions list 2>/dev/null | grep -q "nanobanana"; then
echo -e "${GREEN}✓ Installed${NC}"
else
echo -e "${RED}✗ Not installed${NC}"
echo -e " ${YELLOW}→ Install: gemini extensions install nanobanana${NC}"
ERRORS=$((ERRORS + 1))
fi
echo ""
echo -e "${GRAY} OPTIONAL (for 4K/editing via Python script):${NC}"
# Check 5: uv (optional, for Python script)
echo -n " Checking uv (Python runner)... "
if command -v uv &> /dev/null; then
UV_VERSION=$(uv --version 2>&1 | head -1)
echo -e "${GREEN}✓ $UV_VERSION${NC}"
else
echo -e "${YELLOW}○ Not installed (optional)${NC}"
echo -e " ${GRAY}→ For 4K resolution/editing: curl -LsSf https://astral.sh/uv/install.sh | sh${NC}"
WARNINGS=$((WARNINGS + 1))
fi
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if [[ $ERRORS -eq 0 ]]; then
if [[ $WARNINGS -gt 0 ]]; then
echo -e " ${GREEN}✅ All required prerequisites met!${NC}"
echo -e " ${YELLOW}⚠️ $WARNINGS optional feature(s) unavailable${NC}"
else
echo -e " ${GREEN}✅ All prerequisites met! generating-visual-diagrams is ready to use.${NC}"
fi
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
exit 0
else
echo -e " ${RED}❌ $ERRORS required prerequisite(s) missing.${NC}"
echo -e " ${RED} Please fix before using generating-visual-diagrams.${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
exit 1
fi
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["google-genai>=1.0.0", "pillow>=10.0.0"]
# ///
"""
Direct Gemini API image generation with resolution control.
This script complements the CLI extension for power features:
- Resolution control: 1K (draft), 2K (medium), 4K (production)
- Image editing: Modify existing images with natural language
- Timestamp filenames: Automatic versioning for iteration tracking
Usage:
# Generate new image at 1K (draft)
uv run scripts/generate_image.py -p "Salesforce ERD diagram..." -f "account-erd.png"
# Generate at 4K (production)
uv run scripts/generate_image.py -p "Salesforce ERD diagram..." -f "account-erd.png" -r 4K
# Edit existing image
uv run scripts/generate_image.py -p "Add a legend in bottom right" -i input.png -f "output.png"
Workflow: Draft → Iterate → Final
1. Generate at 1K for quick feedback (~3s)
2. Refine prompt until layout/content is correct
3. Generate final at 4K for production quality (~10s)
License: MIT
"""
import argparse
import os
import subprocess
import sys
from datetime import datetime
from io import BytesIO
from pathlib import Path
try:
from google import genai
from google.genai import types
from PIL import Image
except ImportError as e:
print(f"Error: Missing dependency - {e}")
print("Run with: uv run scripts/generate_image.py ...")
sys.exit(1)
# Resolution mapping (uppercase K required by API!)
RESOLUTIONS = {
"1K": "1K", # ~1024px - drafts, fast iteration
"2K": "2K", # ~2048px - medium quality
"4K": "4K", # ~4096px - production quality
}
# Default output directory (matches CLI extension)
OUTPUT_DIR = Path.home() / "nanobanana-output"
def get_auto_resolution(image_path: str) -> str:
"""Auto-detect resolution based on input image dimensions."""
try:
with Image.open(image_path) as img:
max_dim = max(img.width, img.height)
if max_dim < 1500:
return "1K"
elif max_dim < 3000:
return "2K"
else:
return "4K"
except Exception:
return "1K"
def generate_image(
prompt: str,
filename: str,
resolution: str = "1K",
input_image: str | None = None,
api_key: str | None = None,
aspect_ratio: str | None = None,
) -> str:
"""Generate or edit an image using Gemini 3 Pro Image API.
Args:
prompt: Text description for generation or editing instruction
filename: Output filename (timestamp will be prepended)
resolution: Output resolution - 1K, 2K, or 4K (uppercase required!)
input_image: Path to existing image for editing (optional)
api_key: Gemini API key (falls back to GEMINI_API_KEY env var)
aspect_ratio: Aspect ratio like "16:9", "1:1", "4:3" (optional)
Returns:
Path to saved image file
"""
# Get API key
api_key = api_key or os.environ.get("GEMINI_API_KEY")
if not api_key:
raise ValueError(
"GEMINI_API_KEY not found. Set it in ~/.zshrc or pass via --api-key"
)
# Initialize client
client = genai.Client(api_key=api_key)
# Build contents (image first if editing, then prompt)
contents = []
if input_image:
img = Image.open(input_image)
# Convert RGBA to RGB if needed
if img.mode == "RGBA":
background = Image.new("RGB", img.size, (255, 255, 255))
background.paste(img, mask=img.split()[3])
img = background
contents.append(img)
# Auto-detect resolution for editing if not specified
if resolution == "1K":
resolution = get_auto_resolution(input_image)
print(f"Auto-detected resolution: {resolution}")
contents.append(prompt)
# Build image config
image_config_kwargs = {"image_size": RESOLUTIONS[resolution]}
if aspect_ratio:
image_config_kwargs["aspect_ratio"] = aspect_ratio
# Generate with resolution config
print(f"Generating at {resolution} resolution...")
response = client.models.generate_content(
model="gemini-3-pro-image-preview",
contents=contents,
config=types.GenerateContentConfig(
response_modalities=["IMAGE", "TEXT"],
image_config=types.ImageConfig(**image_config_kwargs),
),
)
# Save output with timestamp filename
OUTPUT_DIR.mkdir(exist_ok=True)
timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
# Clean filename (remove extension if present, we'll add .png)
clean_name = Path(filename).stem
output_filename = f"{timestamp}-{clean_name}.png"
output_path = OUTPUT_DIR / output_filename
# Extract and save image from response
for part in response.candidates[0].content.parts:
if hasattr(part, "inline_data") and part.inline_data:
img = Image.open(BytesIO(part.inline_data.data))
# Convert to RGB if needed
if img.mode == "RGBA":
background = Image.new("RGB", img.size, (255, 255, 255))
background.paste(img, mask=img.split()[3])
img = background
img.save(output_path, "PNG")
return str(output_path)
raise RuntimeError("No image data in response")
def main():
parser = argparse.ArgumentParser(
description="Generate images with Gemini 3 Pro Image API",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
# Draft (fast, cheap)
uv run generate_image.py -p "Account ERD diagram" -f "account-erd.png"
# Production (4K)
uv run generate_image.py -p "Account ERD diagram" -f "account-erd.png" -r 4K
# Edit existing image
uv run generate_image.py -p "Add legend" -i prev.png -f "updated.png"
# With aspect ratio
uv run generate_image.py -p "Dashboard mockup" -f "dash.png" -a "16:9"
""",
)
parser.add_argument(
"-p", "--prompt",
required=True,
help="Image description or editing instruction",
)
parser.add_argument(
"-f", "--filename",
required=True,
help="Output filename (timestamp auto-prepended)",
)
parser.add_argument(
"-r", "--resolution",
choices=["1K", "2K", "4K"],
default="1K",
help="Output resolution (default: 1K for drafts)",
)
parser.add_argument(
"-i", "--input-image",
help="Path to existing image for editing",
)
parser.add_argument(
"-k", "--api-key",
help="Gemini API key (defaults to GEMINI_API_KEY env var)",
)
parser.add_argument(
"-a", "--aspect-ratio",
help="Aspect ratio (e.g., '16:9', '1:1', '4:3')",
)
parser.add_argument(
"--no-open",
action="store_true",
help="Don't auto-open the image in Preview after generation",
)
args = parser.parse_args()
try:
output_path = generate_image(
prompt=args.prompt,
filename=args.filename,
resolution=args.resolution,
input_image=args.input_image,
api_key=args.api_key,
aspect_ratio=args.aspect_ratio,
)
print(f"✅ Saved: {output_path}")
# Auto-open in macOS Preview unless --no-open is specified
if not args.no_open:
subprocess.run(["open", output_path], check=False)
print(f" 📸 Opened in Preview")
else:
print(f" Open with: open {output_path}")
except Exception as e:
print(f"❌ Error: {e}")
sys.exit(1)
if __name__ == "__main__":
main()
Related skills
Forks & variants (1)
Generating Visual Diagrams has 1 known copy in the catalog totaling 531 installs. They canonicalize to this original listing.
- forcedotcom - 531 installs
How it compares
Use this over generic diagram skills when documenting Salesforce-centric integration flows with OAuth, middleware, and protocol-labeled connectors.
FAQ
When should I use quick mode?
Quick mode triggers on words like quick or just generate and defaults to professional 1K draft with legend included.
What if gemini --yolo returns no image?
Re-run once; if it fails again, fall back to the Python generate_image.py script path.
Who owns object metadata discovery for ERDs?
Delegate metadata discovery to generating-custom-object or generating-custom-field before building the visual prompt.
Is Generating Visual Diagrams safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.