$npx -y skills add jimliu/baoyu-skills --skill baoyu-image-genAI image generation with OpenAI GPT Image 2, Azure OpenAI, Google, OpenRouter, DashScope, Z.AI GLM-Image, MiniMax, Jimeng, Seedream, Replicate and Agnes APIs. Supports text-to-image, reference images, aspect ratios, and batch generation from saved prompt files. Sequential by defa
| 1 | # Image Generation (AI SDK) |
| 2 | |
| 3 | Official API-based image generation. Supports OpenAI GPT Image 2, Azure OpenAI, Google, OpenRouter, DashScope (阿里通义万象), Z.AI GLM-Image, MiniMax, Jimeng (即梦), Seedream (豆包), Replicate and Agnes. |
| 4 | |
| 5 | ## User Input Tools |
| 6 | |
| 7 | When this skill prompts the user, follow this tool-selection rule (priority order): |
| 8 | |
| 9 | 1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. |
| 10 | 2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. |
| 11 | 3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. |
| 12 | |
| 13 | Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. |
| 14 | |
| 15 | ## Script Directory |
| 16 | |
| 17 | `{baseDir}` = this SKILL.md's directory. All `scripts/...` paths below are relative to `{baseDir}`. Main script: `{baseDir}/scripts/main.ts`. Batch payload helper: `{baseDir}/scripts/build-batch.ts`. Resolve `${BUN_X}`: prefer `bun`; else `npx -y bun`; else suggest `brew install oven-sh/bun/bun`. |
| 18 | |
| 19 | ## Step 0: Load Preferences ⛔ BLOCKING |
| 20 | |
| 21 | This step MUST complete before any image generation — generation is blocked until EXTEND.md exists. |
| 22 | |
| 23 | Check these paths in order; first hit wins: |
| 24 | |
| 25 | | Path | Scope | |
| 26 | |------|-------| |
| 27 | | `.baoyu-skills/baoyu-image-gen/EXTEND.md` | Project | |
| 28 | | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-image-gen/EXTEND.md` | XDG | |
| 29 | | `$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md` | User home | |
| 30 | |
| 31 | - **Found** → load, parse, apply. If `default_model.[provider]` is null → ask model only. |
| 32 | - **Not found** → run first-time setup (`references/config/first-time-setup.md`) using AskUserQuestion to collect provider + model + quality + save location. Save EXTEND.md, then continue. Do not generate images before this completes. |
| 33 | |
| 34 | Legacy compatibility: if `.baoyu-skills/baoyu-imagine/EXTEND.md` exists and the new path doesn't, the runtime renames it to `baoyu-image-gen`. If both exist, the runtime leaves them alone and uses the new path. |
| 35 | |
| 36 | **EXTEND.md keys**: default provider, default quality, default aspect ratio, default image size, OpenAI image API dialect, default models, batch worker cap, provider-specific batch limits. Schema: `references/config/preferences-schema.md`. |
| 37 | |
| 38 | ## Usage |
| 39 | |
| 40 | Minimum working examples — see `references/usage-examples.md` for the full set including per-provider invocations and batch mode. |
| 41 | |
| 42 | ### Identity-preserving reference prompts |
| 43 | |
| 44 | When the user wants a real person/character/object preserved from reference images, do **not** replace the reference with a long generic description. Prefer short, hard identity-preservation language: |
| 45 | |
| 46 | - "Use the person/object in the reference image(s) as the same identity. Do not redesign it or create a similar-looking new subject." |
| 47 | - "Only change scene, clothing, pose, lighting, rendering style, and composition. Keep the face/proportions/hair/key accessories/overall identity from the references." |
| 48 | - If using multiple references, state that they are the same subject and should jointly define identity. |
| 49 | |
| 50 | Pitfall: long descriptions like "young East Asian woman, oval face, clear eyes..." can cause the model to synthesize a new person matching the description instead of preserving the referenced person. |
| 51 | |
| 52 | ```bash |
| 53 | # Basic |
| 54 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image cat.png |
| 55 | |
| 56 | # With aspect ratio and high quality |
| 57 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "A landscape" --image out.png --ar 16:9 --quality 2k |
| 58 | |
| 59 | # Prompt from files |
| 60 | ${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png |
| 61 | |
| 62 | # With reference image |
| 63 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "Make blue" --image out.png --ref source.png |
| 64 | |
| 65 | # Specific provider |
| 66 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider dashscope --model qwen-image-2.0-pro |
| 67 | |
| 68 | # OpenAI GPT Image 2 |
| 69 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider openai --model gpt-image-2 |
| 70 | |
| 71 | # Codex CLI (uses logged-in Codex subscription — no OPENAI_API_KEY required; requires `codex` on PATH) |
| 72 | ${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out |