$npx -y skills add szsip239/teamclaw --skill baoyu-image-genAI image generation with OpenAI, Google, DashScope and Replicate APIs. Supports text-to-image, reference images, aspect ratios. Sequential by default; parallel generation available on request. Use when user asks to generate, create, or draw images.
| 1 | # Image Generation (AI SDK) |
| 2 | |
| 3 | Official API-based image generation. Supports OpenAI, Google, DashScope (阿里通义万象) and Replicate providers. |
| 4 | |
| 5 | ## Script Directory |
| 6 | |
| 7 | **Agent Execution**: |
| 8 | 1. `SKILL_DIR` = this SKILL.md file's directory |
| 9 | 2. Script path = `${SKILL_DIR}/scripts/main.ts` |
| 10 | |
| 11 | ## Step 0: Load Preferences ⛔ BLOCKING |
| 12 | |
| 13 | **CRITICAL**: This step MUST complete BEFORE any image generation. Do NOT skip or defer. |
| 14 | |
| 15 | Check EXTEND.md existence (priority: project → user): |
| 16 | |
| 17 | ```bash |
| 18 | test -f .baoyu-skills/baoyu-image-gen/EXTEND.md && echo "project" |
| 19 | test -f "$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md" && echo "user" |
| 20 | ``` |
| 21 | |
| 22 | | Result | Action | |
| 23 | |--------|--------| |
| 24 | | Found | Load, parse, apply settings. If `default_model.[provider]` is null → ask model only (Flow 2) | |
| 25 | | Not found | ⛔ Run first-time setup ([references/config/first-time-setup.md](references/config/first-time-setup.md)) → Save EXTEND.md → Then continue | |
| 26 | |
| 27 | **CRITICAL**: If not found, complete the full setup (provider + model + quality + save location) using AskUserQuestion BEFORE generating any images. Generation is BLOCKED until EXTEND.md is created. |
| 28 | |
| 29 | | Path | Location | |
| 30 | |------|----------| |
| 31 | | `.baoyu-skills/baoyu-image-gen/EXTEND.md` | Project directory | |
| 32 | | `$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md` | User home | |
| 33 | |
| 34 | **EXTEND.md Supports**: Default provider | Default quality | Default aspect ratio | Default image size | Default models |
| 35 | |
| 36 | Schema: `references/config/preferences-schema.md` |
| 37 | |
| 38 | ## Usage |
| 39 | |
| 40 | ```bash |
| 41 | # Basic |
| 42 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image cat.png |
| 43 | |
| 44 | # With aspect ratio |
| 45 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A landscape" --image out.png --ar 16:9 |
| 46 | |
| 47 | # High quality |
| 48 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --quality 2k |
| 49 | |
| 50 | # From prompt files |
| 51 | npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles system.md content.md --image out.png |
| 52 | |
| 53 | # With reference images (Google multimodal or OpenAI edits) |
| 54 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Make blue" --image out.png --ref source.png |
| 55 | |
| 56 | # With reference images (explicit provider/model) |
| 57 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Make blue" --image out.png --provider google --model gemini-3-pro-image-preview --ref source.png |
| 58 | |
| 59 | # Specific provider |
| 60 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider openai |
| 61 | |
| 62 | # DashScope (阿里通义万象) |
| 63 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "一只可爱的猫" --image out.png --provider dashscope |
| 64 | |
| 65 | # Replicate (google/nano-banana-pro) |
| 66 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate |
| 67 | |
| 68 | # Replicate with specific model |
| 69 | npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate --model google/nano-banana |
| 70 | ``` |
| 71 | |
| 72 | ## Options |
| 73 | |
| 74 | | Option | Description | |
| 75 | |--------|-------------| |
| 76 | | `--prompt <text>`, `-p` | Prompt text | |
| 77 | | `--promptfiles <files...>` | Read prompt from files (concatenated) | |
| 78 | | `--image <path>` | Output image path (required) | |
| 79 | | `--provider google\|openai\|dashscope\|replicate` | Force provider (default: google) | |
| 80 | | `--model <id>`, `-m` | Model ID (Google: `gemini-3-pro-image-preview`, `gemini-3.1-flash-image-preview`; OpenAI: `gpt-image-1.5`) | |
| 81 | | `--ar <ratio>` | Aspect ratio (e.g., `16:9`, `1:1`, `4:3`) | |
| 82 | | `--size <WxH>` | Size (e.g., `1024x1024`) | |
| 83 | | `--quality normal\|2k` | Quality preset (default: 2k) | |
| 84 | | `--imageSize 1K\|2K\|4K` | Image size for Google (default: from quality) | |
| 85 | | `--ref <files...>` | Reference images. Supported by Google multimodal (`gemini-3-pro-image-preview`, `gemini-3-flash-preview`, `gemini-3.1-flash-image-preview`) and OpenAI edits (GPT Image models). If provider omitted: Google first, then OpenAI | |
| 86 | | `--n <count>` | Number of images | |
| 87 | | `--json` | JSON output | |
| 88 | |
| 89 | ## Environment Variables |
| 90 | |
| 91 | | Variable | Description | |
| 92 | |----------|-------------| |
| 93 | | `OPENAI_API_KEY` | OpenAI API key | |
| 94 | | `GOOGLE_API_KEY` | Google API key | |
| 95 | | `DASHSCOPE_API_KEY` | DashScope API key (阿里云) | |
| 96 | | `REPLICATE_API_TOKEN` | Replicate API token | |
| 97 | | `OPENAI_IMAGE_MODEL` | OpenAI model override | |
| 98 | | `GOOGLE_IMAGE_MODEL` | Google model override | |
| 99 | | `DASHSCOPE_IMAGE_MODEL` | DashScope model override (default: z-image-turbo) | |
| 100 | | `REPLICATE_IMAGE_MODEL` | Replicate model override (default: google/nano-banana-pro) | |
| 101 | | `OPENAI_BASE_URL` | Custom OpenAI endpoint | |
| 102 | | `GOOGLE_BASE_URL` | Custom Google endpoint | |
| 103 | | `DASHSCOPE_BASE_URL` | Custom DashScope endpoint | |
| 104 | | `REPLICATE_BASE_URL` | Custom Replicate endpoint | |
| 105 | |
| 106 | **Load Priority**: CLI args > EXTEND.md > env vars > `<cwd>/.baoyu-skills/.env` > `~/.baoyu-skills/.env` |
| 107 | |
| 108 | ## Model Resolution |
| 109 | |
| 110 | Model priority (highest → lowest), applies to all providers: |
| 111 | |
| 112 | 1. CLI flag: `--model <id>` |
| 113 | 2. EXTEND.md |