{"id":"9f6c1363-ea25-40a8-bbfe-bc0088e02efd","entityType":"agent","slug":"clawhub-dlazyai-platform-compliance","name":"上架前合规校验 Platform Compliance","canonicalUrl":"https://www.xpersona.co/agent/clawhub-dlazyai-platform-compliance","canonicalPath":"/agent/clawhub-dlazyai-platform-compliance","generatedAt":"2026-10-11T03:55:38.276Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-11T00:37:07.145Z","emptyReason":null},"description":"上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。 Skill: 上架前合规校验 Platform Compliance Owner: dlazyai Summary: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。 Tags: latest:1.0.18 Version history: v1.0.18 | 2026-10-10T01:55:09.049Z | user 例行版本更新 2026-10-10 v1.0.17 | 2026-10-08T01:46:53.072Z | user 例行版本更新 2026-10-08 v1.0.16 | 2026-10-04T01:46:31.928Z | user 例行版本更新 2026-10-04 v1.0.15 | 2026","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s170j1ymymrxasgd00dsk7tckx84cf45:platform-compliance","sourceUrl":"https://clawhub.ai/dlazyai/platform-compliance","homepage":"https://clawhub.ai/dlazyai/skills/platform-compliance","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/dlazyai/platform-compliance","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/dlazyai/skills/platform-compliance","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":62,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。 Skill: 上架前合规校验 Platform Compli"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T00:37:07.145Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T00:37:07.145Z","emptyReason":null},"stars":null,"forks":null,"downloads":1217,"packageName":null,"latestVersion":"1.0.18","tractionLabel":"1.2K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T00:37:07.069Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T00:37:07.145Z","lastCrawledAt":"2026-10-11T00:37:07.069Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T00:37:07.070Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.18","createdAt":"2026-10-10T01:55:09.049Z","changelog":"例行版本更新 2026-10-10","fileCount":12,"zipByteSize":30431},{"version":"1.0.17","createdAt":"2026-10-08T01:46:53.072Z","changelog":"例行版本更新 2026-10-08","fileCount":12,"zipByteSize":30390},{"version":"1.0.16","createdAt":"2026-10-04T01:46:31.928Z","changelog":"例行版本更新 2026-10-04","fileCount":12,"zipByteSize":30492},{"version":"1.0.15","createdAt":"2026-10-02T05:18:33.659Z","changelog":"例行版本更新 2026-10-02","fileCount":12,"zipByteSize":30483},{"version":"1.0.14","createdAt":"2026-09-30T01:51:01.998Z","changelog":"例行版本更新 2026-09-30","fileCount":12,"zipByteSize":30421},{"version":"1.0.13","createdAt":"2026-09-28T02:39:29.339Z","changelog":"例行版本更新 2026-09-28","fileCount":12,"zipByteSize":30276},{"version":"1.0.12","createdAt":"2026-09-24T02:41:14.964Z","changelog":"例行版本更新 2026-09-24","fileCount":12,"zipByteSize":30679},{"version":"1.0.11","createdAt":"2026-09-22T01:43:59.263Z","changelog":"例行版本更新 2026-09-22","fileCount":12,"zipByteSize":30686}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s170j1ymymrxasgd00dsk7tckx84cf45:platform-compliance","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-11T03:55:38.273Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-platform-compliance/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-11T00:37:07.145Z","emptyReason":null},"readme":"Skill: 上架前合规校验 Platform Compliance\n\nOwner: dlazyai\n\nSummary: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n\nTags: latest:1.0.18\n\nVersion history:\n\nv1.0.18 | 2026-10-10T01:55:09.049Z | user\n\n例行版本更新 2026-10-10\n\nv1.0.17 | 2026-10-08T01:46:53.072Z | user\n\n例行版本更新 2026-10-08\n\nv1.0.16 | 2026-10-04T01:46:31.928Z | user\n\n例行版本更新 2026-10-04\n\nv1.0.15 | 2026-10-02T05:18:33.659Z | user\n\n例行版本更新 2026-10-02\n\nv1.0.14 | 2026-09-30T01:51:01.998Z | user\n\n例行版本更新 2026-09-30\n\nv1.0.13 | 2026-09-28T02:39:29.339Z | user\n\n例行版本更新 2026-09-28\n\nv1.0.12 | 2026-09-24T02:41:14.964Z | user\n\n例行版本更新 2026-09-24\n\nv1.0.11 | 2026-09-22T01:43:59.263Z | user\n\n例行版本更新 2026-09-22\n\nv1.0.10 | 2026-09-20T01:57:47.073Z | user\n\n例行版本更新 2026-09-20\n\nv1.0.9 | 2026-09-18T02:14:53.699Z | user\n\n例行版本更新 2026-09-18\n\nv1.0.8 | 2026-09-14T01:48:51.359Z | user\n\n例行版本更新 2026-09-14\n\nv1.0.7 | 2026-09-14T01:47:32.043Z | user\n\n例行版本更新 2026-09-14\n\nv1.0.6 | 2026-09-10T01:37:56.308Z | user\n\n例行版本更新 2026-09-10\n\nv1.0.5 | 2026-09-08T01:45:03.942Z | user\n\n例行版本更新 2026-09-08\n\nv1.0.4 | 2026-09-07T01:54:15.098Z | user\n\n例行版本更新 2026-09-07\n\nv1.0.3 | 2026-09-04T01:45:27.731Z | user\n\n例行版本更新 2026-09-04\n\nv1.0.2 | 2026-09-02T01:41:20.452Z | user\n\n例行版本更新 2026-09-02\n\nv1.0.1 | 2026-08-31T07:08:17.400Z | user\n\n源码仓库迁移至 github.com/dlazy-ai/ecommerce-skills\n\nv1.0.0 | 2026-08-29T04:14:09.328Z | user\n\nSync from GitHub\n\nArchive index:\n\nArchive v1.0.18: 12 files, 30431 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2206b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.18:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.18\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.18:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.18\",\n  \"publishedAt\": 1791597309049\n}\n\nFile v1.0.18:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.18:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.18:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.18:skill-card.md\n\n## Description:\n\nChecks product listing images against platform image specifications and can automatically correct measurable format, background, and layout issues.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nSellers and developers check product photos before listing on Amazon, TikTok Shop, Temu, Shopee, Shopify, or Taobao, then optionally create corrected image files for measurable failures.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Optional generation workflows can upload product images and prompts to cloud providers.\n\nMitigation: Use the local compliance checker for private images; only invoke generation providers when sharing the assets and prompts is acceptable.\n\nRisk: A passing pixel-level check may miss watermarks, text, or other content violations, and platform rules can change.\n\nMitigation: Review image content manually and confirm current platform requirements before publishing; update custom rules as needed.\n\nRisk: Automatic resizing or cropping may change the product composition without fixing image quality.\n\nMitigation: Inspect corrected images and rerun the check before listing them.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/dlazyai/skills/platform-compliance)\n- [Platform image specifications](artifact/references/platform-specs.md)\n- [Optional provider workflows](artifact/references/provider-cli.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, JSON, Guidance, Image files]\n\n**Output Format:** [Plain-text or JSON compliance report; optional corrected image files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Reports measured checks and rejection risks; optional fixes save separately from source images.]\n\n## Skill Version(s):\n\n1.0.18 (source: ClawHub release metadata and skill frontmatter)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.18:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.17: 12 files, 30390 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2146b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.17:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.17\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.17:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.17\",\n  \"publishedAt\": 1791424013072\n}\n\nFile v1.0.17:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.17:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.17:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.17:skill-card.md\n\n## Description:\n\nChecks product listing images against measurable marketplace requirements and can create revised images to address supported issues.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nSellers and developers check product images before listing them on Amazon, TikTok Shop, Temu, Shopee, Shopify, or Taobao, and optionally generate revised images for measurable specification failures.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: An automated pass does not check text, watermarks, or product quality.\n\nMitigation: Review image content separately before publishing.\n\nRisk: Automatic revisions may change image framing, and marketplace requirements can change.\n\nMitigation: Review revised images before publishing and compare requirements with current marketplace guidance.\n\nRisk: Optional provider-backed generation can transmit prompts and images to external services and requires credentials.\n\nMitigation: Use the local listing checks by default; use provider-backed generation only when intended and after reviewing data sharing and credentials.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/dlazyai/skills/platform-compliance)\n- [Platform image specifications](artifact/references/platform-specs.md)\n- [Optional provider tooling and data flow](artifact/references/provider-cli.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, JSON, Images]\n\n**Output Format:** [Human-readable check report or JSON; optional revised image files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Supports batch checks and exit status for listing risks; revisions are saved separately from originals.]\n\n## Skill Version(s):\n\n1.0.17 (source: skill frontmatter and server-resolved release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.17:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.16: 12 files, 30492 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2285b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.16:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.16\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.16:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.16\",\n  \"publishedAt\": 1791078391928\n}\n\nFile v1.0.16:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.16:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.16:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.16:skill-card.md\n\n## Description:\n\nChecks product listing images against marketplace image requirements and can correct common background, sizing, and layout issues.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nOnline sellers and developers check product images before publishing to Amazon, TikTok Shop, Temu, Shopee, Shopify, or Taobao. They can inspect rule-by-rule rejection risks and optionally save corrected images.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Bundled generation tools can send prompts and images to external AI providers, beyond local compliance checking.\n\nMitigation: Use the local image checker for compliance checks; avoid generation and provider tools unless external data transfer and credentials are explicitly approved.\n\nRisk: Automatic image corrections may crop content or leave visual issues that pixel checks cannot detect.\n\nMitigation: Review changes before fixing, then inspect corrected images and check text, watermarks, and product quality manually.\n\nRisk: Built-in marketplace thresholds may not reflect current listing requirements.\n\nMitigation: Compare against the destination platform's current rules and supply updated custom rules where necessary.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/dlazyai/skills/platform-compliance)\n- [Platform image specifications](references/platform-specs.md)\n- [Provider CLI reference](references/provider-cli.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, JSON, Image files]\n\n**Output Format:** [Plain-text or JSON compliance reports; optional corrected JPEG images]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Reports measurements and rule outcomes; image fixes are saved separately and rechecked. Pixel-based checks do not detect text, watermarks, or product defects.]\n\n## Skill Version(s):\n\n1.0.16 (source: skill frontmatter and ClawHub release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.16:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.15: 12 files, 30483 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2295b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.15:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.15\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.15:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.15\",\n  \"publishedAt\": 1790918313659\n}\n\nFile v1.0.15:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.15:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.15:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.15:skill-card.md\n\n## Description:\n\nChecks product listing images against marketplace image specifications, reports rejection risks, and can produce corrected images for measurable format, background, and layout issues.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nSellers, creative teams, and developers use this skill to check product images before listing on Amazon, TikTok Shop, Temu, Shopee, Shopify, or Taobao. It flags measurable image-specification issues and optionally saves revised images for another check.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Bundled generation tools can transmit product images and prompts to external AI providers using local credentials.\n\nMitigation: For local-only checks, restrict execution to scripts/check_listing.py; use generation tools only when external transmission is intended and approved.\n\nRisk: Pixel checks and automatic corrections cannot identify text, watermarks, or visibly defective products.\n\nMitigation: Review image content manually or with a separate visual inspection before publishing.\n\nRisk: Marketplace requirements can change, so a passing report may not ensure listing acceptance.\n\nMitigation: Compare results with current marketplace requirements and update the custom rules when needed.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/dlazyai/skills/platform-compliance)\n- [Platform image specifications](references/platform-specs.md)\n- [Provider CLI and data flow](references/provider-cli.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, JSON, Image files]\n\n**Output Format:** [Plain-text or JSON compliance report; optional corrected image files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Reports individual checks and rejection risk; corrected images are saved separately from originals.]\n\n## Skill Version(s):\n\n1.0.15 (source: frontmatter and server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.15:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.14: 12 files, 30421 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2214b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.14:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.14\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.14:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.14\",\n  \"publishedAt\": 1790733061998\n}\n\nFile v1.0.14:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.14:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.14:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.14:skill-card.md\n\n## Description:\n\nChecks listing images against machine-checkable marketplace requirements and can save corrected copies for supported image issues.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nE-commerce sellers and their agents check product images for measurable listing requirements across supported marketplaces before upload. They can review rejection risks and optionally save corrected image copies.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Marketplace requirements can change, and the checks cover only measurable image properties.\n\nMitigation: Confirm current platform requirements and have a person review text, watermarks, product accuracy, and other content before upload.\n\nRisk: Automatic corrections may change image composition or quality.\n\nMitigation: Inspect corrected copies before publishing; keep the original images and approve changes before using --fix.\n\nRisk: Optional generation helpers can send prompts or images to an external provider.\n\nMitigation: Use those helpers only with permission to share the inputs with the selected provider; the local checker does not require them.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/dlazyai/skills/platform-compliance)\n- [Platform image specifications](artifact/references/platform-specs.md)\n- [Optional provider usage and data flow](artifact/references/provider-cli.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, JSON, Image files, Guidance]\n\n**Output Format:** [Plain-text or JSON compliance report; optional corrected image files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Per-check pass, warning, or fail results; corrected images are saved separately when requested.]\n\n## Skill Version(s):\n\n1.0.14 (source: server-resolved release metadata and skill frontmatter)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.14:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.13: 12 files, 30276 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (1902b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.13:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.13\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.13:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.13\",\n  \"publishedAt\": 1790563169339\n}\n\nFile v1.0.13:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.13:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.13:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.13:skill-card.md\n\n## Description:\n\nChecks marketplace listing images against platform requirements, reports rejection risks, and can fix measurable image issues.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nSellers and ecommerce teams check listing images against marketplace image rules before upload, review rejection risks, and optionally save corrected images.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Optional generation tooling can send images and prompts to external providers.\n\nMitigation: Use the local compliance checker for routine checks; run cloud generation only after reviewing the selected provider and data sharing.\n\nRisk: Image checks cannot identify all content issues, and marketplace rules can change.\n\nMitigation: Review text, watermarks, and product quality separately, and confirm current platform requirements before publishing.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/dlazyai/skills/platform-compliance)\n- [Platform image specifications](artifact/references/platform-specs.md)\n- [Optional generation provider guide](artifact/references/provider-cli.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, JSON, Shell commands, Image files]\n\n**Output Format:** [Human-readable or JSON compliance reports; optionally corrected image files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Supports batch checks and platform-specific or custom rules.]\n\n## Skill Version(s):\n\n1.0.13 (source: skill frontmatter and server release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.13:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.12: 12 files, 30679 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2711b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.12:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.12\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.12:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.12\",\n  \"publishedAt\": 1790217674964\n}\n\nFile v1.0.12:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.12:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.12:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.12:skill-card.md\n\n## Description:\n\nChecks marketplace listing images before publication and reports or fixes objective rejection risks for platforms such as Amazon, TikTok Shop, Temu, Shopee, Shopify, and Taobao.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal sellers, marketplace operators, and ecommerce automation agents use this skill to check product images against platform-specific, machine-testable listing requirements and optionally generate corrected files. It is focused on objective image properties such as background color, size, format, transparency, borders, and subject occupancy.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The package includes generation utilities that can send prompts and images to external services if invoked.\n\nMitigation: For the advertised compliance-checking purpose, use scripts/check_listing.py locally and avoid invoking gen.mjs or configuring provider API keys unless external processing is intended.\n\nRisk: Pixel-level checks cannot determine whether an image contains text, watermarks, collages, or product defects.\n\nMitigation: Use the checker output as an objective-specification screen and send manual or vision-model-only checks through a separate review step for content issues.\n\nRisk: Marketplace image rules can change after the packaged thresholds were created.\n\nMitigation: Confirm current platform requirements for production listings and use a custom rules JSON file when the platform policy differs from the bundled machine-testable subset.\n\n## Reference(s):\n\n- [Platform image specifications](artifact/references/platform-specs.md)\n- [Provider CLI reference](artifact/references/provider-cli.md)\n- [ClawHub skill page](https://clawhub.ai/dlazyai/skills/platform-compliance)\n- [Publisher profile](https://clawhub.ai/user/dlazyai)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with shell command examples, text reports, and optional JSON checker output]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [The local checker can return pass, warning, rejection-risk, or error results and can write fixed JPEG files when invoked with the fix option.]\n\n## Skill Version(s):\n\n1.0.12 (source: server evidence and frontmatter)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.12:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.11: 12 files, 30686 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2741b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.11\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure seamless white background, RGB 255,255,255, no gradient, no vignette, no shadow cast on the backdrop.` |\n| 主体占比 | `The product fills at least 88% of the frame, tight crop, minimal empty margin on all sides.` |\n| 无文字水印 | `No text, no logo, no watermark, no inset images, no borders anywhere in the frame.` |\n| 方图 | `Square 1:1 composition, product centered.` |\n\n[run_loop](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 会自动做这件事：合规校验失败时，\n它把上面对应的句子追加进 prompt 再跑一轮，不用人管。\n\n---\n\n## 六、常见问题\n\n| 现象 | 原因 | 怎么办 |\n| --- | --- | --- |\n| 肉眼纯白，机检说不是 | 棚拍浅灰墙（RGB 200–245）或轻微渐变 | `--fix` 压白，或生成时按上表加约束句 |\n| 主体占比总不够 | 生成时留白太多 | prompt 里写 `tight crop`；或 `--fix` 重构画布 |\n| PNG 传上去变黑底 | 透明通道被平台转成黑色 | 永远压平为白底 JPEG，`--fix` 会自动做 |\n| 修完占比还是差一点 | 方图平台下，长条商品的占比有物理上限 | 脚本已取可达上限；接受它，或改用非方图平台的坑位 |\n| 文字水印项永远是 `?` | 像素层测不了 | 交给 detect-task，或人工过一眼 |\n\n---\n\n## Tips\n\n- **把它接进 CI**：`check_listing.py out/*.jpg --platform amazon` 退出码非零就拦下，\n  比人工抽检可靠。\n- **先检一张再跑整批**：整批生成前拿一张过一遍合规，能省掉一整批的返工。\n- **不同坑位不同规则**：主图严、细节图松。别拿主图的阈值去卡详情页配图。\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1790041439263\n}\n\nFile v1.0.11:references/platform-specs.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。\n\nFile v1.0.11:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.11:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.11:skill-card.md\n\n## Description:\n\nChecks ecommerce listing images against platform-specific objective requirements and can produce fixed images for geometry, background, resolution, and file-size compliance.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal ecommerce sellers, operators, and developers use this skill to check product images before listing them on marketplaces such as Amazon, TikTok Shop, Temu, Shopee, Shopify, and Taobao. It identifies objective rejection risks and can create corrected image files for supported geometric and color issues.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The package includes generation and provider scripts that exceed the local compliance-checking purpose and may send prompts or images to external services when invoked with configured credentials.\n\nMitigation: For compliance-only use, run scripts/check_listing.py and avoid invoking gen.mjs or configuring provider API keys unless external generation is intended.\n\nRisk: Pixel-level checks cannot determine whether an image contains text, watermarks, collage elements, product defects, or marketplace rules that changed after the bundled thresholds were written.\n\nMitigation: Pair the report with visual or human review for content issues and override platform thresholds with --rules when current official requirements differ.\n\nRisk: Automatic fixes only adjust geometry, background, resolution, and file size; they do not repair image quality, remove watermarks, or correct product defects.\n\nMitigation: Review fixed outputs before upload and route content or quality defects to the appropriate repair workflow.\n\n## Reference(s):\n\n- [Platform image specifications](references/platform-specs.md)\n- [Provider CLI reference](references/provider-cli.md)\n- [ClawHub skill page](https://clawhub.ai/dlazyai/skills/platform-compliance)\n\n## Skill Output:\n\n**Output Type(s):** [text, json, shell commands, configuration, guidance, files]\n\n**Output Format:** [Plain text compliance report, optional JSON report, and optional corrected JPEG files.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [The checker exits 0 when inputs pass and 1 when rejection risk remains; --fix writes corrected files to a separate output directory.]\n\n## Skill Version(s):\n\n1.0.11 (source: frontmatter and server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.11:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.10: 12 files, 30721 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2509b), SKILL.md (8125b), _meta.json (139b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: platform-compliance\nversion: 1.0.10\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n[`references/platform-specs.md`](references/platform-specs.md)。\n\n---\n\n## 三、工具调用\n\n```bash\n# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json\n```\n\n只依赖 Pillow：\n\n```bash\npip install Pillow\n```\n\n**参数约定**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--platform` | 目标平台 | 决定用哪套阈值，默认 `amazon` |\n| `--json` | 接流水线时加 | 输出结构化结果，含每项的实测值与阈值 |\n| `--fix <dir>` | 想自动改时加 | 产物另存，不覆盖原图 |\n| 退出码 | `0` / `1` | 有驳回风险时非零，方便 `&&` 串联 |\n\n---\n\n## 四、执行流程\n\n1. **确认平台**。用户没说就问，或按店铺主战场默认（跨境 → `amazon`，国内 → `taobao`）。\n2. **先检后修**。直接跑一次不带 `--fix` 的校验，把问题念给用户听——\n   有些问题（比如主体占比不够）修复会裁掉画面，得让用户先知道。\n3. **区分两类问题**：\n   - 几何 / 色彩类（白底、占比、分辨率、体积）→ `--fix` 能解决。\n   - 内容类（水印、文字、商品崩坏）→ 回到对应的生成或修图技能重做。\n4. **修完复检**。`--fix` 后脚本会自动对产物再检一遍，确认真的过了。\n5. **接回生成侧**。反复不合规时，把约束写进 prompt 而不是每次事后修：\n   见下方「把合规前置到生成」。\n\n---\n\n## 五、把合规前置到生成\n\n事后修不如一次生对。这几句追加到生成 prompt 末尾，能显著降低不合格率：\n\n| 目标 | 追加句 |\n| --- | --- |\n| 纯白背景 | `Pure se\n\nArchive v1.0.9: 12 files, 30666 bytes\n\nFiles: examples/brand.yaml (1655b), references/platform-specs.md (2180b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/check_listing.py (16313b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2690b), SKILL.md (8124b), _meta.json (138b)","readmeExcerpt":"Skill: 上架前合规校验 Platform Compliance Owner: dlazyai Summary: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。 Tags: latest:1.0.18 Version history: v1.0.18 | 2026-10-10T01:55:09.049Z | user 例行版本更新 2026-10-10 v1.0.17 | 2026-10-08T01:46:53.072Z | user 例行版本更新 2026-10-08 v1.0.16 | 2026-10-04T01:46:31.928Z | user 例行版本更新 2026-10-04 v1.0.15 | 2026","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon"},{"language":"text","snippet":"docs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼"},{"language":"bash","snippet":"python3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/"},{"language":"text","snippet":"out/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%"},{"language":"bash","snippet":"# 单张\npython3 scripts/check_listing.py main.jpg --platform amazon\n\n# 整批 + 机器可读\npython3 scripts/check_listing.py out/*.jpg --platform temu --json\n\n# 校验并自动修复到 fixed/\npython3 scripts/check_listing.py raw.png --platform amazon --fix fixed/\n\n# 自定义规则\npython3 scripts/check_listing.py main.jpg --platform amazon --rules my-rules.json"},{"language":"bash","snippet":"pip install Pillow"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: platform-compliance\nversion: 1.0.18\ndescription: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。\n---\n\n# platform-compliance — 上架前合规校验\n\n图片好不好看是一回事，**平台收不收**是另一回事。\n\n这个技能只回答后者：这张图传上去会不会被驳回，卡在哪一条，怎么改。\n\n和 [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的分工：\ndetect-task 用视觉模型判断「像不像真的」，主观、要花算力；\n本技能读像素做客观判定，不花算力、毫秒级、结论可复现。**两个都过才叫能投。**\n\n---\n\n## 生成效果示例\n\n拿本仓库 [flat-lay](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/flat-lay/skill.md) 的实际产出图，按 Amazon 主图规则检：\n\n```bash\npython3 scripts/check_listing.py docs/flat-lay/example-output.jpg --platform amazon\n```\n\n**真实输出**\n\n```\ndocs/flat-lay/example-output.jpg  ·  Amazon 主图  ·  有驳回风险\n  1024×1536 JPEG 0.25MB · 背景 RGB(208, 208, 208) · 主体占比 100.0%\n\n  ! 分辨率              最长边 1536px，达标但不足以触发放大镜\n  ✓ 画面比例             1024:1536\n  ✗ 纯白背景             边缘仅 0.0% 为纯白，背景基色约 RGB(208, 208, 208)\n  ✓ 主体占比             包围盒占画面 100.0%\n  ✓ 透明通道             无 alpha\n  ✓ 边框               无描边\n  ✓ 文件格式             JPEG\n  ✓ 文件体积             0.25 MB\n  ✓ 色彩模式             RGB\n  ? 文字 / 水印 / 拼图     像素层判不了，交给 detect-task 或人工过一眼\n```\n\n这张图肉眼看是「浅灰棚拍背景」，很干净，但 **Amazon 主图要求精确 RGB(255,255,255)**，\n208 的灰会被判不合格。这类问题人眼几乎发现不了，机检一秒钟出结论。\n\n一键修：\n\n```bash\npython3 scripts/check_listing.py docs/to-3d/example-output.jpg --platform amazon --fix out/\n```\n\n```\nout/example-output-fixed.jpg  ·  Amazon 主图  ·  通过\n  1600×1402 JPEG 0.50MB · 背景 RGB(255, 255, 255) · 主体占比 85.1%\n```\n\n压白底 → 按 85% 目标重构画布 → 补到 1600px → 存合规 JPEG，一步到位。\n\n---\n\n## 一、能力边界\n\n| 能做 | 说明 |\n| --- | --- |\n| 客观规格判定 | 背景纯度、主体占比、分辨率、比例、透明通道、描边、格式、体积、色彩模式 |\n| 多平台规则 | Amazon / TikTok Shop / Temu / Shopee / Shopify / 淘宝，可自定义 |\n| 自动修复 | 压白底、按目标占比重构画布、补分辨率、压到体积上限 |\n| 批量 | 一次传多张，或配合 [batch-image](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/batch-image/skill.md) 整批过 |\n| 退出码 | 0 = 可投；1 = 有驳回风险，便于接进 CI 或流水线 |\n\n| 不能做 | 去哪 |\n| --- | --- |\n| 判断有没有文字 / 水印 / 拼图 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) 的视觉模型 |\n| 判断商品有没有崩 | [detect-task](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/detect-task/skill.md) |\n| 去水印 | [remove-watermark](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/remove-watermark/skill.md) |\n| 修图、去褶皱 | [item-repair](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/item-repair/skill.md) |\n\n**自动修复的边界**：`--fix` 只做几何与色彩层面的合规化，它不会替你修图。\n如果原图本身是糊的、崩的、带水印的，修完还是糊的崩的带水印的。\n\n---\n\n## 二、平台规则\n\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\n| --- | --- | --- | --- | --- | --- |\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\n\n**平台规则会变。** 上表是可机检的子集，以各平台最新官方文档为准。\n需要改用自己的口径，写一份 JSON 用 `--rules` 传入，字段说明见\n"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"platform-compliance\",\n  \"version\": \"1.0.18\",\n  \"publishedAt\": 1791597309049\n}"},{"path":"references/platform-specs.md","content":"<!-- 由 scripts/build-skills.mjs 从 shared/references/platform-specs.md 同步生成，不要直接改这里。 -->\r\n# 平台图片规格（可机检子集）\r\n\r\n`scripts/check_listing.py` 内置的规则来源与口径。**平台规则会变，以各平台最新官方文档为准**；\r\n需要覆盖时写一份 JSON 用 `--rules` 传入，结构与下表字段一一对应。\r\n\r\n---\r\n\r\n## 字段含义\r\n\r\n| 字段 | 含义 |\r\n| --- | --- |\r\n| `pure_white_bg` | 是否要求纯白 RGB(255,255,255) 背景 |\r\n| `bg_tolerance` | 判定「纯白」允许的单通道偏差 |\r\n| `bg_coverage` | 边缘一圈需要有多大比例落在容差内 |\r\n| `min_long_side` / `recommend_long_side` / `max_long_side` | 最长边像素 |\r\n| `min_occupancy` | 商品包围盒面积 ÷ 画面面积 的下限 |\r\n| `allow_alpha` | 是否允许透明通道 |\r\n| `allow_border` | 是否允许描边 / 外框 |\r\n| `formats` / `max_bytes` / `aspect` | 允许格式、体积上限、允许比例 |\r\n\r\n---\r\n\r\n## 内置规则\r\n\r\n| 平台 | 纯白底 | 最长边（下限 / 建议） | 主体占比 | 比例 | 体积上限 |\r\n| --- | --- | --- | --- | --- | --- |\r\n| `amazon` | 是 | 1000 / 1600 | ≥ 85% | 不限 | 10 MB |\r\n| `tiktok-shop` | 否 | 800 / 1600 | ≥ 60% | 1:1 或 3:4 | 5 MB |\r\n| `temu` | 是 | 800 / 1350 | ≥ 70% | 1:1 | 3 MB |\r\n| `shopee` | 否 | 500 / 1024 | ≥ 55% | 1:1 | 2 MB |\r\n| `shopify` | 否 | 1024 / 2048 | 不限 | 不限 | 20 MB |\r\n| `taobao` | 是 | 800 / 1200 | ≥ 70% | 1:1 | 3 MB |\r\n\r\n---\r\n\r\n## 几个容易踩的点\r\n\r\n- **透明 PNG**：Amazon 会把透明像素转成黑色。永远压平成白底 JPEG 再传。\r\n- **「白底」不等于「看起来是白的」**：棚拍的浅灰墙（约 RGB 208）肉眼像白，机检直接判不合格。\r\n- **主体占比**：留白过多是最常见的驳回原因之一，比分辨率不够更常见。\r\n- **文字 / 水印 / 拼图**：像素层测不了，交给 `detect-task` 的视觉模型或人工。\r\n- **自动修复的边界**：`--fix` 能压白底、按占比重构画布、补分辨率、压体积；\r\n  它**不会**修图，也不会去水印——那是 `item-repair` 和 `remove-watermark` 的活。"},{"path":"references/provider-cli.md","content":"<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTT"},{"path":"scripts/lib/tasks.json","content":"{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。 Skill: 上架前合规校验 Platform Compliance Owner: dlazyai Summary: 上架前平台合规校验与自动修复。待上架图 → Amazon / TikTok Shop / Temu / Shopee / 淘宝 各平台的通过或驳回风险报告，可一键修成合规图。当用户说「会不会被驳回」「合规检查」「白底不达标」「主图规格」「传上去被拒」时使用。 Tags: latest:1.0.18 Version history: v1.0.18 | 2026-10-10T01:55:09.049Z | user 例行版本更新 2026-10-10 v1.0.17 | 2026-10-08T01:46:53.072Z | user 例行版本更新 2026-10-08 v1.0.16 | 2026-10-04T01:46:31.928Z | user 例行版本更新 2026-10-04 v1.0.15 | 2026","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1007,"uniquenessScore":47,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T00:37:07.145Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T00:37:07.145Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-11T03:55:38.276Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}