Generate Image Skill
Use this skill to generate AI images using the Nano Banana Pro API based on text prompts.
When to Use
Invoke this skill when the user requests:
- •Creating or generating images from text descriptions
- •Making visual assets, illustrations, or graphics
- •Generating images with specific aspect ratios or sizes
- •Creating images for documentation, presentations, or projects
Prerequisites
IMPORTANT: Before using this skill, verify these requirements are met:
- •The
img-gentool must be installed and in the system PATH (on windows, ensureimg-gen.exeis accessible and useimg-gen.exein commands) - •The
NANOBANANA_API_KEYenvironment variable must be set
If either prerequisite is missing, the skill will fail with a clear error message instructing the user how to fix it.
How to Invoke
Use the /generate-image command or invoke via the Skill tool:
/generate-image prompt="your image description here"
Parameters
- •
prompt(required): Text description of the image to generate - •
aspect_ratio(optional): One of1:1,16:9,4:3, or3:2(default:16:9) - •
image_size(optional): One of1K,2K, or4K(default:2K) - •
output_dir(optional): Directory path within the current repo to save the image (default:./images/)
Examples
Simple generation:
/generate-image prompt="A serene mountain landscape at sunset with a lake reflecting the golden sky"
With all parameters:
/generate-image prompt="A futuristic city skyline at night" aspect_ratio="16:9" image_size="4K" output_dir="./assets/generated/"
Square image for social media:
/generate-image prompt="A colorful abstract pattern" aspect_ratio="1:1" image_size="2K" output_dir="./social-media/"
Important Notes
- •
Security: The output directory must be within the current repository. Attempts to save outside the repo will be rejected.
- •
Path Creation: If the output directory doesn't exist, it will be created automatically.
- •
Project Independence: This skill works across all projects/repositories where you have the img-gen tool installed.
- •
Error Handling: If prerequisites are missing or parameters are invalid, you'll receive a JSON error response with clear instructions for the user.
- •
API Key: The API key is always read from the environment variable and never exposed in command-line arguments or logs.
Response Format
The skill returns JSON output with:
- •
status: "success" or "error" - •
image_path: Path to the generated image (on success) - •
error: Error message (on failure) - •Additional metadata about the generation
User Communication
When invoking this skill:
- •Confirm what image you're generating
- •Specify the parameters being used (aspect ratio, size, output location)
- •After generation, inform the user of the saved file location
- •If errors occur, explain the error and provide the solution from the error message