Apparel Image Generation
Unified Entry: Full-range e-commerce image generation capability for apparel/model-related products (topwear, bottomwear, dresses, outerwear, shoes & hats, etc.). Both single-image direct generation and image-set orchestration are accessed via this single skill.
Entry Routing
| Condition | Path | Operation |
|---|
| Only need one image of a specific type (e.g., "make a model image") | Single-image Direct Generation | Confirm type → Read corresponding references/types/<type>.md
→ Execute shared pipeline |
| Need multiple images / multiple types / image sets (e.g., "create an image set" "generate 5 images") | Image-set Orchestration | Read references/runtime/00-index.md
→ Read / step by step → Call scripts/run_collection_pipeline.py
three phases (plan / dispatch / summary, agent sends 3 Bash commands in sequence; dispatch uses at skill layer to run concurrently, agent itself does not handle concurrency; FORBID reading during image-set phase or reading during image-set phase) |
Type Routing Table
| type | Name | Associated with Selling Points | Has Scene Description | Default Aspect Ratio | Branch | Uses textgen | Details Reference |
|---|
| WHITE_BG | White Background Image (Invisible Model) | No | No | 1:1 | ①Static Direct Generation | No | references/types/white-bg.md
|
| MODEL_IMAGE | Model Image | No | Yes | 1:1 | ②Placeholder Direct Generation | No | references/types/model-image.md
|
| SCENE | Lifestyle Marketing Image | Yes | Yes | 1:1 | ③textgen Rewriting | Yes | references/types/scene.md
|
| SELLING_POINT | Selling Point Image | Yes | Yes | 1:1 | ③textgen Rewriting | Yes | references/types/selling-point.md
|
| PREMIUM_APLUS | Premium A+ Image | Yes | Yes | 1464:600 | ③textgen Rewriting | Yes | references/types/aplus.md
|
| STANDARD_APLUS | Standard A+ Image | Yes | Yes | 970:600 | ③textgen Rewriting | Yes | references/types/aplus.md
|
| PHONE_APLUS | Mobile A+ Image | Yes | Yes | 600:450 | ③textgen Rewriting | Yes | references/types/aplus.md
|
| SIZE | Size Chart Image | No | Yes | 1:1 | Two phases: ①Phase 1 = ③textgen Pre-analysis + ②Phase 2 = Placeholder Direct Generation | Yes in Phase 1 / No in Phase 2 | |
After confirming the type, must Read the corresponding type reference file to get which branch the type follows, the differential logic of Step 2, and the source of runtime templates. SKIPPING IS FORBIDDEN.
Inapplicable Scenarios
- Non-apparel physical products (cosmetics, electronics, home goods, food, etc.) → Use
linkfox-aigc-imagegen-product
series.
- Pure image editing operations (background replacement, watermark removal, angle change, etc. with clear creative directions) → Use .
- Pose/action variation of existing model images (model variation) → Not within this scope (business side constructs posePrompt upstream, no dictionary reading).
- Pure text generation → .
- Video generation → .
Shared Pipeline
All types follow the same 3-step pipeline (size chart image uses two phases, see below). The differences in Step 2 are specified by each type reference file indicating which branch to take.
Three Branches (Essence of Differences in Step 2)
| Branch | Mechanism | Fills Placeholders | Calls textgen | Checks Sensitive Words | Applicable Types |
|---|
| ① Static Direct Generation | Use scripts/build_imagegen_prompt.py --type WHITE_BG
to dynamically extract static content from as the final prompt | No | No | No | WHITE_BG |
| ② Placeholder Direct Generation | Generate images directly after filling placeholders in templates (using scripts/build_imagegen_prompt.py
) | Yes | No | No for MODEL_IMAGE / Append avoidance instructions at the end of SIZE Phase 2 | MODEL_IMAGE, SIZE Phase 2 |
| ③ textgen Rewriting | Fill placeholders in templates → rewrites to get the final prompt (using scripts/build_textgen_params.py
) | Yes | Yes | No for SCENE / Yes for Selling Point & A+ / No for SIZE Phase 1 | SCENE, SELLING_POINT, *_APLUS, SIZE Phase 1 |
Step 1: Verify Accessibility of Image URLs (Universal for All Types)
- Input:
- Empty Array Guard (Mandatory): If is empty / missing / all invalid, stop immediately, do not call downstream with empty images. Prioritize filling from context (original image paths uploaded by users in current/historical rounds); if still unable to fill, truthfully report error to user and request re-upload. FORBID continuing with empty .
- Operation: Check each value in in order: if it is a public URL (starts with http/https) → pass through directly; if it is a local file path (not http/https) → call to upload and get a public URL for replacement.
- Output: (all are publicly accessible HTTPS URLs)
Step 2: Construct Final Prompt (Differences Refer to Each Type Reference)
The logic of Step 2 varies by type (which branch to take, which model to use, whether to avoid sensitive words, etc.), see the Read
references/types/<type>.md
for details.
Constraints for ①Static Direct Generation Branch (WHITE_BG): Use
scripts/build_imagegen_prompt.py --type WHITE_BG
to build the imagegen parameter file. The script will automatically extract the static content of white background images from the
code block in
references/types/white-bg.md
as the final prompt. The content is long, always let the script read it,
do not manually copy or pass via shell variables.
Constraints for ②Placeholder Direct Generation Branch (MODEL_IMAGE, SIZE Phase 2): Must use the
scripts/build_imagegen_prompt.py
auxiliary script of this skill to build the imagegen prompt parameter file (the script automatically completes template reading, placeholder filling, null parameter replacement, and sensitive word avoidance instruction appending for SIZE Phase 2).
FORBID manually splicing prompts with Write tool or capturing large text with shell variables. Inject the
of SIZE Phase 2 using
to avoid passing large text via shell.
Constraints for ③textgen Rewriting Branch (SCENE, SELLING_POINT, *_APLUS, SIZE Phase 1): Must use the
auxiliary script of this skill to build the textgen parameter file (the script automatically completes template reading, placeholder filling, model/thinkingLevel setting, and sensitive word avoidance instruction appending for Selling Point & A+), then execute in
chain call mode as specified in textgen SKILL.md.
Image-set Must Follow Three-phase Pipeline: For image-set path, run plan / dispatch / summary three phases with
scripts/run_collection_pipeline.py
, agent sends 3 Bash commands in sequence; concurrency is handled by
at skill layer during dispatch,
agent itself does not handle concurrency:
- writes / , stdout directly outputs markdown table + 1 line of status JSON (including / / / )
- After user confirmation, agent sends only 1 dispatch Bash:
python <root of this skill>/scripts/run_collection_pipeline.py --phase dispatch --state <state_file>
; dispatch internally uses to run run_one_task.py --index 1..N
concurrently, each subtask outputs fragment; dispatch itself does not emit in stdout, only outputs 1 line {"status":"dispatch_complete",...}
at the end for internal agent parsing (this Bash does not render images, it is normal)
--phase summary --state <state_file>
reads fragments → stdout outputs final markdown details (each successful image comes with inline reference, frontend markdown renderer renders the entire set of images based on this) + 1 line of status JSON; product variant also writes collection-asset-manifest.json
FORBID Agent manually completing S1 reasoning or reading full text of S0~S3 in conversation;
FORBID splitting into N Bash commands to run
after user confirmation (old protocol; concurrency is now handled at skill layer, self-concurrency will only result in duplicate images);
FORBID stripping
lines when forwarding summary markdown (the entire set of images relies on these lines for rendering);
FORBID attaching
Saved full response: [...]
outside summary (causes double rendering with markdown
). The following bash single-step link
only applies to single-image direct generation.
Path Rule: This link spans two skill directories (parameter construction scripts belong to this skill, text generation and parameter injection scripts belong to
), the current working directory is not fixed.
All scripts must be called with absolute paths, do not use bare relative paths (relative paths will point to wrong directories and cause execution failure). Where
= absolute path of the directory where this SKILL.md is located;
is obtained by parsing the absolute path of the directory where SKILL.md of
skill:linkfox-aigc-textgen
is located.
- Parameter Construction (this skill):
python <root of this skill>/scripts/build_textgen_params.py --type <TYPE> ... --out <textgen_params.json>
- Text Generation (textgen skill):
PROMPT=$(python <textgen root directory>/scripts/aigc_textgen.py --stdin --content-only < <textgen_params.json>)
—— outputs single-line content captured into variable (line breaks are flattened to , the mechanism for downstream automatic restoration is in textgen SKILL.md).
- Parameter Injection (Step 3, inline with ): Use to inline into downstream imagegen parameter JSON, then pass to for image generation.
bash
PROMPT=$(python <textgen root directory>/scripts/aigc_textgen.py --stdin --content-only < <textgen_params.json>)
PARAMS=$(jq -nc --arg p "$PROMPT" --argjson imgs '<URL JSON array from Step 1>' \
'{prompt:$p, imageUrls:$imgs, provider:"<provider>", outputNum:1, aspectRatio:"<ratio>", resolution:"<resolution>"}')
# Then pass $PARAMS to image generation according to the calling method in linkfox-aigc-imagegen SKILL.md
FORBID manually constructing textgen parameter files with Write tool (must use
), extracting original content with
(will reintroduce real line breaks and break splicing), or directly writing Python to call API to bypass this link.
Step 3: Call for Image Generation (Universal for All Types)
- Input: from Step 2, from Step 1, , ,
- Operation: Read SKILL.md of
skill:linkfox-aigc-imagegen
and execute image generation script according to its calling method. Pass parameters:
- : Final prompt produced in Step 2
- : All image URLs from Step 1
- : Model specified by input (default )
- : Pass as is
- : Pass as is
- :
- Output: Image (local path after )
- Single-image Direct Generation Delivery (By Type): For single-image direct generation scenario of this skill, follow §3.1 of
references/runtime/03-deliver.md
. After imagegen Bash completes, agent must:
-
Parse
Saved full response: ["..."]
in stdout to get local path (1 image on success)
-
Append markdown inline block to conversation reply content:
markdown
- Image 1 · <Chinese name of type>

