Use when the user needs computer science, electronics, algorithms, or general engineering paper figures with Gemini or Nano Banana image models, or when they need exact publication-style plots rendered from numeric data. Prefer this skill for system architecture figures, algorithm workflows, pipeline diagrams, hardware block diagrams, circuit-level schematics, benchmark charts, ablation plots, scatter or heatmap panels, figure redrawing, and image editing through a Gemini-compatible endpoint.
This skill adapts the Nano Banana or Gemini image workflow to computer science, electronics, algorithms, and engineering-paper figures.
Use this skill for the figure-production layer after the figure goal is already reasonably clear.
image mode and plot mode, build prompts, render plots, and apply figure-language, layout, color, and export constraints.ai-research-writing-guide first.figure goal, figure type, panel plan or module list, , , , and .must-keep termscaption or messagepaper languagevisual style constraintsIt should be treated as a provider-neutral workflow for Gemini-compatible image endpoints:
Use two modes:
image mode
Use Gemini-compatible image generation or editing for conceptual figures, architecture diagrams, workflow schematics, graphical abstracts, and style-matched redraws.plot mode
Use the bundled Python plotting tool for exact publication-style bar charts, trend curves, heatmaps, scatter plots, and multi-panel quantitative figures.Rule of thumb:
plot mode.image mode.NANOBANANA_DEFAULT_MODEL as the normal model for routine generation.NANOBANANA_HIGHRES_MODEL only when the user explicitly asks for higher resolution, final-export quality, or specifically mentions 2k.NANOBANANA_HIGHRES_MODEL when the request clearly indicates high-resolution output, while keeping the normal default for routine runs.pro-2k, 2K, higher-resolution, or final-export quality and that high-resolution path fails, stop immediately instead of silently falling back to a cheaper or lower-tier model.--model override is still allowed.Set environment variables before image generation:
export NANOBANANA_API_KEY="your-provider-key"
export NANOBANANA_BASE_URL="https://generativelanguage.googleapis.com"
export NANOBANANA_MODEL="gemini-3.1-flash-image-preview"
This customized setup should prefer local secrets files over repeatedly hand-typing keys.
Default local files:
C:/Users/<user>/.codex/secrets/nanobanana.envC:/Users/<user>/.codex/secrets/nanobanana_api_key.txtExpected behavior:
NANOBANANA_* variables are already present, use them directly.PowerShell bootstrap in the same shell session:
. "$HOME/.codex/skills/engineering-figure-banana/scripts/load_nanobanana_env.ps1"
After that, run the normal generate_image.py command in the same PowerShell session.
The local secrets files should contain:
nanobanana.env
NANOBANANA_BASE_URL=https://generativelanguage.googleapis.comNANOBANANA_DEFAULT_MODEL=gemini-3.1-flash-image-previewNANOBANANA_AUTH_MODE=googleNANOBANANA_BASE_URL=https://your-relay.example.comNANOBANANA_DEFAULT_MODEL=<your-default-image-model>NANOBANANA_HIGHRES_MODEL=<your-highres-image-model>NANOBANANA_AUTH_MODE=bearerNANOBANANA_ALLOW_THIRD_PARTY=1NANOBANANA_API_KEY_FILE=.../nanobanana_api_key.txtnanobanana_api_key.txt
Do not store the real API key inside SKILL.md. Keep it only in the local key file.
For New API style relays that use Authorization: Bearer ..., also set:
export NANOBANANA_AUTH_MODE="bearer"
Recommended model configuration for this customized setup:
export NANOBANANA_DEFAULT_MODEL="<your-default-image-model>"
export NANOBANANA_HIGHRES_MODEL="<your-highres-image-model>"
Provider note:
If you do not want the API key to appear in shell history, prefer:
export NANOBANANA_API_KEY_FILE="$PWD/.secrets/nanobanana_api_key"
Generate a conceptual engineering figure:
python3 scripts/generate_image.py \
--figure-template system-architecture \
--lang en \
"A multimodal retrieval-augmented generation system with document ingestion, chunking, embedding, vector search, cross-encoder reranking, and final answer synthesis."
Build the prompt first without making any API call:
python3 scripts/build_engineering_figure_prompt.py \
--figure-template algorithm-workflow \
--lang en \
--background-file ./method.md
Render an exact quantitative figure:
python3 scripts/build_plot_spec.py ./request.json --out ./spec.json
python3 scripts/plot_publication_figure.py ./spec.json --out-path ./output/plots/result --formats png pdf svg
references/publication-plot-api.md and references/natural-language-plot-workflow.md, then render locally.references/engineering-figure-templates.md.NANOBANANA_* variables are missing, load scripts/load_nanobanana_env.ps1 first, then run generation in the same shell session.--model override; otherwise let the script choose between NANOBANANA_DEFAULT_MODEL and NANOBANANA_HIGHRES_MODEL.NANOBANANA_HIGHRES_MODEL, stop and ask the human what to do next. Never silently downgrade and burn tokens on a lower-tier model.Use the built-in engineering templates instead of writing a long prompt from scratch when the request resembles:
graphical-abstractsystem-architecturealgorithm-workflowelectronic-schematicPrompt-building workflow:
references/engineering-figure-templates.md.en or zh. If the user does not specify a language and the technical background is mainly Chinese, default to zh; otherwise default to en.Use plot mode for:
For natural-language plotting requests, infer the internal JSON spec yourself. Do not force the user to write the spec unless they explicitly ask for low-level control.
NANOBANANA_AUTH_MODE=bearer.When the user wants a journal-style figure, prefer a low-saturation, soft academic palette rather than bright infographic colors.
Recommended default palette from the user's preferred reference:
#92B1D9#C1D8E9#DBDDEF#F6C8B6#D4D4D4Suggested usage:
#92B1D9 for the primary method, main pathway, or key functional blocks.#C1D8E9 for secondary modules, supporting flows, or background substructures.#DBDDEF for parallel branches, auxiliary stages, or soft emphasis regions.#F6C8B6 for highlights, alerts, intervention modules, or contrast accents, but do not overuse it.#D4D4D4 for non-focal infrastructure, containers, inactive regions, or neutral background elements.Additional palette rules:
If the user has a local deployment of AutoFigure-Edit, this skill can optionally hand off a Banana-generated draft for downstream editable-figure refinement.
Use this handoff as an optional post-processing path, not as a guaranteed default step.
What AutoFigure-Edit is good at:
SVG outputs for scientific figuresImportant limitation:
method text -> draft figure -> editable SVGexisting Banana raster image -> directly convert to editable SVGRecommended handoff wording:
SVG version.figure.png, prefer that path for post-processing.Suggested local integration points to reserve:
AUTOFIGURE_EDIT_ROOT: local repo root for AutoFigure-EditAUTOFIGURE_EDIT_PYTHON: Python executable for that environmentAUTOFIGURE_EDIT_OUTPUT_DIR: optional output directory for editable exportsAUTOFIGURE_EDIT_ENABLED=1: optional local flag indicating that post-processing is availableSuggested artifact handoff:
figure.pngprompt.txtmethod.txthandoff.json describing paths, language, figure type, and whether Chinese labels were requestedIf this integration is mentioned in a response, phrase it conservatively:
This figure can optionally be handed off to a local AutoFigure-Edit deployment for editable SVG reconstruction or refinement if that pipeline is available on this machine.Direct Banana-image-to-editable-SVG conversion depends on the local AutoFigure-Edit setup and any custom wrapper scripts around the upstream project.If the requested figure contains Chinese text, apply practical readability rules because image models can blur, distort, or misalign dense Chinese labels. Support Chinese directly when the user wants it, but steer the prompt toward high legibility instead of over-restricting the design.
Use these rules:
en, prefer Chinese labels by default.When writing prompts for figures with Chinese, include prompt phrases like:
use concise, clear Chinese labelsprefer short to medium Chinese labelsavoid dense Chinese paragraph textpreserve standard English symbols and formula variables where appropriatekeep labels horizontally aligned and centered within boxeskeep the figure readable at single-column paper widthavoid dense annotation blockswhite background, academic vector-like style, readable Chinese labelslarge clean text regions, centered Chinese labels, balanced spacingclear spacing, high contrast label areas, legible Chinese typographySafer prompt patterns:
Generate the full academic diagram structure with readable Chinese labels, balanced spacing, and clean alignment.Use concise Chinese module names and keep each label easy to read at paper size.Use Chinese for descriptive labels, but preserve standard English symbols, abbreviations, and formula variables where technically appropriate.Preserve the layout and arrows, and make the Chinese labels clear, centered, and visually balanced.For chart-like figures, emphasize accurate geometry and keep Chinese labels readable and uncluttered.references/engineering-figure-templates.md: template selection and domain-specific guidance.references/publication-figure-design.md: visual style rules for publication figures.references/publication-chart-patterns.md: chart composition and panel patterns.references/natural-language-plot-workflow.md: converting user requests into exact plotting specs.references/publication-plot-api.md: plot spec schema and rendering details.scripts/build_engineering_figure_prompt.py: resolve a template into a final prompt without any network call.scripts/generate_image.py: generate or edit images through the Gemini generateContent API shape.scripts/build_plot_spec.py: expand a concise plotting request into a complete plotting spec.scripts/plot_publication_figure.py: render exact figures from a JSON spec.