<< All versions

Skill v1.0.0

currentLLM-judged scan90/100
bozhoudev/bozhou-skills/image-gen
──Details
PublishedOctober 24, 2026 at 10:25 AM
Content Hashsha256:28c2ad63e8d35ba2...
Git SHA1addb9f9650e
──Files
Files (1 file, 3.9 KB)
SKILL.md3.9 KBactive
SKILL.md · 108 lines · 3.9 KB

version: "1.0.0" name: image-gen description: AI image generation with OpenAI, Google and DashScope APIs. Supports text-to-image, reference images, aspect ratios, and direct Cloudflare R2 upload. Sequential by default; parallel generation available on request. Use when user asks to generate, create, or draw images.


Image Generation

Generate images via OpenAI, Google Gemini, or DashScope APIs. R2 upload is the default workflow for persistent article/social images.

Scripts

SKILL_DIR/
scripts/main.ts — generate image (+ optional R2 upload)
scripts/upload-r2.ts — upload any existing file to R2
scripts/r2.ts — R2 upload module (AWS SigV4, no external deps)
scripts/providers/ — google.ts / openai.ts / dashscope.ts
scripts/types.ts — shared types

Usage

bash
SKILL_DIR="/path/to/image-gen"
# Basic generation
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image cat.png
# With aspect ratio
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A landscape" --image out.png --ar 16:9
# From prompt file
npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles prompt.md --image out.png
# Generate + upload to R2 (prints public URL)
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image cat.png --r2
# Generate + upload with custom R2 key
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image cat.png --r2 --r2-key articles/hero.png
# Upload existing file to R2
npx -y bun ${SKILL_DIR}/scripts/upload-r2.ts --file image.png
npx -y bun ${SKILL_DIR}/scripts/upload-r2.ts --file image.png --key custom/path.png
# With reference image
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Make it blue" --image out.png --ref source.png
# Force provider
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider openai

Options

OptionDescription
-p, --prompt <text>Prompt text
--promptfiles <files...>Read prompt from files
--image <path>Output path (required)
`--provider google\openai\dashscope`Force provider
-m, --model <id>Model ID
--ar <ratio>Aspect ratio: 16:9, 1:1, 4:3, 9:16, 2.35:1
`--quality normal\2k`Default: 2k
`--imageSize 1K\2K\4K`Google only
--ref <files...>Reference images
--r2Upload to R2 after generation, print public URL
--r2-key <name>R2 object key (default: filename)
--jsonJSON output

Environment Variables

Set in the vault-local .env.r2, ~/.skills/.env, or ~/.baoyu-skills/.env:

VariableDescription
GOOGLE_API_KEY / GEMINI_API_KEYGoogle API key
OPENAI_API_KEYOpenAI API key
DASHSCOPE_API_KEYDashScope API key
R2_ACCESS_KEY_IDCloudflare R2 access key
R2_SECRET_ACCESS_KEYCloudflare R2 secret key
R2_ACCOUNT_IDCloudflare account ID
R2_BUCKETR2 bucket name
R2_PUBLIC_BASE_URLPublic base URL (e.g. https://cdn.example.com)

Provider Selection

Auto-detects from available API keys. Priority: Google → OpenAI → DashScope. With --ref: Google first (Gemini multimodal), then OpenAI.

R2 Upload

Uses AWS SigV4 signing with built-in Node.js crypto — no external dependencies. With --r2, prints the R2 public URL instead of the local path. For article/social images, always use --r2 and insert the returned URL into Markdown; keep local files only as temporary cache.

Generation Mode

Sequential by default. For parallel batch generation, use multiple background subagents.

Default Workflow in This Vault

For any image that will be referenced by articles, tweets, covers, or long-lived notes:

  1. Generate the image to a temporary or ignored local path.
  2. Upload immediately with --r2 or scripts/upload-r2.ts.
  3. Insert the returned R2_PUBLIC_BASE_URL URL into Markdown.
  4. Do not rely on committed local image files as the canonical asset.
All versions