Design & media

Resilient ImageGen

Try it

Stabilize multi-image generation by converting prompts into a retryable serial job queue, inspecting runtime capabilities, routing through built-in ImageGen,...

What it does

Stabilize multi-image generation by converting prompts into a retryable serial job queue, inspecting runtime capabilities, routing through built-in ImageGen,...

The skill document

Resilient ImageGen

Make ImageGen work recoverable. This skill does not replace an image generator; it wraps image generation with queueing, retries, failure classification, and a handoff manifest.

Use it before or during cards-to-images and article-to-illustrations when several images must be generated and a partial failure should not lose the whole batch.

Inputs

Collect:

  • image job list: stable ids, target platform, ratio, dimensions, prompt, and intended filename
  • output directory for project-bound assets
  • whether the run is preview or project_asset
  • source card package or illustration plan, when applicable
  • retry policy, or use the default: 3 attempts per job with 3s, 8s, and 15s backoff
  • backend=auto by default and an optional preferred_backend
  • whether Computer Use, an authenticated ChatGPT session, built-in ImageGen, and local deterministic rendering are actually available
  • paid fallback preference: disabled by default and considered only after explicit confirmation
  • existing manifest or partial outputs when resuming an interrupted run

Route back to the upstream planning skill when prompts, dimensions, filenames, or source anchors are incomplete.

Workflow

1. Create A Job Queue

Turn every requested image into one row. Keep jobs small and independent.

Required fields:

  • job_id
  • source_id
  • platform_profile
  • ratio
  • dimensions
  • prompt
  • intended_filename
  • status: queued, running, generated, failed, or skipped
  • attempts
  • last_error
  • output_path
  • needs_human_review

Do not issue one broad prompt for several distinct assets. Distinct assets need distinct jobs.

2. Resolve The Generation Backend

Default to backend=auto. Inspect real capabilities and use this order unless the project supplies another preference:

  1. chatgpt_computer_use when Computer Use exists and the active ChatGPT session is authenticated
  2. built_in_imagegen when the built-in generator is healthy
  3. manual_chatgpt_handoff when a prepared prompt pack is the safest available external route
  4. mixed or deterministic rendering when external ChatGPT transmission is declined or exact local rendering is stronger

Route Computer Use and manual ChatGPT branches through chatgpt-image-handoff. Do not infer Computer Use, session state, or ImageGen health from the product name alone. Persist the inspected capability state and selection reason.

Treat cli_api_fallback as a separate last resort. Use it only after the user confirms the cost and local configuration. Do not ask the user to paste secrets into the conversation.

3. Run Built-in ImageGen Safely

For built-in ImageGen:

  • run one job at a time
  • avoid parallel generation
  • retry network-like failures up to the retry limit
  • record every failed attempt in the manifest
  • save or move selected outputs into the project when the image is a project asset
  • inspect each output before marking it ready for downstream use

Built-in ImageGen does not expose a configurable timeout. Treat timeout handling as a fallback concern, not as a built-in parameter.

4. Classify Failures

Use the error text and context to decide the next action.

FailureDefault action
network error, error sending request, transient backend failureRetry with backoff.
generation takes too long or the UI stallsStop the current job, record timeout_or_stall, and resume with the next queued job only when the tool is available again.
aborted or turn interruptionDo not retry blindly. Re-read the manifest, verify generated files, then resume only queued or failed jobs.
prompt rejected, invalid request, or policy errorDo not retry unchanged. Revise the prompt or route back to planning.
auth, quota, billing, or missing keyStop and ask for user action.
poor text rendering in Chinese, broken labels, invented UI, or wrong numbersKeep the generated visual only as a background candidate; use deterministic typography or rerender through cards-to-images.

5. Use A Recoverable ChatGPT Handoff

Route to chatgpt-image-handoff when the selected backend is chatgpt_computer_use or manual_chatgpt_handoff.

  • prepare one master prompt and one self-contained prompt per job
  • request action-time confirmation before the first Computer Use submission or reference upload
  • process and import one image at a time
  • require a local file, checksum, dimensions, and visual QA before marking success
  • resume only incomplete jobs after interruption
  • hand exact text and factual diagrams back to deterministic or mixed rendering

Users with Codex but no Computer Use can still use the manual pack. Users outside Codex can run the public scripts and follow the same import and QA contract manually.

6. Escalate To CLI/API Fallback

Escalate when:

  • the same job fails after the retry limit
  • several jobs fail with the same network-like error
  • the user needs a fixed output directory, timeout, logs, or resumable batch execution
  • the run is part of a publish-ready asset pipeline and cannot depend on interactive retries

Before fallback, state:

  • why built-in mode is no longer reliable enough
  • whether fallback requires local credentials
  • what will be written to disk
  • which jobs will be retried

Require explicit confirmation before running fallback or using paid API calls.

7. Inspect And Handoff

Open every generated image before declaring success. Check:

  • correct dimensions and ratio
  • no broken or invented text
  • no logos, fake screenshots, private paths, QR codes, or watermarks unless explicitly requested
  • alignment with the source card or article slot
  • whether exact Chinese text should be overlaid deterministically

Then hand off:

  • card images to cards-to-images
  • long-form illustrations to article-to-illustrations
  • public URL preparation to md-img-r2 plan mode after human confirmation

Manifest Format

Write a compact manifest beside the output directory.

run_id:
generation_runtime:
  requested_backend: auto
  preferred_backend: chatgpt_computer_use
  computer_use: unknown
  chatgpt_session: unknown
  built_in_imagegen: unknown
  local_renderer: unknown
  selected_backend:
  selection_reason:
retry_policy:
  max_attempts: 3
  backoff_seconds: [3, 8, 15]
jobs:
  - job_id:
    source_id:
    platform_profile:
    dimensions:
    intended_filename:
    status:
    attempts:
    last_error:
    output_path:
    visual_qa_status: pending
    human_confirmation: pending
fallback:
  recommended:
  reason:
  confirmed_by_user: false

Use relative project paths in public artifacts. Do not write secrets, local account identifiers, or private absolute paths into a public manifest.

Output Format

# Resilient ImageGen Run

## Queue
| Job | Source | Target | Status | Attempts | Output |
| --- | --- | --- | --- | --- | --- |

## Failures
| Job | Error | Action |
| --- | --- | --- |

## Handoff
- Manifest:
- Selected backend:
- External handoff pack:
- Generated files:
- Needs deterministic text overlay:
- Fallback recommended:
- User decision needed:

Boundaries

  • Do not claim an image batch is complete when some jobs are only queued or failed.
  • Do not hide transient failures; record them so interrupted runs can resume.
  • Do not run CLI/API fallback, paid generation, ChatGPT Computer Use submission, uploads, or Markdown URL rewrites without the required confirmation.
  • Do not treat generated Chinese text as reliable when exact wording matters.
  • Do not overwrite existing images unless the user explicitly requested replacement.

作者入口

Related skills

Route a multi-image content job through the best available generation backend, prepare a resumable prompt pack with readable-text fact boundaries, optionally...

1 installs

Drives the local nano-img Gemini image CLI for image generation, model selection, saved defaults, reference-image workflows, and output sizing or format conv...

14 installs

Detect image generation requests and route them to the artist agent. Use when user asks to draw, generate, create, sketch, render, or visualize an image.

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparen...

10 installs

Freegen image-gen API: TXT2IMG, I2I, Inpainting, RemoveBG, Upscale via local freegen container. Supports Flux, SDXL, SD1.5, Lightning models.