linkfox-aigc-imagegen-cloth

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

服饰图生成

Apparel Image Generation

统一入口:服饰 / 模特类商品(上装、下装、连衣裙、外套、鞋帽等)的全类型电商出图能力。单张直出 & 套图编排都从这一个 skill 进入。
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

条件路径操作
只要一张特定类型的图(如"做一张模特图")单张直出确定 type → Read 对应
references/types/<type>.md
→ 执行共享流水线
要多张 / 多类型 / 套图(如"做一套图""出5张图")套图编排Read
references/runtime/00-index.md
→ 按步 Read
01-plan
/
02-confirm
→ 调
scripts/run_collection_pipeline.py
三阶段(plan / dispatch / summary,agent 顺序发 3 个 Bash;dispatch 在 skill 层用
ThreadPoolExecutor
并发跑
scripts/run_one_task.py
,agent 自己并发;禁止 Read
maintainer/collection/
或套图阶段 Read
types/*.md
ConditionPathOperation
Only need one image of a specific type (e.g., "make a model image")Single-image Direct GenerationConfirm 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 OrchestrationRead
references/runtime/00-index.md
→ Read
01-plan
/
02-confirm
step by step → Call
scripts/run_collection_pipeline.py
three phases (plan / dispatch / summary, agent sends 3 Bash commands in sequence; dispatch uses
ThreadPoolExecutor
at skill layer to run
scripts/run_one_task.py
concurrently, agent itself does not handle concurrency; FORBID reading
maintainer/collection/
during image-set phase or reading
types/*.md
during image-set phase)

类型路由表

Type Routing Table

type名称与卖点关联是否有画面描述默认比例支线是否走 textgen详情 reference
WHITE_BG白底图(隐形模特)1:1①静态直出
references/types/white-bg.md
MODEL_IMAGE模特图1:1②占位符直出
references/types/model-image.md
SCENE种草图1:1③textgen 改写
references/types/scene.md
SELLING_POINT卖点图1:1③textgen 改写
references/types/selling-point.md
PREMIUM_APLUS高级A+图1464:600③textgen 改写
references/types/aplus.md
STANDARD_APLUS普通A+图970:600③textgen 改写
references/types/aplus.md
PHONE_APLUS手机A+图600:450③textgen 改写
references/types/aplus.md
SIZE尺码图1:1两阶段:①阶段1=③textgen 前置分析 + ②阶段2=占位符直出阶段1是/阶段2否
references/types/size.md
确定 type 后,必须 Read 对应的 type reference 文件获取该类型走哪条支线、步骤 2 差异逻辑和运行时模板来源,禁止跳过
typeNameAssociated with Selling PointsHas Scene DescriptionDefault Aspect RatioBranchUses textgenDetails Reference
WHITE_BGWhite Background Image (Invisible Model)NoNo1:1①Static Direct GenerationNo
references/types/white-bg.md
MODEL_IMAGEModel ImageNoYes1:1②Placeholder Direct GenerationNo
references/types/model-image.md
SCENELifestyle Marketing ImageYesYes1:1③textgen RewritingYes
references/types/scene.md
SELLING_POINTSelling Point ImageYesYes1:1③textgen RewritingYes
references/types/selling-point.md
PREMIUM_APLUSPremium A+ ImageYesYes1464:600③textgen RewritingYes
references/types/aplus.md
STANDARD_APLUSStandard A+ ImageYesYes970:600③textgen RewritingYes
references/types/aplus.md
PHONE_APLUSMobile A+ ImageYesYes600:450③textgen RewritingYes
references/types/aplus.md
SIZESize Chart ImageNoYes1:1Two phases: ①Phase 1 = ③textgen Pre-analysis + ②Phase 2 = Placeholder Direct GenerationYes in Phase 1 / No in Phase 2
references/types/size.md
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

  • 非服饰类实物商品(美妆、数码、家居、食品等)→ 走
    linkfox-aigc-imagegen-product
    系列。
  • 纯图片编辑操作(换背景、去水印、换角度等已有明确创意方向的操作)→ 走
    linkfox-aigc-imagegen
  • 已有模特图换姿势 / 换动作裂变(模特裂变)→ 不在本范围(业务方上游构造 posePrompt,不读字典)。
  • 纯文字生成 →
    linkfox-aigc-textgen
  • 视频生成 →
    linkfox-aigc-videogen
  • 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
    linkfox-aigc-imagegen
    .
  • Pose/action variation of existing model images (model variation) → Not within this scope (business side constructs posePrompt upstream, no dictionary reading).
  • Pure text generation →
    linkfox-aigc-textgen
    .
  • Video generation →
    linkfox-aigc-videogen
    .

共享流水线

Shared Pipeline

所有类型都走同一条 3 步流水线(尺码图为两阶段,见下),步骤 2 的差异由各 type reference 指定走哪条支线。
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.

三条支线(步骤 2 的差异本质)

Three Branches (Essence of Differences in Step 2)

支线机制是否填占位符是否调 textgen是否过敏感词适用类型
① 静态直出
scripts/build_imagegen_prompt.py --type WHITE_BG
white-bg.md
动态提取静态正文作为最终 prompt
WHITE_BG
② 占位符直出模板填占位符后直接出图(用
scripts/build_imagegen_prompt.py
MODEL_IMAGE 否 / SIZE 阶段2 末尾追加规避指令MODEL_IMAGE、SIZE 阶段2
③ textgen 改写模板填占位符 →
linkfox-aigc-textgen
改写出最终 prompt(用
scripts/build_textgen_params.py
SCENE 否 / 卖点·A+ 是 / SIZE 阶段1 否SCENE、SELLING_POINT、*_APLUS、SIZE 阶段1
BranchMechanismFills PlaceholdersCalls textgenChecks Sensitive WordsApplicable Types
① Static Direct GenerationUse
scripts/build_imagegen_prompt.py --type WHITE_BG
to dynamically extract static content from
white-bg.md
as the final prompt
NoNoNoWHITE_BG
② Placeholder Direct GenerationGenerate images directly after filling placeholders in templates (using
scripts/build_imagegen_prompt.py
)
YesNoNo for MODEL_IMAGE / Append avoidance instructions at the end of SIZE Phase 2MODEL_IMAGE, SIZE Phase 2
③ textgen RewritingFill placeholders in templates →
linkfox-aigc-textgen
rewrites to get the final prompt (using
scripts/build_textgen_params.py
)
YesYesNo for SCENE / Yes for Selling Point & A+ / No for SIZE Phase 1SCENE, SELLING_POINT, *_APLUS, SIZE Phase 1

步骤 1:校验图片 URL 可访问性(所有类型通用)

Step 1: Verify Accessibility of Image URLs (Universal for All Types)

  • 输入
    imageUrls
  • 空数组护栏(强制):若
    imageUrls
    为空数组 / 缺失 / 全部无效,立即停止,不得带空图调下游。优先从上下文(用户本轮/历史上传的原始图片路径)补齐;仍无法补齐时如实向用户报错并请求重新上传,禁止带空
    imageUrls
    继续执行。
  • 操作:逐项检查
    imageUrls
    中的值(保持原顺序):已是公开 URL(http/https 开头)→ 直接透传;本地文件路径(非 http/https)→ 调
    linkfox-file-upload
    上传获得公开 URL 后替换。
  • 输出
    imageUrls
    (全部为公开可访问的 HTTPS URL)
  • Input:
    imageUrls
  • Empty Array Guard (Mandatory): If
    imageUrls
    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
    imageUrls
    .
  • Operation: Check each value in
    imageUrls
    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
    linkfox-file-upload
    to upload and get a public URL for replacement.
  • Output:
    imageUrls
    (all are publicly accessible HTTPS URLs)

步骤 2:构造最终 prompt(差异部分见各 type reference)

Step 2: Construct Final Prompt (Differences Refer to Each Type Reference)

各类型的步骤 2 逻辑不同(走哪条支线、用哪个模型、是否做敏感词规避等),详见已 Read 的
references/types/<type>.md
①静态直出支线约束(WHITE_BG):用
scripts/build_imagegen_prompt.py --type WHITE_BG
构建 imagegen 参数文件,脚本会自动从
references/types/white-bg.md
text
代码块提取白底图静态正文作为最终 prompt。正文较长,一律交脚本读取,不要手动复制或经 shell 变量传递
②占位符直出支线约束(MODEL_IMAGE、SIZE 阶段2):必须使用本 skill 的
scripts/build_imagegen_prompt.py
辅助脚本构建 imagegen 提示词参数文件(脚本自动完成模板读取、占位符填充、null 入参替换、SIZE 阶段2 末尾敏感词规避指令追加),禁止手动用 Write 工具拼接 prompt 或用 shell 变量捕获大文本。SIZE 阶段2 的
analysis_result
--analysis-file
注入,避免大文本经 shell。
③textgen 改写支线约束(SCENE、SELLING_POINT、*_APLUS、SIZE 阶段1):必须使用本 skill 的
build_textgen_params.py
辅助脚本构建 textgen 参数文件(脚本自动完成模板读取、占位符填充、模型/thinkingLevel 设置、卖点·A+ 敏感词规避指令追加),然后按 textgen SKILL.md 的链式调用方式执行。
套图强制走 pipeline 三阶段:套图路径用
scripts/run_collection_pipeline.py
跑 plan / dispatch / summary 三阶段,agent 按顺序发 3 个 Bash;并发由 skill 层 dispatch 用
ThreadPoolExecutor
完成,agent 自己不并发
  1. --phase plan
    image-plan.json
    /
    collection-state.json
    ,stdout 直接打 markdown 表格 + 1 行 status JSON(含
    specs[]
    /
    run_one_task_script
    /
    state_file
    /
    total
  2. 用户确认后,agent 只发 1 个 dispatch Bash:
    python <本skill根>/scripts/run_collection_pipeline.py --phase dispatch --state <state_file>
    ;dispatch 内部用
    ThreadPoolExecutor
    并发跑
    run_one_task.py --index 1..N
    ,每个子任务落
    task-result-<id>.json
    片段;dispatch 自身 stdout emit
    Saved full response
    ,仅末尾 1 行
    {"status":"dispatch_complete",...}
    供 agent 内部解析(这条 Bash 不渲染图,是正常的)
  3. --phase summary --state <state_file>
    读片段 → stdout 打末尾 markdown 明细(每张成功图自带
    ![label](abs_path)
    内联引用
    ,前端 markdown 渲染器据此渲染整组图)+ 1 行 status JSON;product variant 同时写
    collection-asset-manifest.json
禁止 Agent 在对话中手工完成 S1 推理或 Read S0~S3 全文;禁止用户确认后自己拆 N 个 Bash 跑
run_one_task.py
(旧协议;现在并发已在 skill 层完成,自己并发只会重复出图);禁止转发 summary markdown 时把
![]()
行剥掉(整组图就靠这些行渲染);禁止在 summary 之外另贴
Saved full response: [...]
(与 markdown
![]()
双重渲染)。下方 bash 单步链路仅适用于单张直出
路径铁律:本链路横跨两个 skill 目录(构参脚本属本 skill,生文与注参脚本属
linkfox-aigc-textgen
),当前工作目录不固定,所有脚本一律用绝对路径调用,不要用裸
scripts/...
相对路径
(相对路径会指向错误目录导致执行失败)。其中
<本skill根目录>
= 本 SKILL.md 所在目录的绝对路径;
<textgen根目录>
通过
skill:linkfox-aigc-textgen
解析其 SKILL.md 所在目录的绝对路径取得。
  1. 构参(本 skill):
    python <本skill根目录>/scripts/build_textgen_params.py --type <TYPE> ... --out <textgen_params.json>
  2. 生文(textgen skill):
    PROMPT=$(python <textgen根目录>/scripts/aigc_textgen.py --stdin --content-only < <textgen_params.json>)
    ——
    --content-only
    输出单行 content 捕获进变量(换行压平为
    、下游自动还原的机制见 textgen SKILL.md)。
  3. 注参(步骤 3,用
    jq
    内联):用
    jq
    $PROMPT
    内联拼进下游 imagegen 参数 JSON,再交
    linkfox-aigc-imagegen
    出图。
    bash
    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 传入出图
禁止手动用 Write 工具构造 textgen 参数文件(必须经
build_textgen_params.py
)、用
jq -r
抽取原始 content(会重新引入真实换行符破坏拼接)、或直接写 Python 调 API 绕过此链路。
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
text
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
analysis_result
of SIZE Phase 2 using
--analysis-file
to avoid passing large text via shell.
Constraints for ③textgen Rewriting Branch (SCENE, SELLING_POINT, *_APLUS, SIZE Phase 1): Must use the
build_textgen_params.py
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
ThreadPoolExecutor
at skill layer during dispatch, agent itself does not handle concurrency:
  1. --phase plan
    writes
    image-plan.json
    /
    collection-state.json
    , stdout directly outputs markdown table + 1 line of status JSON (including
    specs[]
    /
    run_one_task_script
    /
    state_file
    /
    total
    )
  2. 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
    ThreadPoolExecutor
    to run
    run_one_task.py --index 1..N
    concurrently, each subtask outputs
    task-result-<id>.json
    fragment; dispatch itself does not emit
    Saved full response
    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)
  3. --phase summary --state <state_file>
    reads fragments → stdout outputs final markdown details (each successful image comes with
    ![label](abs_path)
    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
run_one_task.py
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
linkfox-aigc-textgen
), the current working directory is not fixed. All scripts must be called with absolute paths, do not use bare
scripts/...
relative paths
(relative paths will point to wrong directories and cause execution failure). Where
<root of this skill>
= absolute path of the directory where this SKILL.md is located;
<textgen root directory>
is obtained by parsing the absolute path of the directory where SKILL.md of
skill:linkfox-aigc-textgen
is located.
  1. Parameter Construction (this skill):
    python <root of this skill>/scripts/build_textgen_params.py --type <TYPE> ... --out <textgen_params.json>
  2. Text Generation (textgen skill):
    PROMPT=$(python <textgen root directory>/scripts/aigc_textgen.py --stdin --content-only < <textgen_params.json>)
    ——
    --content-only
    outputs single-line content captured into variable (line breaks are flattened to
    , the mechanism for downstream automatic restoration is in textgen SKILL.md).
  3. Parameter Injection (Step 3, inline with
    jq
    ): Use
    jq
    to inline
    $PROMPT
    into downstream imagegen parameter JSON, then pass to
    linkfox-aigc-imagegen
    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
build_textgen_params.py
), extracting original content with
jq -r
(will reintroduce real line breaks and break splicing), or directly writing Python to call API to bypass this link.

步骤 3:调
linkfox-aigc-imagegen
出图(所有类型通用)

Step 3: Call
linkfox-aigc-imagegen
for Image Generation (Universal for All Types)

  • 输入:步骤 2 的
    prompt
    、步骤 1 的
    imageUrls
    ratio
    resolution
    provider
  • 操作Read
    skill:linkfox-aigc-imagegen
    的 SKILL.md,按其调用方式执行出图脚本
    。传入参数:
    • prompt
      :步骤 2 产出的最终 prompt
    • imageUrls
      :步骤 1 的全部图片 URL
    • provider
      :入参指定的模型(默认
      BANANA_PRO
    • aspectRatio
      ratio
      原样透传
    • resolution
      :原样透传
    • outputNum
      1
  • 输出:图片(
    Saved full response:
    后的本地路径)
  • 单张直出交付(按类型):本 skill 单张直出场景按
    references/runtime/03-deliver.md
    §3.1 走,agent 在 imagegen Bash 完成后必须:
    1. 解析 stdout 的
      Saved full response: ["..."]
      取本地路径(成功时 1 张)
    2. 在对话回复正文里追加 markdown 内联块:
      markdown
      - 第 1 张 · <类型中文名>
        ![<类型中文名>](<abs_path>)
    3. 类型中文名对照:SCENE→种草图 / SELLING_POINT→卖点图 / MODEL_IMAGE→模特图 / SIZE→尺码图 / WHITE_BG→白底图 / PREMIUM_APLUS→高级A+图 / STANDARD_APLUS→普通A+图 / PHONE_APLUS→手机A+图
    4. 禁止
      Saved full response: [...]
      /
      Saved full response: <json路径>
      协议原文复述进对话回复——它是 skill ↔ bridge 内部协议行,复述会让用户看到裸露的 JSON 数组路径(即"协议行裸露"故障);只读它取路径,不抄字面
    5. 禁止自行 echo 一遍
      Saved full response:
      字面让 bridge 再渲染——bridge 路径 A 的「任务产出」资源卡是 imagegen Bash stdout 自动触发的,agent 不要手动复制
    6. 双重渲染(markdown 内联图 + bridge「任务产出」资源卡同时呈现)是当前协议下的预期行为,不算故障
    7. 失败情形(stdout 是
      Saved full response: <data 路径>.json
      单文件)按本 SKILL.md「错误处理与失败护栏」如实告知,不追加内联图
  • Input:
    prompt
    from Step 2,
    imageUrls
    from Step 1,
    ratio
    ,
    resolution
    ,
    provider
  • Operation: Read SKILL.md of
    skill:linkfox-aigc-imagegen
    and execute image generation script according to its calling method
    . Pass parameters:
    • prompt
      : Final prompt produced in Step 2
    • imageUrls
      : All image URLs from Step 1
    • provider
      : Model specified by input (default
      BANANA_PRO
      )
    • aspectRatio
      : Pass
      ratio
      as is
    • resolution
      : Pass as is
    • outputNum
      :
      1
  • Output: Image (local path after
    Saved full response:
    )
  • 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:
    1. Parse
      Saved full response: ["..."]
      in stdout to get local path (1 image on success)
    2. Append markdown inline block to conversation reply content:
      markdown
      - Image 1 · <Chinese name of type>
        ![<Chinese name of type>](<abs_path>)
    3. 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
    4. 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
    5. FORBID manually echoing
      Saved full response:
      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
    6. Double rendering (markdown inline image + bridge "task output" resource card displayed simultaneously) is expected behavior under current protocol, not a fault
    7. 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)

所有要跨步骤复用或交付的文件一律落到会话目录
<cwd>/linkfox/<YYYY-MM-DD>/<session>/{data|media}/
(协议见仓库
CLAUDE.md
「输出文件位置」)。
产物类型目录获取方式
品牌基因 JSON
data/
linkfox-aigc-imagegen-brand-gene-extract
save_brand_gene.py
套图规划 image-plan.json
data/
S2 确认后
scripts/save_image_plan.py
逐条追加落盘
imageUrls 数组
data/
步骤 1 校验后 Write 到
$DATADIR/image-urls.json
(通常很小)
task-result-*.json
data/
每个
run_one_task.py
完成后落盘的任务结果片段,summary phase 读后汇总末尾 markdown
单张构参 JSON(textgen/imagegen 入参)
data/
build_textgen_params.py
/
build_imagegen_prompt.py
--out
(仅单张直出场景)
结果图
media/
linkfox-aigc-imagegen
脚本自动落盘
DATADIR=$(python <brand-gene根目录>/scripts/save_brand_gene.py --datadir)
;下游
--brand-gene-file
指向 S1 落盘的品牌基因绝对路径。
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
CLAUDE.md
).
Product TypeDirectoryAcquisition Method
Brand Gene JSON
data/
save_brand_gene.py
of
linkfox-aigc-imagegen-brand-gene-extract
Image-set Plan image-plan.json
data/
Saved and appended item by item with
scripts/save_image_plan.py
after S2 confirmation
imageUrls Array
data/
Write to
$DATADIR/image-urls.json
after Step 1 verification (usually small)
task-result-*.json
data/
Task result fragment stored after each
run_one_task.py
completes, read and summarized into final markdown in summary phase
Single-image Parameter Construction JSON (textgen/imagegen input)
data/
--out
of
build_textgen_params.py
/
build_imagegen_prompt.py
(only for single-image direct generation scenario)
Result Image
media/
Automatically stored by
linkfox-aigc-imagegen
script
DATADIR=$(python <brand-gene root directory>/scripts/save_brand_gene.py --datadir)
; downstream
--brand-gene-file
points to the absolute path of brand gene stored in S1.

下游 skill 调用约定

Downstream Skill Calling Convention

本 skill 依赖下表两个下游 skill,按文档化方式调用:先 Read 对方 SKILL.md 了解其调用方式,单张直出按步骤 2/3 的链式命令、套图按
scripts/run_collection_pipeline.py
+
scripts/run_one_task.py
编排——两者都按文档以绝对路径调用下游官方脚本(这是允许的)。本 skill 自带的
build_textgen_params.py
/
build_imagegen_prompt.py
/
run_collection_pipeline.py
/
run_one_task.py
等是参数构建与编排辅助脚本,可直接运行。脱离上述文档化链路自行拼调用、或直连下游 HTTP API 才是不允许的。
下游 skill用途调用时机
linkfox-aigc-imagegen
AI 生图步骤 3(所有类型)
linkfox-aigc-textgen
提示词改写 / 前置分析步骤 2(SCENE、SELLING_POINT、*_APLUS、SIZE 阶段1)
调用方式:Read
skill:<skill-name>
的 SKILL.md,按其中的调用方式章节执行。
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
+
scripts/run_one_task.py
—— both call downstream official scripts with absolute paths as documented (this is allowed). Auxiliary scripts like
build_textgen_params.py
/
build_imagegen_prompt.py
/
run_collection_pipeline.py
/
run_one_task.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 SkillPurposeCalling Timing
linkfox-aigc-imagegen
AI Image GenerationStep 3 (all types)
linkfox-aigc-textgen
Prompt Rewriting / Pre-analysisStep 2 (SCENE, SELLING_POINT, *_APLUS, SIZE Phase 1)
Calling Method: Read SKILL.md of
skill:<skill-name>
and execute according to its calling method section.

共享输入参数

Shared Input Parameters

以下参数为所有类型通用(类型特有参数见各 type reference):
参数类型默认说明
imageUrls
string[]必填服饰参考图 URL。步骤 1 会校验可访问性
ratio
string随类型图片比例,原样透传给 imagegen 的
aspectRatio
resolution
string2K分辨率,2K / 4K
provider
string生图模型(
BANANA_PRO
/
GPT_2_IMAGE
/
BANANA_2
/
AIDRAW_EDIT
/
WAN2_7
);未传入时用
AskUserQuestion
让用户从上述 5 个模型中选择
The following parameters are universal for all types (type-specific parameters see each type reference):
ParameterTypeDefaultDescription
imageUrls
string[]RequiredURLs of apparel reference images. Step 1 will verify accessibility
ratio
stringVaries by typeImage aspect ratio, passed to
aspectRatio
of imagegen as is
resolution
string2KResolution, 2K / 4K
provider
stringImage generation model (
BANANA_PRO
/
GPT_2_IMAGE
/
BANANA_2
/
AIDRAW_EDIT
/
WAN2_7
); if not passed, use
AskUserQuestion
to let user select from the above 5 models

错误处理与失败护栏

Error Handling and Failure Guards

linkfox-aigc-imagegen
skill 对业务失败也返回 exit 0(不是非零退出),所以不能靠命令退出码判断成败,必须解析 stdout
1. 怎么判一次调用成败
  • 成功:stdout 含
    Saved full response: ["xxx.png", ...]
    (JSON 数组路径)→ 图片已落盘 media/,取路径展示。
  • 失败:stdout 含
    Saved full response: xxx.json
    (单个 JSON 文件路径,非数组)→ 无图片产物,需读该 JSON 查看错误详情(
    errcode
    /
    errmsg
    /
    error
    )。
2. 失败怎么处理(按类型分流)
失败类型判断依据处理
参数非法
errmsg
/
errorMsg
指向
provider
aspectRatio
resolution
quality
等入参不被接受
AskUserQuestion
让用户重选对应参数
认证失败
errcode==401
或提示 API Key
停止并提示用户配置
LINKFOX_AGENT_API_KEY
,不重试
瞬时错误
error
为网络/超时/连接失败(
Connection failed
、timeout 等)
最多自动重试 1 次;再失败转「其它错误」
其它错误配额、内容被拒、服务端 5xx、未知 errcode 等不重试,如实告知用户失败原因
3. 硬性护栏(违反即视为故障)
  • 禁止因生图失败改调任何其它 skill——本 skill 的生图路径唯一(
    linkfox-aigc-imagegen
    ),失败就按上表处理或上报,绝不"换一个 skill 试试"。
  • 禁止无上限重试:除"瞬时错误最多 1 次"外,同一类失败不得反复重试。
  • 禁止把失败的返回体当成功继续往下走(展示空图、告诉用户"已生成")。
linkfox-aigc-imagegen
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 (
    errcode
    /
    errmsg
    /
    error
    ).
2. Failure Handling (By Failure Type)
Failure TypeJudgment BasisHandling
Invalid Parameters
errmsg
/
errorMsg
indicates that input parameters like
provider
,
aspectRatio
,
resolution
,
quality
are not accepted
Use
AskUserQuestion
to let user re-select corresponding parameters
Authentication Failure
errcode==401
or prompt about API Key
Stop and prompt user to configure
LINKFOX_AGENT_API_KEY
, do not retry
Transient Error
error
is network/timeout/connection failure (e.g.,
Connection failed
, timeout)
Retry automatically at most 1 time; if failed again, switch to "Other Errors"
Other ErrorsQuota 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
    linkfox-aigc-imagegen
    , 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

本 skill 支持以下 5 个生图模型,模型由 agent 层通过
provider
参数传入;若未传入则由本 skill 向用户确认。
模型名称内部代码
LFBanana Pro
BANANA_PRO
Img2
GPT_2_IMAGE
LFBanana2
BANANA_2
Linkfox-Image-1
AIDRAW_EDIT
Wan 2.7
WAN2_7
模型确认:若
provider
为空或不在上表内,使用
AskUserQuestion
让用户从上述 5 个模型中选择,用户选择后再继续执行。将
provider
统一下发给步骤 3。
This skill supports the following 5 image generation models, which are passed in by agent layer via
provider
parameter; if not passed, this skill will confirm with user.
Model NameInternal 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 above table, use
AskUserQuestion
to let user select from the above 5 models, then continue execution after user selection. Pass
provider
uniformly to Step 3.

分辨率规则

Resolution Rules

分辨率是步骤 3 的必传参数。本 skill 支持 2K、4K
  1. agent 层透传了
    resolution
    (值为 2K 或 4K):直接使用
  2. agent 层未透传:使用
    AskUserQuestion
    让用户从 2K / 4K 中选择
Resolution is a required parameter for Step 3. This skill supports 2K, 4K.
  1. If agent layer passes
    resolution
    (value is 2K or 4K): use directly
  2. If agent layer does not pass: use
    AskUserQuestion
    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

  1. 无上传环节:服饰图片以
    imageUrls
    形式直接传递,本 skill 不涉及本地文件上传操作(步骤 1 的 URL 校验除外),禁止探查或调用任何上传脚本。
  2. 计划管理工具使用规范:单张直出时不使用计划工具。套图并发出图前须为 N 张图创建任务计划(见
    references/runtime/02-confirm.md
    )。
  3. 套图落盘:plan / summary 由
    run_collection_pipeline.py
    写盘;禁止 Agent 凭记忆 Write 整份 image-plan。
  4. Listing 报告回写资产清单(强制):如果套图结果要合并进 Listing HTML,调用方必须保留
    $DATADIR/collection-asset-manifest.json
    ,并在 merge 前把 manifest 中的本地
    media/
    路径通过
    linkfox-file-upload
    换成公开 OSS URL。本 skill 不直接上传,但不得暗示本地路径可直接写入 HTML。
  1. No Upload Link: Apparel images are directly passed in the form of
    imageUrls
    , this skill does not involve local file upload operations (except URL verification in Step 1). FORBID probing or calling any upload scripts.
  2. 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
    ).
  3. 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.
  4. 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
    media/
    paths in manifest with public OSS URLs via
    linkfox-file-upload
    before merging. This skill does not upload directly, but must not imply that local paths can be directly written into HTML.

套图编排流程(runtime,渐进 Read)

Image-set Orchestration Process (runtime, Progressive Read)

仅套图路径触发;单张直出不要 Read 本节。
步骤Read操作
入口
references/runtime/00-index.md
S0 场景判定
plan
references/runtime/01-plan.md
写 job.json →
--phase plan
,stdout markdown 表格原样转发 + AskUserQuestion
确认 → dispatch → summary
references/runtime/02-confirm.md
用户确认 → agent 发 1 个
--phase dispatch
Bash(skill 层并发跑全部
run_one_task.py
,不渲染图)→ 紧接 1 个
--phase summary
Bash 写 manifest + 打含
![]()
的 markdown 明细
维护细则(场景 A/G 完整规则、历史 S1 文案规范)见
references/maintainer/collection/
运行时禁止 Read
Only triggered by image-set path; do not Read this section for single-image direct generation.
StepReadOperation
Entry
references/runtime/00-index.md
S0 scenario judgment
plan
references/runtime/01-plan.md
Write job.json →
--phase plan
, forward stdout markdown table as is + AskUserQuestion
Confirm → Dispatch → Summary
references/runtime/02-confirm.md
User confirmation → agent sends 1
--phase dispatch
Bash (skill layer runs all
run_one_task.py
concurrently, does not render images) → immediately send 1
--phase summary
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

  • 白底图模板为静态指令,强依赖模型对**视角(正面/背面)版型(男装/女装/童装)**的判定;判错会影响廓形与体积重建。
  • 模特图链路不调 textgen、不过敏感词,全部解码与构图判断压在出图模型单次出图上;模板只消费
    {image_desc}
    ,市场化人种 / 品牌调性强控需经
    imageDesc
    文字描述传入。
  • 种草图强依赖
    linkfox-aigc-textgen
    GEM_3_FLASH
    )对目标人群 / 年龄(童装 vs 成人)/ 性别的判定,判定错误会直接传导到模特画像与场景构图。
  • 卖点图/A+ 共用字典模板,靠
    {layoutInfo}
    区分;意图填错会导致版式串型。卖点图/A+ 图在 textgen 环节含敏感词规避。
  • 尺码图为双阶段链路:阶段1
    analysis_result
    质量直接决定阶段2 尺码表的品类判定与提示文案;阶段2 敏感词规避降级为"在送 imagegen 的最终 prompt 末尾追加规避指令、由出图模型自审",无确定性词库兜底。
  • 多张参考图时由模型自行判断主体服饰角色,复杂组合下可能误判主图。
  • 不做敏感词改写的支线(种草图/模特图/白底图):若卖点/场景含违禁内容,本链路不拦截,由上游或人工把关。
  • 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
    {image_desc}
    , strong control of market-oriented race / brand tone needs to be passed in via
    imageDesc
    text description.
  • Lifestyle marketing image strongly depends on
    linkfox-aigc-textgen
    (
    GEM_3_FLASH
    ) 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
    {layoutInfo}
    ; 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
    analysis_result
    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

发生以下异常情况时,采用 references/onboarding.md 引导解决问题:
For the following abnormal situations, guide users to solve problems using references/onboarding.md:

异常情况

Abnormal Situations

  • 未配置API Key:环境变量未配置
    LINKFOX_AGENT_API_KEY
    ,也未配置
    LINKFOXAGENT_API_KEY
  • 响应401或402状态码
  • 响应提示积分或余额不足:消息含"积分余额不足/计费不足/余额不足/quota exceeded/insufficient balance/套餐到期/需充值/请充值",或类似含义的内容。
  • API Key Not Configured: Environment variable
    LINKFOX_AGENT_API_KEY
    is not configured, nor is
    LINKFOXAGENT_API_KEY
    .
  • 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.