-
Chinese Name Mapping: SCENE→Lifestyle Marketing Image / SELLING_POINT→Selling Point Image / MODEL_IMAGE→Model Image / SIZE→Size Chart Image / WHITE_BG→White Background Image / PREMIUM_APLUS→Premium A+ Image / STANDARD_APLUS→Standard A+ Image / PHONE_APLUS→Mobile A+ Image
-
FORBID repeating the protocol text
Saved full response: [...]
/
Saved full response: <json path>
in conversation reply —— it is an internal protocol line between skill ↔ bridge, repeating it will expose raw JSON array path to users (i.e., "protocol line exposure" fault); only read it to get the path, do not copy the literal text
-
FORBID manually echoing
literal text to let bridge render again —— the "task output" resource card of bridge path A is automatically triggered by imagegen Bash stdout, agent should not copy it manually
-
Double rendering (markdown inline image + bridge "task output" resource card displayed simultaneously) is expected behavior under current protocol, not a fault
-
For failure cases (stdout is
Saved full response: <data path>.json
single file), truthfully inform user according to "Error Handling and Failure Guards" in this SKILL.md, do not append inline image
Intermediate Product Storage (Mandatory)
All files to be reused across steps or delivered must be stored in session directory
<cwd>/linkfox/<YYYY-MM-DD>/<session>/{data|media}/
(protocol see "Output File Location" in repository
).
| Product Type | Directory | Acquisition Method |
|---|
| Brand Gene JSON | | of linkfox-aigc-imagegen-brand-gene-extract
|
| Image-set Plan image-plan.json | | Saved and appended item by item with scripts/save_image_plan.py
after S2 confirmation |
| imageUrls Array | | Write to after Step 1 verification (usually small) |
| task-result-*.json | | Task result fragment stored after each completes, read and summarized into final markdown in summary phase |
| Single-image Parameter Construction JSON (textgen/imagegen input) | | of / (only for single-image direct generation scenario) |
| Result Image | | Automatically stored by script |
DATADIR=$(python <brand-gene root directory>/scripts/save_brand_gene.py --datadir)
; downstream
points to the absolute path of brand gene stored in S1.
Downstream Skill Calling Convention
This skill depends on two downstream skills in the table below,
call according to documented methods: first Read the other party's SKILL.md to understand its calling method, single-image direct generation follows chain commands in Step 2/3, image-set follows orchestration of
scripts/run_collection_pipeline.py
+
—— both call downstream official scripts with
absolute paths as documented (this is allowed). Auxiliary scripts like
/
/
run_collection_pipeline.py
/
included in this skill can be run directly. It is not allowed to construct calls outside the above documented link or directly connect to downstream HTTP API.
| Downstream Skill | Purpose | Calling Timing |
|---|
| AI Image Generation | Step 3 (all types) |
| Prompt Rewriting / Pre-analysis | Step 2 (SCENE, SELLING_POINT, *_APLUS, SIZE Phase 1) |
Calling Method: Read SKILL.md of
and execute according to its calling method section.
Shared Input Parameters
The following parameters are universal for all types (type-specific parameters see each type reference):
| Parameter | Type | Default | Description |
|---|
| string[] | Required | URLs of apparel reference images. Step 1 will verify accessibility |
| string | Varies by type | Image aspect ratio, passed to of imagegen as is |
| string | 2K | Resolution, 2K / 4K |
| string | — | Image generation model ( / / / / ); if not passed, use to let user select from the above 5 models |
Error Handling and Failure Guards
skill returns exit 0 for
business failures (non-zero exit is not used), so
cannot judge success/failure by command exit code, must parse stdout.
1. How to Judge Success/Failure of a Call
- Success: stdout contains
Saved full response: ["xxx.png", ...]
(JSON array path) → Image has been stored in media/, get path for display.
- Failure: stdout contains
Saved full response: xxx.json
(single JSON file path, not array) → No image product, need to read this JSON to view error details (//).
2. Failure Handling (By Failure Type)
| Failure Type | Judgment Basis | Handling |
|---|
| Invalid Parameters | / indicates that input parameters like , , , are not accepted | Use to let user re-select corresponding parameters |
| Authentication Failure | or prompt about API Key | Stop and prompt user to configure , do not retry |
| Transient Error | is network/timeout/connection failure (e.g., , timeout) | Retry automatically at most 1 time; if failed again, switch to "Other Errors" |
| Other Errors | Quota exceeded, content rejected, server 5xx, unknown errcode, etc. | Do not retry, truthfully inform user of failure reason |
3. Hard Guards (Violation is Considered a Fault)
- ❌ FORBID switching to other skills due to image generation failure —— The only image generation path for this skill is , handle or report according to the above table on failure, never "try another skill".
- ❌ FORBID unlimited retries: Except for "transient errors with at most 1 retry", do not retry the same type of failure repeatedly.
- ❌ FORBID treating failed return body as success and continuing (display empty image, tell user "generated successfully").
Global Rules
Model Type Rules
This skill supports the following 5 image generation models, which are passed in by agent layer via
parameter; if not passed, this skill will confirm with user.
| Model Name | Internal Code |
|---|
| LFBanana Pro | |
| Img2 | |
| LFBanana2 | |
| Linkfox-Image-1 | |
| Wan 2.7 | |
Model Confirmation: If
is empty or not in the above table, use
to let user select from the above 5 models, then continue execution after user selection. Pass
uniformly to Step 3.
Resolution Rules
Resolution is a required parameter for Step 3. This skill supports 2K, 4K.
- If agent layer passes (value is 2K or 4K): use directly
- If agent layer does not pass: use to let user select from 2K / 4K
Task Independence Statement
Each image in the image set is an independent task, and tasks do not depend on each other. Failure of image generation for a single type does not affect the execution of other tasks.
Execution Constraints
- No Upload Link: Apparel images are directly passed in the form of , this skill does not involve local file upload operations (except URL verification in Step 1). FORBID probing or calling any upload scripts.
- Planning Tool Usage Specification: Do not use planning tool for single-image direct generation. Must create task plan for N images before concurrent image generation for image sets (see
references/runtime/02-confirm.md
).
- Image-set Storage: plan / summary are written to disk by
run_collection_pipeline.py
; FORBID Agent writing the entire image-plan from memory with Write.
- Listing Report Asset Manifest Write-back (Mandatory): If image-set results are to be merged into Listing HTML, caller must retain
$DATADIR/collection-asset-manifest.json
, and replace local paths in manifest with public OSS URLs via before merging. This skill does not upload directly, but must not imply that local paths can be directly written into HTML.
Image-set Orchestration Process (runtime, Progressive Read)
Only triggered by image-set path; do not Read this section for single-image direct generation.
| Step | Read | Operation |
|---|
| Entry | references/runtime/00-index.md
| S0 scenario judgment |
| plan | references/runtime/01-plan.md
| Write job.json → , forward stdout markdown table as is + AskUserQuestion |
| Confirm → Dispatch → Summary | references/runtime/02-confirm.md
| User confirmation → agent sends 1 Bash (skill layer runs all concurrently, does not render images) → immediately send 1 Bash to write manifest + output markdown details with |
Maintenance details (complete rules for scenario A/G, historical S1 copywriting specifications) are in
references/maintainer/collection/
,
FORBID reading during runtime.
Known Limitations
- White background image template uses static instructions, strongly depends on model's judgment of perspective (front/back) and version (men's/women's/children's clothing); wrong judgment will affect silhouette and volume reconstruction.
- Model image link does not call textgen or check sensitive words, all decoding and composition judgment rely on single image generation by the model; template only consumes , strong control of market-oriented race / brand tone needs to be passed in via text description.
- Lifestyle marketing image strongly depends on () judgment of target audience / age (children's vs adult) / gender; wrong judgment will directly affect model portrait and scene composition.
- Selling point image/A+ share dictionary template, distinguished by ; wrong intention filling will lead to layout mismatch. Selling point image/A+ include sensitive word avoidance in textgen phase.
- Size chart image uses two-phase link: quality of in Phase 1 directly determines category judgment and prompt copy of size chart in Phase 2; sensitive word avoidance in Phase 2 is downgraded to "append avoidance instructions at the end of final prompt sent to imagegen, self-reviewed by image generation model", no deterministic word list fallback.
- When multiple reference images are provided, the model judges the role of main apparel automatically, which may misjudge the main image in complex combinations.
- Branches that do not rewrite sensitive words (lifestyle marketing image/model image/white background image): if selling points/scenes contain prohibited content, this link does not intercept, controlled by upstream or manual review.
Resolve Authentication and Quota Issues
For the following abnormal situations, guide users to solve problems using references/onboarding.md:
Abnormal Situations
- API Key Not Configured: Environment variable is not configured, nor is .
- Response with 401 or 402 Status Code
- Response Indicates Insufficient Quota or Balance: Message contains "insufficient quota balance/insufficient billing/insufficient balance/quota exceeded/insufficient balance/package expired/need to recharge/please recharge" or similar meanings.