Unified entry point: full-type e-commerce image generation capability for apparel / model-category products (tops, bottoms, dresses, outerwear, shoes and hats, etc.). Both single-image direct generation & image set orchestration are entered from this one skill.
Entry routing
| Condition | Path | Operation |
|---|---|---|
| Only want one image of a specific type (e.g. "make one model image") | Single-image direct generation | Determine type → Read corresponding references/types/<type>.md → execute shared pipeline |
| Want multiple images / multiple types / an image set (e.g. "make an image set", "produce 5 images") | Image set orchestration | Read references/runtime/00-index.md → Read step by step 01-plan / 02-confirm → call scripts/run_collection_pipeline.py three stages(plan / dispatch / summary, the agent sequentially issues 3 Bash commands; dispatch runs concurrently at the skill layer using ThreadPoolExecutor to run scripts/run_one_task.py, the agent itselfdoes notrun concurrently;prohibited Read maintainer/collection/ or Read during the image set stage types/*.md) |
Type routing table
| type | Name | Associated with selling points | Has scene description | Default ratio | Branch | Whether it uses textgen | Details reference |
|---|---|---|---|---|---|---|---|
| WHITE_BG | White background image (invisible mannequin) | 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 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 | Advanced 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 stages: ①Stage 1 = ③textgen pre-analysis + ②Stage 2 = placeholder direct generation | Stage 1 yes / Stage 2 no | references/types/size.md |
After determining the type,must Read the corresponding type reference file to obtain which branch this type follows, the step 2 difference logic, and the runtime template source,skipping is prohibited。
Not applicable
- Non-apparel physical products (beauty, digital, home, food, etc.) → use the
linkfox-aigc-imagegen-productseries. - Pure image editing operations (background replacement, watermark removal, angle change, and other operations with an already-clear creative direction) → use
linkfox-aigc-imagegen。 - Model image pose change / action change variations (model variations) → out of scope (the business side constructs posePrompt upstream and does not read the dictionary).
- Text-only generation →
linkfox-aigc-textgen。 - Video generation →
linkfox-aigc-videogen。
Shared pipeline
All types go through the same 3-step pipeline (size charts are two-stage, see below); the differences in step 2 are specified by each type reference in terms of which branch to take.
Three branches (the essence of the differences in step 2)
| Branch | Mechanism | Whether to fill placeholders | Whether to call textgen | Whether to pass sensitive-word filtering | Applicable types |
|---|---|---|---|---|---|
| ① Static direct output | Use scripts/build_imagegen_prompt.py --type WHITE_BG to dynamically extract the static body text from white-bg.md as the final prompt |
No | No | No | WHITE_BG |
| ② Placeholder direct output | Fill placeholders in the template and directly generate the image (using scripts/build_imagegen_prompt.py) |
Yes | No | MODEL_IMAGE No / SIZE appends a circumvention instruction at the end of stage 2 | MODEL_IMAGE, SIZE stage 2 |
| ③ textgen rewrite | Fill placeholders in the template → linkfox-aigc-textgen rewrite to produce the final prompt (using scripts/build_textgen_params.py) |
Yes | Yes | SCENE No / Selling point·A+ Yes / SIZE stage 1 No | SCENE, SELLING_POINT, *_APLUS, SIZE stage 1 |
Step 1: Validate image URL accessibility (common to all types)
- Input:
imageUrls - Empty array guardrail (mandatory): If
imageUrlsis an empty array / missing / all invalid,stop immediately, and do not call downstream with empty images. Prefer to fill in from context (the original image paths uploaded by the user in this turn/history); if it still cannot be filled in, truthfully report an error to the user and request re-upload,forbiddento continue execution with emptyimageUrls. - Operation: Check each value in
imageUrlsone by one (keeping the original order): if it is already a public URL (starting with http/https) → pass it through directly; local file path (not http/https) → calllinkfox-file-uploadto upload and obtain a public URL, then replace it. - Output:
imageUrls(all are publicly accessible HTTPS URLs)
Step 2: Construct the final prompt (for the differing parts, see each type reference)
The step 2 logic differs by type (which branch to take, which model to use, whether to do sensitive-word circumvention, etc.); see the already Read references/types/<type>.md。
① Static direct output branch constraint (WHITE_BG): Use
scripts/build_imagegen_prompt.py --type WHITE_BGto build the imagegen parameter file; the script will automatically extract the static body text of the white background image from thereferences/types/white-bg.mdin thetextcode block as the final prompt. The body text is long, so always have the script read it,do not manually copy it or pass it through shell variables。② Placeholder direct output branch constraint (MODEL_IMAGE, SIZE stage 2): Must use this skill's
scripts/build_imagegen_prompt.pyAuxiliary script builds the imagegen prompt parameter file (the script automatically completes template reading, placeholder filling, null parameter replacement, and appending the sensitive-word avoidance instruction at the end of SIZE stage 2),Prohibitedto manually assemble the prompt with the Write tool or capture large text with shell variables. SIZE stage 2'sanalysis_resultuses--analysis-fileinjection, to avoid large text passing through the shell.③textgen rewrite branch constraints (SCENE, SELLING_POINT, *_APLUS, SIZE stage 1): must use this skill's
build_textgen_params.pyauxiliary script to build the textgen parameter file (the script automatically completes template reading, placeholder filling, model/thinkingLevel settings, and appending the selling point·A+ sensitive-word avoidance instruction), then execute according to the textgen SKILL.md'schained invocation method.Image set must go through the pipeline's three stages: the image set path uses
scripts/run_collection_pipeline.pyto run the plan / dispatch / summary three stages; the agent sends 3 Bash commands in sequence; concurrency is handled by the skill-layer dispatch usingThreadPoolExecutor,the agent itself does not run concurrently:
--phase planwritesimage-plan.json/collection-state.json, stdout directly prints a markdown table + 1 line of status JSON (includingspecs[]/run_one_task_script/state_file/total)- after user confirmation, the agent sends only 1 dispatch Bash:
python <本skill根>/scripts/run_collection_pipeline.py --phase dispatch --state <state_file>; inside dispatch, useThreadPoolExecutorto concurrently runrun_one_task.py --index 1..N, each subtask writes atask-result-<id>.jsonfragment; dispatch's own stdout does not emitSaved full response, only 1 line at the end of{"status":"dispatch_complete",...}for the agent to parse internally (this Bash does not render images, which is normal)--phase summary --state <state_file>reads fragments → stdout prints the final markdown details (each successful image comes withinline reference, and the frontend markdown renderer renders the entire image set based on this) + 1 line of status JSON; product variant simultaneously writescollection-asset-manifest.jsonProhibited for the Agent to manually complete S1 reasoning or Read the full text of S0~S3 in the conversation;Prohibitedfor the user to, after confirmation, split it themselves into N Bash commands to run
run_one_task.py(old protocol; concurrency is now completed at the skill layer, and doing it yourself will only duplicate image generation);Prohibitedwhen forwarding the summary markdown, to strip out the![]()lines (the entire image set relies on these lines for rendering);Prohibitedto additionally paste outside the summarySaved full response: [...](which would double-render with the markdown![]()). The bash single-step chain belowapplies only to single-image direct output。Path iron rule: this chain spans two skill directories (the parameter-building script belongs to this skill, while the text-generation and parameter-injection scripts belong to
linkfox-aigc-textgen), the current working directory is not fixed,all scripts must be invoked with absolute paths, do not use barescripts/...relative paths(relative paths will point to the wrong directory and cause execution failure). Among them,<本skill根目录>= the absolute path of the directory where this SKILL.md is located;<textgen根目录>is obtained byskill:linkfox-aigc-textgenresolving the absolute path of the directory where its SKILL.md is located.
- Parameter building (this skill):
python <本skill根目录>/scripts/build_textgen_params.py --type <TYPE> ... --out <textgen_params.json>- Text generation (textgen skill):
PROMPT=$(python <textgen根目录>/scripts/aigc_textgen.py --stdin --content-only < <textgen_params.json>)——--content-onlyoutput single-line content captured into a variable (the mechanism for flattening newlines into⏎and automatically restoring them downstream is described in textgen SKILL.md).- Parameter injection (step 3, using
jqinline): usejqto$PROMPTinline-splice into the downstream imagegen parameter JSON, then hand tolinkfox-aigc-imagegento generate the image.PROMPT=$(python <textgen根目录>/scripts/aigc_textgen.py --stdin --content-only < <textgen_params.json>) PARAMS=$(jq -nc --arg p "$PROMPT" --argjson imgs '<步骤1的URL JSON数组>' \ '{prompt:$p, imageUrls:$imgs, provider:"<provider>", outputNum:1, aspectRatio:"<ratio>", resolution:"<resolution>"}') # 然后按 linkfox-aigc-imagegen SKILL.md 的调用方式把 $PARAMS 传入出图Prohibitedto manually construct the textgen parameter file with the Write tool (must go through
build_textgen_params.py), usejq -rto extract the raw content (which would reintroduce real newline characters and break the splicing), or directly write Python to call the API bypassing this chain.
Step 3: call linkfox-aigc-imagegen to generate the image (common to all types)
- Input: the
promptfrom step 2, theimageUrls、ratio、resolution、provider - Operation:Read
skill:linkfox-aigc-imagegenof the SKILL.md, execute the image generation script according to its invocation method. Pass in parameters:prompt: the final prompt produced in step 2imageUrls: all image URLs from step 1provider: the model specified by the input parameters (defaultBANANA_PRO)aspectRatio:ratiopassed through as-isresolution: passed through as-isoutputNum:1
- Output: image (
Saved full response:local path after) - Single-image direct delivery (by type): this skill's single-image direct delivery scenario follows
references/runtime/03-deliver.md§3.1; after the imagegen Bash completes, the agent must:-
Parse the
Saved full response: ["..."]of stdout to get the local path (1 image on success) -
In the conversation reply body,append a markdown inline block:
- 第 1 张 · <类型中文名>  -
Type Chinese name mapping: SCENE→种草图 / SELLING_POINT→卖点图 / MODEL_IMAGE→模特图 / SIZE→尺码图 / WHITE_BG→白底图 / PREMIUM_APLUS→高级A+图 / STANDARD_APLUS→普通A+图 / PHONE_APLUS→手机A+图
-
Prohibitedto repeat the
Saved full response: [...]/Saved full response: <json路径>protocol text verbatim into the conversation reply—it is an internal skill ↔ bridge protocol line, and repeating it would let the user see a bare JSON array path (i.e., the "protocol line exposed" failure); only read it to get the path, do not copy the literal text -
Prohibitedto echo the
Saved full response:literal yourself to make the bridge render it again—the bridge path A's "task output" resource card is automatically triggered by the imagegen Bash stdout; the agent must not manually copy it -
Double rendering(markdown inline image + bridge "task output" resource card presented simultaneously) is expected behavior under the current protocol and is not a failure
-
Failure case (stdout is
Saved full response: <data 路径>.jsonsingle file) report truthfully according to this SKILL.md's "Error Handling and Failure Guardrails", do not append an inline image
-
Intermediate artifacts persisted to disk (mandatory)
All files that need to be reused across steps or delivered must be written to the session directory <cwd>/linkfox/<YYYY-MM-DD>/<session>/{data|media}/(protocol see repository CLAUDE.md"Output File Location").
| Artifact type | Directory | How to obtain |
|---|---|---|
| Brand gene JSON | data/ |
linkfox-aigc-imagegen-brand-gene-extract of save_brand_gene.py |
| Image set plan image-plan.json | data/ |
After S2 confirmation, scripts/save_image_plan.py append item by item and persist to disk |
| imageUrls array | data/ |
After step 1 validation, Write to $DATADIR/image-urls.json(usually very small) |
| task-result-*.json | data/ |
Each run_one_task.py task result fragment persisted to disk after completion; the summary phase reads them and aggregates the markdown at the end |
| Single-image parameter-construction JSON (textgen/imagegen input parameters) | data/ |
build_textgen_params.py / build_imagegen_prompt.py of --out(single-image direct-output scenario only) |
| Result image | media/ |
linkfox-aigc-imagegen script automatically writes to disk |
DATADIR=$(python <brand-gene根目录>/scripts/save_brand_gene.py --datadir); the downstream --brand-gene-file points to the absolute path of the brand genes written to disk by S1.
Downstream skill invocation conventions
This skill depends on the two downstream skills in the table below,invoked in the documented manner: first Read the other party's SKILL.md to understand its invocation method; for single-image direct output use the chained commands in steps 2/3, and for image sets use scripts/run_collection_pipeline.py + scripts/run_one_task.py orchestration—both invoke the downstream official scripts viaabsolute pathsas documented (this is allowed). This skill's bundled build_textgen_params.py / build_imagegen_prompt.py / run_collection_pipeline.py / run_one_task.py etc. are parameter-construction and orchestration helper scripts that can be run directly. Assembling invocations on your own outside the above documented chains, or connecting directly to downstream HTTP APIs, is what is not allowed.
| Downstream skill | Purpose | Invocation timing |
|---|---|---|
linkfox-aigc-imagegen |
AI image generation | Step 3 (all types) |
linkfox-aigc-textgen |
Prompt rewriting / pre-analysis | Step 2 (SCENE, SELLING_POINT, *_APLUS, SIZE stage 1) |
Invocation method: Read skill:<skill-name> 's SKILL.md and execute according to its invocation method section.
Shared input parameters
The following parameters are common to all types (type-specific parameters are in each type reference):
| Parameter | Type | Default | Description |
|---|---|---|---|
imageUrls |
string[] | Required | Clothing reference image URL. Step 1 verifies accessibility |
ratio |
string | Depends on type | Image aspect ratio, passed through as-is to imagegen's aspectRatio |
resolution |
string | 2K | Resolution, 2K / 4K |
provider |
string | — | Image generation model (BANANA_PRO / GPT_2_IMAGE / BANANA_2 / AIDRAW_EDIT / WAN2_7); if not provided, use AskUserQuestion to let the user choose from the above 5 models |
Error handling and failure guardrails
linkfox-aigc-imagegenskill also returns exit 0 forbusiness failures(not a non-zero exit), soyou cannot judge success or failure by the command exit code; you must parse stdout。
1. How to determine the success or failure of a single invocation
- Success: stdout contains
Saved full response: ["xxx.png", ...](JSON array path) → the image has been written to disk under media/; take the path and display it. - Failure: stdout contains
Saved full response: xxx.json(a single JSON file path, not an array) → no image output; you need to read that JSON to view error details (errcode/errmsg/error)。
2. How to handle failures (routed by type)
| Failure type | Basis for determination | Handling |
|---|---|---|
| Invalid parameters | errmsg/errorMsg points to provider、aspectRatio、resolution、quality and other input parameters are not accepted |
Use AskUserQuestion to let the user reselect the corresponding parameter |
| Authentication failure | errcode==401 or indicates an API Key issue |
Stop and prompt the user to configure LINKFOX_AGENT_API_KEY, do not retry |
| Transient error | error is a network/timeout/connection failure (Connection failed, timeout, etc.) |
Automatically retry at most 1 time; if it fails again, switch to "Other errors" |
| Other errors | Quota, content rejected, server-side 5xx, unknown errcode, etc. | Do not retry, truthfully inform the user of the failure reason |
3. Hard guardrails (violation is considered a fault)
- ❌ It is forbidden to switch to any other skill due to image generation failure—this skill's image generation path is unique (
linkfox-aigc-imagegen); if it fails, handle it according to the table above or report it, and never "try another skill." - ❌ Unlimited retries are forbidden: except for "transient errors at most 1 time," the same type of failure must not be retried repeatedly.
- ❌ It is forbidden to treat a failed response body as a successand continue onward (displaying an empty image, telling the user "generated").
Global Rules
Model Type Rules
This skill supports the following 5 image generation models; the model is passed in by the agent layer through the provider parameter; if not passed in, this skill confirms it with the user.
| Model Name | Internal Code |
|---|---|
| LFBanana Pro | BANANA_PRO |
| Img2 | GPT_2_IMAGE |
| LFBanana2 | BANANA_2 |
| Linkfox-Image-1 | AIDRAW_EDIT |
| Wan 2.7 | WAN2_7 |
Model Confirmation: if provider is empty or not in the table above, use AskUserQuestion to let the user choose from the above 5 models, and continue execution after the user selects. Pass provider uniformly to step 3.
Resolution Rules
Resolution is a required parameter for step 3. This skill supports 2K、4K。
- The agent layer passed through
resolution(value is 2K or 4K): use directly - The agent layer did not pass it through: use
AskUserQuestionto let the user choose from 2K / 4K
Task Independence Statement
Each image in the image set is anindependent task, and the tasks do not depend on each other. Failure to generate an image for a single type does not affect the continued execution of the remaining tasks.
Execution-phase Constraints
- No upload step: clothing images are passed in
imageUrlsform directly; this skill does not involve local file upload operations (except for the URL validation in step 1), and it is forbidden to probe or call any upload script. - Plan management tool usage specifications: the plan tool is not used for single-image direct output. Before concurrent image set generation, a task plan must be created for the N images (see
references/runtime/02-confirm.md)。 - Image Set Persistence: plan / summary are written to disk by
run_collection_pipeline.py;Forbidden For the Agent to Write the entire image-plan from memory. - Listing report write-back to asset manifest (mandatory): if the image set results are to be merged into the Listing HTML, the caller must retain
$DATADIR/collection-asset-manifest.json, and before merge replace the localmedia/path in the manifest vialinkfox-file-uploadwith a public OSS URL. This skill does not upload directly, but must not imply that local paths can be written directly into the HTML.
Image Set Orchestration Flow (runtime, progressive Read)
Triggered only by the image set path; for single-image direct output, do not Read this section.
| Step | Read | Operation |
|---|---|---|
| Entry | references/runtime/00-index.md |
S0 Scenario Determination |
| plan | references/runtime/01-plan.md |
Write job.json → --phase plan, forward the stdout markdown table as-is + AskUserQuestion |
| Confirm → dispatch → summary | references/runtime/02-confirm.md |
User confirms → agent sends 1 --phase dispatch Bash (the skill layer concurrently runs all run_one_task.py, without rendering images) → immediately followed by 1 --phase summary Bash writes manifest + types with ![]() 's markdown details |
For maintenance details (complete rules for scenarios A/G, historical S1 copywriting guidelines), see references/maintainer/collection/,Read is prohibited at runtime。
Known limitations
- The white-background image template is a static instruction and strongly depends on the model's determination of **viewpoint (front/back)andfit (men's wear/women's wear/children's wear)**; a wrong determination will affect silhouette and volume reconstruction.
- The model-image pipeline does not call textgen and does not pass through sensitive-word filtering; all decoding and composition judgments are pressed onto the image model's single image generation; the template only consumes
{image_desc}, and market-oriented ethnicity / brand tone strong control must be passed in viaimageDesctextual description. - The product-seeding image strongly depends on
linkfox-aigc-textgen(GEM_3_FLASH) for determining the target audience / age (children's wear vs. adult wear) / gender; a wrong determination will directly propagate to the model portrait and scene composition. - Selling-point images / A+ share dictionary templates and rely on
{layoutInfo}to distinguish them; filling in the intent incorrectly will cause layout type mix-ups. Selling-point images / A+ images include sensitive-word avoidance in the textgen step. - The size chart is a two-stage pipeline: stage 1
analysis_resultquality directly determines stage 2's category determination and prompt copy for the size chart; stage 2's sensitive-word avoidance is downgraded to "appending an avoidance instruction at the end of the final prompt sent to imagegen, with the image model self-reviewing," with no deterministic word-list fallback. - When there are multiple reference images, the model determines the subject clothing role on its own; under complex combinations, it may misjudge the main image.
- Branches that do not perform sensitive-word rewriting (product-seeding images/model images/white-background images): if the selling points/scene contain prohibited content, this pipeline does not intercept it, and upstream or manual review is responsible.
Solve authentication and compute power issues
When the following abnormal situations occur, use references/onboarding.md to guide problem resolution:
Abnormal situations
- API Key not configured: environment variable not configured
LINKFOX_AGENT_API_KEY, and also not configuredLINKFOXAGENT_API_KEY。 - Response 401 or 402 status code
- Response indicates insufficient compute power or balance:the message contains "insufficient compute balance/insufficient billing/insufficient balance/quota exceeded/insufficient balance/package expired/recharge required/please recharge," or similar meaning.