CommunityImagegithub.com

xhs-image-remake

Redesign images based on reference images from Xiaohongshu (supports same-style remake and element replacement modes, per-element routing between AI-generated images and local rendering, multi-image batch remake, and single-image expansion to multiple angles). Trigger words: reference image remake / Xiaohongshu remake / make it like the reference / same-style remake / replace product / replace English text with Chinese / replace scene and props / expand to multi-angle series. Fully automated planning and execution, with a single batch quotation checkpoint before any paid image generation; pure local zero-cost paths execute directly.

What is xhs-image-remake?

This AI agent skill, `xhs-image-remake`, is designed to automate the recreation of images based on reference images (single or multiple) from Xiaohongshu (a popular Chinese social media platform). It intelligently analyzes the reference images, decides between two core modes: 'same-style remake' or 'element replacement', and routes each visual element to either AI image generation or local rendering (using HTML/CSS/SVG) based on cost and complexity. The skill supports generating a series of images from multiple references or expanding a single image into multiple angles, all with a consistent style. It features a fully automated pipeline with a clear, user-approved batch quotation step before any paid image generation is executed. If all elements can be rendered locally for free, the skill proceeds without any cost. After generation, it performs a visual self-check, proposes layered fixes (correcting only the affected layer, e.g., local text without regenerating the base image), and delivers final images plus a summary. For developer tools like Claude Code or Cursor, this skill provides a comprehensive solution for product photography, content creation, and social media asset generation, ensuring high fidelity to the original reference while allowing flexible modifications.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/kerwin-li-8888/xhs-image-remake/tree/HEAD

Installed? Explore more Image skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Xiaohongshu Reference Image Remake (xhs-image-remake)

Automatically decompose, determine mode, route per-element "generate image vs. local draw", orchestrate image series, composite and render, review and archive based on reference images (single or a set) and user's actual product assets.

This Skill runs completely self-contained, without relying on external closed-source workflows or backend services; the image generation model can be freely swapped via a lightweight adapter layer.

Reference Documents on Demand

End-to-End Flow (Fully Automated + Single Quotation Checkpoint)

  1. Receive Input: Reference images (single/multiple) + user's actual product assets + copy or modification intent + target number of images (if any). When product facts are missing, clearly mark them as gaps or pending verification; never fabricate.
  2. Full Auto-Planning (Zero Cost):
    • First, scan 1-2 sections of references/lessons.md relevant to the current task and convert matched rules into constraints for this execution.
    • Actual Image Decomposition: Identify scene, composition, camera position, action, lighting, product relationships, stickers/text, and icons/cards for each image.
    • Mode Determination: If the user does not specify, automatically determine Mode A (Same-Style Remake) or Mode B (Element Replacement) (rules in modes-and-series.md).
    • Per-Element Routing: Decompose to the element level and decide "local drawing (HTML/CSS/SVG)" or "image generation model", determining whether the entire image is pure local / hybrid / pure generation (rules in element-routing.md).
    • Image Series Orchestration: For multi-image references, set a series-level bible (Series Bible) + generate each image individually (Mode B can use style_anchor for the first shot); for single-image expansion to multiple angles, prefer native sequential, and fall back to per-image generation when not supported.
    • Plan Persistence: Call scripts/run_store.py init to initialize the run directory, writing decomposition highlights, keep/replace lists, per-element routing, and pending shots into run.json.
  3. Single Checkpoint: Batch Quotation (Triggered only when paid generation is involved):
    • If all elements are local draws (zero cost), skip this step and go directly to Step 4.
    • If generation is needed, first call scripts/gen_image.py quote --adapter <name> --request <req.json> to verify credential readiness at zero cost, plan batching, and estimate unit price (unconfigured credentials or single-shot limits will block the request directly).
    • Report to the user in one go: total number of images, model/adapter used, unit price and estimated total price (or risk warning if unit price is unknown), whether to batch or fall back to per-image generation.
    • Hard rule: Never submit any paid request without the user's explicit confirmation; after confirmation, execute all images within the authorized scope in one batch.
  4. Auto Execution:
    • Generation Layer: Call scripts/gen_image.py run --adapter <name> --request <req.json> (--dry-run isolates and stores sandbox results in dry_run/<call_id>/, without overwriting official evidence). Prompts must require clean base images without text (except for packaging-inherent text). The same output directory uses a shared submission lock for single and batch runs; on timeout or insufficient returned images (incomplete_delivery), mark ok=false, retain the lock and successful evidence to prevent re-entry into the same directory. Must first check raw/ and adapter_result.json, and never automatically resend paid requests.
    • Local Layer: First view the generated base image to confirm subject and prop safety zones, then write editable HTML/CSS/SVG source code into local/, call scripts/render_local.py <html_path> <out_png> --base-image <base_png> to render and composite into outputs/.
    • Write actual prompts, artifact paths, and cost details back to run.json.
  5. Visual Self-Check and Delivery:
    • Must actually view each final image (never rely on exit codes or file sizes instead of visual review; if viewing is impossible, honestly state that visual check is incomplete).
    • Verify: Mode consistency, product identity (brand/bottle shape/color/specifications), lighting and gesture linkage, base images free of garbled text and watermark residue, local text accurate and readable on mobile devices.
    • Layered Fixes: Fix issues at the layer they occur (fix text/annotations only in the local layer, without touching the base image); if additional paid redraws exceed the authorized budget, re-quote.
    • Deliver final images + a brief description (mode used, which were generated/which were locally drawn, whether fallback to per-image generation was needed), and call scripts/run_store.py write-summary to write into summary.md. Do not produce side-by-side comparison images or lengthy reports.
  6. Lightweight Experience Capture (Low-intrusion, On-demand Trigger):
    • Triggered only when any of the following conditions are met: 1) Substantial revisions ≥ 2 rounds after the first draft; 2) Troubleshooting and solving a new tool/model pitfall; 3) User explicitly requests a record.
    • Not triggered for standard one-pass completions. When auto-trigger conditions are met, append a brief confirmation at the end of the delivery note (e.g., "There is 1 reusable experience from this run, write to lessons.md?"), then deduplicate and persist according to lessons.md rules after confirmation.

Archiving Directory and Script Quick Reference

Default archive root: ./runs/<task>/run-YYYYMMDD-HHmmss/ (can be overridden via environment variable XHS_IMAGE_REMAKE_OUT_ROOT or --out-root), containing run.json, summary.md, gen/, local/, outputs/.

python scripts/run_store.py init --task <task_name> [--out-root <directory>] [--mode A|B]
python scripts/gen_image.py capabilities --adapter <mock|ark_seedream>
python scripts/gen_image.py quote        --adapter <mock|ark_seedream> --request <req.json>
python scripts/gen_image.py run          --adapter <mock|ark_seedream> --request <req.json> [--dry-run]
python scripts/render_local.py <local/page.html> <outputs/final.png> [--base-image <base.png>]

Boundaries and Red Lines

  • This iteration does not include: Pure style reconstruction (redesigning composition and camera position together), side-by-side comparison images, visual decomposition reports, videos, or per-image coordinate/font size parameter tables.
  • Do not hardcode any API keys, Endpoint IDs, or unit prices; all image generation calls must go through scripts/gen_image.py and the adapter layer.

Related Skills