agentleFS
chemnychemny/ai-image-generator/SKILL.md

ai-image-generator

Skill2 starsChanged 4 months agoMITView on GitHub

Use this skill whenever the user wants to generate, create, edit, or restyle an AI image through the agent's native image generation capability or configured image APIs such as GPT-image2, Nano Banana-compatible APIs, SiliconFlow Qwen Image, or OpenAI GPT Image-compatible APIs. Direct mode sends the user's prompt directly to the model. Pro mode only checks whether the user's prompt has the basic elements needed for generation, asks for missing information, then sends the completed user-approved prompt to the model.

  • Reads credentials
  • Installs packages

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. TashanGKD/tashan-cursor-skills★ 21same name
    2. paolomoz/skills★ 4same name
    3. ook826092-cloud/skills★ 1same name
    4. SkotAlexsander/skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. About 0 are common, 18 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill as a general-purpose image generation component.

    line 9
  2. Distinctive:

    Use this global priority:

    line 15
  3. Distinctive:

    Pro mode: check whether the user's prompt has enough basic generation information.

    line 31
  4. Distinctive:

    Do not rewrite, optimize, stylize, expand, or re-rank the user's prompt unless the user explicitly asks you to write final copy.

    line 33
  5. Distinctive:

    Use Direct mode by default.

    line 40
  6. Distinctive:

    Do not add output form, style, composition, quality, text, brand, safety, or negative prompt constraints in Direct mode.

    line 48
  7. Distinctive:

    Use this priority for image size and aspect ratio:

    line 52
  8. Very specific:

    If the user or calling skill explicitly provides --size or --aspect-ratio, use that value.

    line 54
  9. Very specific:

    If no explicit size is provided, inspect the raw user prompt for an explicit size or ratio such as 1024x1024, 16:9, 9:16, or 2.35:1.

    line 56
  10. Very specific:

    If the prompt has no explicit size, match platform/use-case keywords against references/platform-image-specs.json.

    line 58
  11. Distinctive:

    If nothing matches, do not invent a size.

    line 60
  12. Distinctive:

    Check size resolution without generating an image:

    line 65
  13. Distinctive:

    Use Pro mode only when the user asks for:

    line 73
  14. Distinctive:

    Check whether the user's prompt contains enough information for generation:

    line 87
  15. Distinctive:

    Only ask for missing items that materially affect generation.

    line 98
  16. Distinctive:

    When information is missing, ask concise questions before generation:

    line 102
  17. Distinctive:

    After the user answers, create a completed prompt that combines:

    line 111
  18. Distinctive:

    no extra creative rewriting.

    line 115
  19. Distinctive:

    Use this helper to inspect missing prompt elements:

    line 121
  20. Very specific:

    Only pass --size or --aspect-ratio when the caller already has an explicit user requirement.

    line 159
  21. Distinctive:

    Default script/API provider order:

    line 197
  22. Distinctive:

    If the environment supports local image rendering, show the image:

    line 265

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AI Image Generator

Use this skill as a general-purpose image generation component. Other skills can call it whenever they need image generation instead of re-implementing image provider routing, API calls, output parsing, or common platform size defaults.

Provider Priority

Use this global priority:

  1. Agent-native image generation, when the current agent/runtime provides a built-in image generation tool and the user did not explicitly request a third-party API.
  2. Script/API --provider auto, whose fallback order is gpt-image2, nano-banana, siliconflow-qwen-image, then openai.
  3. A specific provider pinned by the user or calling skill.

The bundled scripts/generate-image.sh cannot call agent-native tools by itself. It only handles configured API providers. Agent-native generation is an instruction for the agent using this skill.

There are only two modes:

  1. Direct mode: send the user's prompt or keywords directly to the selected image model.
  2. Pro mode: check whether the user's prompt has enough basic generation information. If something important is missing, ask the user to fill it in. After the user confirms the missing information, send the completed prompt to the model.

Do not rewrite, optimize, stylize, expand, or re-rank the user's prompt unless the user explicitly asks you to write final copy. Do not use a case library or prompt examples to transform the user's intent.

This skill may infer image size or aspect-ratio API parameters from the user's stated use case. Size inference is not prompt rewriting.

Direct Mode

Use Direct mode by default.

The final prompt is the user's original input:

[user prompt or keywords]

Do not add output form, style, composition, quality, text, brand, safety, or negative prompt constraints in Direct mode. Provider parameters such as aspect ratio, image size, number of images, or input image path may still be passed as API parameters.

Size Resolution

Use this priority for image size and aspect ratio:

  1. If the user or calling skill explicitly provides --size or --aspect-ratio, use that value.
  2. If no explicit size is provided, inspect the raw user prompt for an explicit size or ratio such as 1024x1024, 16:9, 9:16, or 2.35:1.
  3. If the prompt has no explicit size, match platform/use-case keywords against references/platform-image-specs.json.
  4. If nothing matches, do not invent a size. Let the provider or script default apply.

The size resolver must not change the prompt text.

Check size resolution without generating an image:

bash scripts/resolve-image-spec.sh --query "生成一张微信公众号头图,主题是 AI 生图模型配置"

Pro Mode

Use Pro mode only when the user asks for:

  • Pro mode
  • prompt checking
  • help completing a prompt
  • guidance before generation
  • "帮我看看提示词是否完整"
  • "缺什么你问我"
  • "先帮我确认信息再生成"

Pro mode is not prompt optimization. It is a missing-information guide.

Basic Elements To Check

Check whether the user's prompt contains enough information for generation:

  • subject: what should appear in the image.
  • purpose: what the image will be used for, if relevant.
  • output_type: poster, cover, product photo, avatar, illustration, wallpaper, etc.
  • aspect_ratio_or_size: ratio or size, if the target platform matters.
  • style_or_mood: visual style, mood, realism level, or brand mood, if the user cares.
  • visible_text: exact text to appear, or "no text", if the image may include text.
  • reference_image: whether an input image should be used, and what must be preserved.
  • provider: only when the user cares or multiple configured providers are available.

Only ask for missing items that materially affect generation. If the user clearly does not care, do not ask.

Pro Interaction

When information is missing, ask concise questions before generation:

我先补齐几个会影响生成结果的信息:
1. 图片比例/尺寸要用什么?如果你不指定,我按 [default]。
2. 图片里是否需要出现文字?如果需要,请给 exact text。
3. 是否有参考图,或者需要保持某个主体不变?

After the user answers, create a completed prompt that combines:

  • the user's original wording,
  • the user's answers to missing questions,
  • no extra creative rewriting.

Then generate the image.

Helper Script

Use this helper to inspect missing prompt elements:

bash scripts/build-prompt-brief.sh --query "<user prompt>"

The helper returns:

  • inferred image type,
  • likely aspect ratio,
  • detected prompt elements,
  • missing elements,
  • questions to ask,
  • Direct prompt instruction,
  • Pro completion instruction.

Image Generation

Generate through Nano Banana-compatible providers:

bash scripts/generate-image.sh \
  --provider auto \
  --prompt "<user or completed prompt>" \
  --aspect-ratio 1:1 \
  --output-dir ./outputs

For other skills, the standard component call is:

bash /absolute/path/to/ai-image-generator/scripts/generate-image.sh \
  --provider auto \
  --prompt "<raw user prompt>" \
  --output-dir "<run output images dir>" \
  --output-prefix "<asset id>"

Only pass --size or --aspect-ratio when the caller already has an explicit user requirement. Otherwise let ai-image-generator resolve known platform defaults.

Provider choices:

  • Agent-native image generation: default at the agent level when available.
  • auto: script/API default. Try gpt-image2, nano-banana, siliconflow-qwen-image, then openai.
  • gpt-image2: OpenAI-compatible GPT-image2 proxy, for example Yunwu.
  • nano-banana: Nano Banana-compatible API.
  • siliconflow-qwen-image: SiliconFlow Qwen/Qwen-Image.
  • openai: generic OpenAI GPT Image-compatible API.

Generate through a specific provider:

bash scripts/generate-image.sh \
  --provider gpt-image2 \
  --prompt "<user or completed prompt>" \
  --size 1024x1024 \
  --output-dir ./outputs

For image-to-image, pass reference images:

bash scripts/generate-image.sh \
  --provider nano-banana \
  --input-image /absolute/path/reference.png \
  --prompt "<edit instruction>" \
  --aspect-ratio 1:1 \
  --output-dir ./outputs

Configuration

Each user configures their own API keys and URLs in .env, ~/.ai-image-generator/.env, or ~/.config/ai-image-generator/.env.

Default script/API provider order:

IMAGE_PROVIDER=auto

At the agent level, use the agent's built-in image generation capability first when available. Use IMAGE_PROVIDER=auto only when calling the bundled API script or when the user explicitly asks for API/provider generation.

GPT-image2 through an OpenAI-compatible proxy such as Yunwu:

GPT_IMAGE2_BASE_URL="https://yunwu.ai"
GPT_IMAGE2_MODEL="gpt-image-2-all"
GPT_IMAGE2_API_KEY="your_api_key_here"

Nano Banana-compatible provider:

NANO_BANANA_API_URL="https://your-provider.example/v1beta/models/your-model:generateContent"
NANO_BANANA_API_KEY="your_api_key_here"

Yunwu Nano Banana-compatible aliases:

YUNWU_NANO_BANANA_BASE_URL="https://yunwu.ai"
YUNWU_NANO_BANANA_MODEL="gemini-3.1-flash-image-preview"
YUNWU_NANO_BANANA_API_KEY="your_api_key_here"

SiliconFlow Qwen Image:

SILICONFLOW_BASE_URL="https://api.siliconflow.cn/v1/images/generations"
SILICONFLOW_MODEL="Qwen/Qwen-Image"
SILICONFLOW_API_KEY="your_api_key_here"

OpenAI GPT Image-compatible provider:

OPENAI_IMAGE_API_KEY="your_openai_or_proxy_key_here"
OPENAI_IMAGE_MODEL="gpt-image-1.5"
OPENAI_IMAGE_GENERATE_URL="https://api.openai.com/v1/images/generations"
OPENAI_IMAGE_EDIT_URL="https://api.openai.com/v1/images/edits"

Validate configuration:

bash scripts/check-config.sh

Output Handling

After generation, return:

  • generated image path(s),
  • provider used,
  • aspect ratio or size,
  • image_spec.source, showing whether the size came from user_explicit_cli, user_explicit_prompt, matched_spec, not_found, or provider_default,
  • prompt sent to the model,
  • raw JSON path for debugging.

If the environment supports local image rendering, show the image:

![generated image](/absolute/path/output.png)

Troubleshooting

  • Missing API key: run bash scripts/check-config.sh.
  • Missing jq: install it first, for example brew install jq.
  • Provider returns no image: inspect the saved raw JSON response.
  • OpenAI model mismatch: set OPENAI_IMAGE_MODEL to the model supported by the user's account or proxy.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.