
Baoyu Xhs Images
Generate Xiaohongshu-style carousel or post images via Codex CLI when native imagegen is unavailable, routing through baoyu-image-gen when installed.
Overview
baoyu-xhs-images is an agent skill for the Build phase that generates Xiaohongshu-oriented images by routing Codex CLI imagegen through baoyu-image-gen or the codex-imagegen wrapper.
Install
npx skills add https://github.com/jimliu/baoyu-skills --skill baoyu-xhs-imagesWhat is this skill?
- Routes generation through baoyu-image-gen when present for retry, cache, and batch parity across providers
- Falls back to codex-imagegen wrapper only when baoyu-image-gen is missing from the runtime
- Documents --provider codex-cli, --promptfiles, --ar, and optional --ref reference image paths
- Resolves wrapper location via BAOYU_CODEX_IMAGEGEN_BIN or plugin-root discovery instead of hard-coded relative paths
- Aligns with baoyu XHS image prompt-file naming (NN-{type}-[slug].md) for multi-slide outputs
Adoption & trust: 23.5k installs on skills.sh; 20.9k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need XHS-ready images from prompt files but your agent runtime has no native imagegen and you do not want one-off fragile shell invocations.
Who is it for?
Indie builders already using baoyu-skills who publish to Xiaohongshu and standardize on Codex CLI for imagegen.
Skip if: Teams without Codex login, without Bun/runtime shell access, or who only need generic DALL·E/Midjourney prompts outside the baoyu prompt-file workflow.
When should I use this skill?
Image Generation Tools rule resolves to codex-imagegen because native imagegen is absent but codex CLI is on PATH with an active codex login.
What do I get? / Deliverables
The agent runs a documented codex-cli image pipeline with correct paths and ratios, then leaves image files at your specified absolute output paths.
- Raster image files at specified absolute paths
- Agent-invoked CLI command log consistent with baoyu-image-gen flags
Recommended Skills
Journey fit
Image batch generation for social assets is an integration step during product or content build, not a full-journey methodology. The skill wires Codex/baoyu-image-gen CLI flags, prompt files, aspect ratio, and reference images—classic third-party media integration work.
How it compares
Integration skill for baoyu’s Codex imagegen path—not a standalone MCP image server or browser-based design tool.
Common Questions / FAQ
Who is baoyu-xhs-images for?
Solo and indie builders using Claude Code, Cursor, or Codex with the baoyu-skills stack who create 小红书 visuals and already rely on Codex CLI or baoyu-image-gen.
When should I use baoyu-xhs-images?
During Build when you are wiring content pipelines—after prompts exist as markdown files and you need batch or per-slide generation with aspect ratio and optional reference images.
Is baoyu-xhs-images safe to install?
It instructs the agent to run local CLIs and write files; review the Security Audits panel on this page and vet the baoyu-skills repo and Codex credentials before granting shell and filesystem access.
Workflow Chain
Requires first: baoyu image gen
SKILL.md
READMESKILL.md - Baoyu Xhs Images
# `codex-imagegen` Wrapper Invocation Load this reference only when the [Image Generation Tools](../SKILL.md#image-generation-tools) rule has resolved to `codex-imagegen` — i.e., the current runtime exposes no native `imagegen` skill but `codex` CLI is on `PATH` with an active `codex login`. ## Preferred path: route through `baoyu-image-gen` If the `baoyu-image-gen` skill is available in this runtime, **always** invoke through it rather than calling the wrapper directly. It handles retry/cache/batch/EXTEND.md preferences uniformly with every other provider. ```bash ${BUN_X} <baoyu-image-gen-base>/scripts/main.ts \ --provider codex-cli \ --image <ABSOLUTE_output> \ --promptfiles <ABSOLUTE_prompts/NN-{type}-[slug].md> \ --ar <ratio> \ [--ref <ABSOLUTE_file>]... ``` Resolve `<baoyu-image-gen-base>` the same way you resolve any sibling skill — through your runtime's skill registry (`Skill` tool, plugin marketplace, or `$HOME/.baoyu-skills/baoyu-image-gen/`). ## Fallback: spawn the wrapper directly Only when `baoyu-image-gen` is NOT installed in the current runtime. Discover the wrapper's location at runtime — do NOT hard-code `../../packages/...` from this skill: 1. **Honor explicit override**: if `$BAOYU_CODEX_IMAGEGEN_BIN` is set and points to a real file, use that path. It may be `.ts` (spawn `bun <path>`) or `.sh`/binary (spawn directly). 2. **Search the plugin root**: walk up from this skill's directory looking for `packages/baoyu-codex-imagegen/src/main.ts`. If found, that is the wrapper. Spawn it with `bun`. 3. **Last resort**: tell the user that `codex-imagegen` is not available in this runtime and ask whether to install the `baoyu-skills` plugin (or set `BAOYU_CODEX_IMAGEGEN_BIN`) or pick another backend. Once located, the invocation shape is: ```bash bun <WRAPPER>/main.ts \ --image <ABSOLUTE_output> \ --prompt-file <ABSOLUTE_prompts/NN-{type}-[slug].md> \ --aspect <ratio> \ [--ref <ABSOLUTE_file>]... \ [--timeout <ms>] \ [--cache-dir ~/.cache/baoyu-codex-imagegen] \ [--log-file <ABSOLUTE_jsonl_log_path>] ``` If `bun` is missing, `npx -y bun <WRAPPER>/main.ts ...` works as a fallback. ## Parameter notes - **All filesystem inputs** are auto-resolved against `process.cwd()` when relative, but agents should pass absolute paths to be robust against cwd drift. - **`--timeout`** defaults to `300000` (5 min) per `codex exec` attempt. Raise (e.g. `--timeout 600000` for 10 min) on slow networks or large prompts. - **`--cache-dir`** is off by default. Enable for repeatable runs to skip redundant generations of the same prompt+aspect+refs. - **Authentication**: the wrapper uses the user's Codex subscription — no `OPENAI_API_KEY` is read or sent. ## Stdout contract Single JSON line: - Success: `{"status":"ok","path":"...","bytes":N,"elapsed_seconds":N,"thread_id":"...","attempts":N,"cached":bool,...}` - Failure: `{"status":"error","path":"...","bytes":0,"error":"...","error_kind":"..."}` `error_kind` values: `codex_not_installed`, `invalid_args`, `prompt_file_missing`, `spawn_failed`, `timeout`, `no_image_gen_tool_use`, `output_missing`, `invalid_png`, `agent_refused`, `lock_busy`. On retryable errors (timeout, spawn_failed, no_image_gen_tool_use, output_missing, invalid_png, agent_refused), ask the user whether to retry or fall back to another backend. ## Batch semantics - Codex `image_gen` returns **one image per call** (`n=1` only). Multi-image jobs must dispatch one wrapper call per image. - The wrapper does NOT accept a `--sessionId` flag. Chain/scene consistency must come from `--ref` reference images. - `--size` and `--quality` are silently ignored — Codex picks pixel dimensions from `--aspect`. --- name: first-time-setup description: First-time setup flow for baoyu-xhs-images preferences --- # First-Time Setup ## Overview When no EXTEND.md is found, guide user through preference setup. **⛔ BLOCKING OPERATION**: This setup MUST complete before ANY other workflow steps. Do NOT: