// Generate game asset images from text descriptions using Replicate's nano-banana-pro model. Use this skill when the user asks to create or generate 2D images, sprites, textures, or visual assets for the game.
| name | generate-image |
| description | Generate game asset images from text descriptions using Replicate's nano-banana-pro model. Use this skill when the user asks to create or generate 2D images, sprites, textures, or visual assets for the game. |
Generate game asset images using Replicate's nano-banana-pro model. This skill handles prompt optimization, API calls, and file management through a standalone executable script.
description (required): Text description of the asset (e.g., 'racing car', 'obstacle cube')assetType (optional): Type of asset ('vehicle', 'obstacle', 'prop', 'general')baseImagePath (optional): Path to existing image for image-to-image editingRun the standalone script with JSON arguments:
npx tsx /Users/tomek/projects/kata-workshop-cc/.claude/skills/generate-image/scripts/generate.ts '{
"description": "red cube obstacle",
"assetType": "obstacle"
}'
For image-to-image editing:
npx tsx /Users/tomek/projects/kata-workshop-cc/.claude/skills/generate-image/scripts/generate.ts '{
"description": "red sports car with racing stripes",
"assetType": "vehicle",
"baseImagePath": "/Users/tomek/projects/kata-workshop-cc/public/images/generated/image_red_sports_car_20251203_153045.png"
}'
The script outputs JSON to stdout:
{
"imagePath": "/Users/tomek/projects/kata-workshop-cc/public/images/generated/image_red_cube_obstacle_20251203_153045.png",
"prompt": "red cube obstacle, geometric, stackable, destructible appearance, 1:1 aspect ratio, white background, isometric view, game asset, suitable for 3D conversion, 1024px, clean edges, simple design, high quality render"
}
Progress messages are sent to stderr, so you can see them in the console but they won't interfere with JSON parsing.
The script internally:
Optimizes the prompt using best practices for game assets:
assetType:
Calls Replicate API with the optimized prompt
google/nano-banana-proSaves the image to /public/images/generated/
image_{sanitizedDescription}_{timestamp}.pngimage_red_cube_obstacle_20251203_153045.pngIf an error occurs, the script:
{"error": "error message"}Common errors:
REPLICATE_API_TOKEN not set: User needs to add API key to .env
description is required: Missing required field in JSON inputReplicate API error: API call failed (check network, API key, quotas)npx tsximagePath and promptnpx tsx .claude/skills/generate-image/scripts/generate.ts '{
"description": "blue racing car",
"assetType": "vehicle"
}'
Expected output:
{
"imagePath": "/Users/tomek/projects/kata-workshop-cc/public/images/generated/image_blue_racing_car_20251203_154530.png",
"prompt": "blue racing car, side view, wheels visible, streamlined design, 1:1 aspect ratio, white background, isometric view, game asset, suitable for 3D conversion, 1024px, clean edges, simple design, high quality render"
}
npx tsx .claude/skills/generate-image/scripts/generate.ts '{
"description": "blue racing car with yellow racing stripes",
"assetType": "vehicle",
"baseImagePath": "/Users/tomek/projects/kata-workshop-cc/public/images/generated/image_blue_racing_car_20251203_154530.png"
}'
This will use the existing image as a base and apply the modifications.
The script is located at: .claude/skills/generate-image/scripts/generate.ts
It imports shared utilities from:
scripts/api/replicate.ts - Replicate API clientscripts/utils/prompt-optimizer.ts - Prompt enhancement logicThis architecture ensures: