in-app-asset-generator
In-App Asset Generation & Processing
This skill provides best practices and processing scripts for generating high-quality 2D sprites, icons, backgrounds, and UI elements using AI image generation, then preparing them for use in web or mobile apps.
Prompt Engineering Best Practices
When using an image generation tool (Imagen, DALL-E, etc.) to create app or game components, follow these rules for consistency and usability:
- Format & Perspective: Always explicitly ask for a "clean, simple 2D flat vector graphic". Do not allow the model to generate 3D renders, gradients, or complex shading unless specifically requested.
- Style Transfer via Reference Images: Whenever possible, pass a screenshot of your app's UI as a reference image. State in the prompt: "Using the provided screenshot as a direct style, color, and aesthetic reference..." This is the most effective way to guarantee brand alignment.
- Encode Your Design System: Explicitly include your app's design mandates in the prompt. Reference your outline style, fill patterns, and visual language (e.g., "thick dark outlines, flat pastel fills, rounded corners").
- Use Exact Hex Codes: Do not use vague color names like "red" or "blue". Extract exact hex codes from your app's CSS or design tokens and force the prompt to use them (e.g.,
Primary #3B82F6,Accent #F59E0B). - Background Isolation: To ensure the processing script can strip the background for transparent PNGs, always end your prompt with: "Solid white background. Do not add any shadows dropping onto the background canvas."
Example: Applying a Design System
If your app uses a Neo-Brutalist style:
"2D flat vector graphic of a treasure chest. Thick navy blue (#1D3557) outlines,
solid Gold (#F4A261) fill, neo-brutalist style. Solid white background."
If your app uses a soft/rounded style:
"2D flat vector graphic of a treasure chest. Thin rounded outlines (#374151),
soft gradient fills in sky blue (#7DD3FC) to white, modern minimal style.
Solid white background."
The key is extracting your design tokens and embedding them directly in every prompt.
Creating Consistent Icon Sets
When building an entire set of UI icons or game sprites, they must look like they belong to the same visual family.
- Batch Generation Strategy: Generate icons as a single tiled atlas or "sprite sheet" in one API request (e.g., "generate a 2x2 grid containing a coin, a sword, a shield, and a potion, all in the exact same style"). Then slice them programmatically with the included script.
- Anchor with Reference Images: Every image generation request must receive the exact same reference image. This forces the model to continuously reference the same styling rules.
- Rigid Prompt Templates: Develop a rigid prompt template and only swap out the subject:
"Using the attached UI reference image, generate a clean 2D flat vector graphic of [SUBJECT]. [OUTLINE_STYLE], [FILL_STYLE], [DESIGN_SYSTEM]. Solid white background." - Validate Against Design Tokens: Check generated outputs against your app's CSS tokens before finalizing. If a generated asset uses a slightly different color than your design system, adjust and regenerate.
Processing Assets
AI image generators typically output JPEG or WebP files with baked-in backgrounds. To use these as components, strip the background and convert to RGBA PNGs.
Background Removal
Script Path: <path-to-skill>/scripts/process_asset.py
python <path-to-skill>/scripts/process_asset.py \
--input "/path/to/generated_image.png" \
--out_dir "./public/game_assets" \
--name "coin" \
--crop
Arguments:
--input(Required): Path to the raw generated image.--out_dir(Required): Destination directory for the transparent PNG.--name(Required): Output filename without.pngextension.--crop(Optional): Auto-crop transparent padding around the asset.--threshold(Optional): White detection threshold (0-255). Default240. Lower values are more aggressive at removing near-white pixels. Raise to250if the asset has light-colored areas being incorrectly removed.
Sprite Sheet Slicing
Script Path: <path-to-skill>/scripts/slice_sprites.py
python <path-to-skill>/scripts/slice_sprites.py \
--input "/path/to/spritesheet.png" \
--out_dir "./public/game_assets/icons" \
--prefix "item" \
--rows 2 --cols 3
Arguments:
--input(Required): Path to the sprite sheet image.--out_dir(Required): Destination directory for sliced images.--prefix(Required): Filename prefix (outputsprefix_0.png,prefix_1.png, ...).--rows(Required): Number of rows in the grid.--cols(Required): Number of columns in the grid.--col_major(Optional): Iterate columns first instead of rows.
Workflow Example
- Identify the need for a new "Coin" icon.
- Look up your design tokens — find the gold hex code (e.g.,
#F4A261). - Generate with your image tool: "2D flat vector graphic of a coin. [your outline style], solid Gold (#F4A261) fill. Solid white background."
- Process:
python <path-to-skill>/scripts/process_asset.py --input ./artifact.png --out_dir ./public/game_assets --name coin --crop - Wire
/game_assets/coin.pnginto your component.
More from horace4444/extend-my-claude-code
watermark-removal
Universal watermark removal with ML-based inpainting and automatic detection. Works on ANY watermark type (Google SynthID, Midjourney, DALL-E, stock photos, logos). Four methods: inpaint (ML, best quality), aggressive (fast), crop (fastest), paint (basic). Auto-detects watermark location in any corner. Use when: (1) Removing ANY type of watermark, (2) Google AI/Imagen/Gemini watermarks, (3) Stock photo watermarks, (4) Logo overlays, (5) Cleaning images for production, (6) Batch processing, or (7) User mentions 'watermark', 'remove watermark', 'clean image', 'SynthID'
114image-converter
Convert, resize, compress, and optimize images across formats (HEIC, PNG, JPEG, WebP, AVIF, GIF, TIFF, BMP). Use when working with image files for format conversion, resizing/downscaling, compression/optimization, batch processing, watermarking, metadata stripping, or any image manipulation task. Triggers on requests involving image files, photo processing, or web image optimization.
8ai-api-integrations
Connect applications, scripts, and backend services to AI model APIs (OpenAI, Anthropic Claude, Google Gemini/Vertex AI, xAI Grok), Supabase (PostgreSQL database with vector search), and Clerk (authentication). Use when building AI-powered features that require (1) AI model integration for text generation, translation, embeddings, or image generation, (2) Supabase database operations with pgvector semantic search, (3) Clerk user authentication and session management, (4) Combining AI outputs with database storage, (5) Cost-optimized model selection and prompt engineering, (6) Best practices for production deployments avoiding common anti-patterns.
7skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
4web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
4google-image-creator
Generate images using Google AI models (Imagen 4 and Gemini). Presents top 3 model options with pricing, generates images via API, tracks token usage and costs. Use when user needs to: (1) Generate images with Google AI, (2) Choose between Google image models, (3) See pricing for Google image generation, (4) Track image generation costs, or (5) Compare Imagen vs Gemini image models. Self-updating with current pricing from https://ai.google.dev/pricing
4