Add asset-generation skill for image generation via Gemini

This commit is contained in:
2026-03-03 17:04:48 +01:00
parent 9d8e0e1024
commit 10303dad09
2 changed files with 99 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
# asset-generation
Generate images from text prompts using the Gemini API.
## Setup
### 1. Get a Gemini API key
1. Go to [Google AI Studio](https://aistudio.google.com/apikey)
2. Create a new API key
### 2. Configure the key
Add to your `.env.tools` file in the project root:
```
GEMINI_API_KEY=your_key_here
```
Make sure `.env.tools` is in your `.gitignore` — never commit API keys.
### 3. Verify it works
```bash
node asset-generation/scripts/generate-image.mjs \
--prompt "a simple blue circle on white background" \
--output assets/test.png
```
## Usage
```bash
node asset-generation/scripts/generate-image.mjs \
--prompt "description of the image" \
--output assets/my-image.png
```
See `SKILL.md` for the full workflow.
+61
View File
@@ -0,0 +1,61 @@
---
name: asset-generation
description: >
Generate images from text prompts using Gemini. Triggers - generate an image, create an asset,
make a graphic, generate a logo, create an illustration, I need an image for.
---
# Asset Generation
Generate images from text prompts using the Gemini model and save them to the project's `/assets` directory.
## Prerequisites
- Set `GEMINI_API_KEY` in a `.env.tools` file at the project root (see `asset-generation/README.md`).
- Node.js installed.
## When to use this skill
Use when:
- The user asks to **generate an image** (logo, illustration, graphic, placeholder, etc.)
- The user says "create an asset" / "make a graphic" / "I need an image for..."
- A visual asset is needed for the project and no existing file fits
## Workflow
### 1. Clarify the Prompt
Before generating, make sure you have a clear prompt:
- What is the image for? (icon, hero image, placeholder, illustration, etc.)
- What style? (flat, realistic, minimal, etc.)
- Any specific colors, dimensions, or constraints?
- What filename should it have?
If the user gave a clear enough description, proceed directly.
### 2. Generate the Image
```bash
node asset-generation/scripts/generate-image.mjs \
--prompt "your detailed prompt here" \
--output assets/filename.png
```
The script will:
- Send the prompt to the Gemini API
- Save the generated image to the specified path
- Create the `/assets` directory if it doesn't exist
### 3. Verify the Output
- Confirm the file was created at the expected path
- Report the file path and size to the user
- If the result doesn't match expectations, refine the prompt and regenerate
## Rules
- **Always confirm the prompt** with the user before generating (unless it's already specific)
- **Use descriptive filenames** — `hero-banner.png` not `image1.png`
- **Save to `/assets`** directory by default, unless the user specifies another location
- **Don't overwrite** existing files without asking