Skip to content
Back to skills

Collection

ASecurity

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.

  • 24 stars
  • 0 votes
  • 0 copies
  • 9 views
  • Added September 8, 2026
code-qualitytypescriptgobashgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-65c99c5c/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-65c99c5c)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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 Image Skill

## Purpose
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.

## Inputs
- `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 editing

## Invocation

Run the standalone script with JSON arguments:

```bash
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:

```bash
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"
}'
```

## Output

The script outputs JSON to stdout:

```json
{
  "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.

## How It Works

The script internally:
1. **Optimizes the prompt** using best practices for game assets:
   - Adds technical requirements: '1:1 aspect ratio, white background, isometric view'
   - Adds context: 'game asset, suitable for 3D conversion'
   - Adds quality directives: '1024px, clean edges, simple design'
   - Adds type-specific hints based on `assetType`:
     - **vehicle**: 'side view, wheels visible, streamlined design'
     - **obstacle**: 'geometric, stackable, destructible appearance'
     - **prop**: 'detailed, recognizable silhouette'

2. **Calls Replicate API** with the optimized prompt
   - Model: `google/nano-banana-pro`
   - Aspect ratio: 1:1
   - Output format: PNG
   - Safety tolerance: 5

3. **Saves the image** to `/public/images/generated/`
   - Filename format: `image_{sanitizedDescription}_{timestamp}.png`
   - Example: `image_red_cube_obstacle_20251203_153045.png`
   - Timestamps prevent overwrites

## Error Handling

If an error occurs, the script:
- Exits with code 1
- Outputs JSON error to stderr: `{"error": "error message"}`

Common errors:
- **`REPLICATE_API_TOKEN not set`**: User needs to add API key to [.env](.env)
  - Guide them to: https://replicate.com/account/api-tokens
- **`description is required`**: Missing required field in JSON input
- **`Replicate API error`**: API call failed (check network, API key, quotas)

## Tools Required
- Bash: For executing the TypeScript script via `npx tsx`
- Read: For verifying the generated file (optional)

## Success Criteria
- Script exits with code 0
- Valid JSON output with `imagePath` and `prompt`
- Image file exists at the returned path
- File is a valid PNG
- File size is reasonable (< 5MB)
- Image matches the description

## Example Usage

### Simple Generation
```bash
npx tsx .claude/skills/generate-image/scripts/generate.ts '{
  "description": "blue racing car",
  "assetType": "vehicle"
}'
```

**Expected output:**
```json
{
  "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"
}
```

### Image Editing
```bash
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.

## Implementation Details

The script is located at:
[.claude/skills/generate-image/scripts/generate.ts](.claude/skills/generate-image/scripts/generate.ts)

It imports shared utilities from:
- `scripts/api/replicate.ts` - Replicate API client
- `scripts/utils/prompt-optimizer.ts` - Prompt enhancement logic

This architecture ensures:
- **Testability**: Script can be tested independently
- **Reusability**: Same script works from any context
- **Maintainability**: Logic is centralized, not duplicated
- **Version control**: Clear tracking in git

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.