Skip to content
Back to search

ai-ecommerce-agent-skills

AI 电商 Agent Skills - OpenClaw 技能包:生图、电商设计、竞品分析、审美记忆系统

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/benzema216--ai-ecommerce-agent-skills/badge.svg)](/listings/benzema216--ai-ecommerce-agent-skills)

HTML

<a href="/listings/benzema216--ai-ecommerce-agent-skills"><img src="/api/listings/benzema216--ai-ecommerce-agent-skills/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 54 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # AI 电商 Agent Skills
  2. OpenClaw AI Agent 的电商设计技能包,包含生图、电商设计、竞品分析、审美记忆等完整工作流。
  3. ## 技能清单
  4. | 技能 | 说明 |
  5. |------|------|
  6. | `nano-banana2` | Gemini 多模态 AI — 文生图、图生图、Vision 分析 |
  7. | `ecommerce-designer` | 电商美工助手 — 详情页、海报、Banner、社媒封面 |
  8. | `design-pipeline` | 美工全流程 — 从参考店铺到成品设计的自动化工作流 |
  9. | `store-teardown` | 店铺视觉拆解 — 分析竞品配色、排版、摄影风格 |
  10. | `taobao` | 电商比价 — 淘宝/京东/拼多多/抖音/快手商品搜索 |
  11. | `ui-ux-pro-max` | UI/UX 设计智能 — BM25 搜索 8 大设计领域 |
  12. | `upload-media` | 媒体上传 — 即梦(Jimeng) VOD 平台上传 |
  13. | `xhs-note-creator` | 小红书笔记 — Markdown 到图片卡片渲染+发布 |
  14. | `stock-analyst` | 美港股分析 — 盘前指标+量化模型+组合追踪 |
  15. | `pitfall-experience` | 踩坑知识库 — 自动记录和检索历史问题解决方案 |
  16. ## 审美记忆系统
  17. `aesthetic-memory/` 目录包含品牌审美知识库:
  18. - `aesthetic.md` — 审美工作记忆操作手册 (Preflight → Solidify)
  19. - `aesthetic-fragments.md` — 11 条单条审美经验 (含 7 条负面碎片)
  20. - `aesthetic-patterns.md` — 3 个可复用的风格模式 (含 Prompt 模板)
  21. - `brand-seek-within.md` — SEEK WITHIN 品牌完整档案
  22. - `brand-1747.md` — 1747 大话国潮品牌档案
  23. ## Workspace 配置
  24. `workspace-config/` 目录包含 Agent 运行时配置:
  25. - `AGENTS.md` — 主指令文件 (Preflight、自检协议、行为红线)
  26. - `SOUL.md` — Agent 人格定义
  27. - `IDENTITY.md` — Agent 身份
  28. - `TOOLS.md` — 工具链笔记
  29. - `MEMORY.md` — 长期记忆索引
  30. - `USER.md` — 用户档案
  31. ## 依赖
  32. - Python 3.10+
  33. - Playwright (chromium)
  34. - Gemini API Key
  35. - 各技能的 Python 依赖见对应 `scripts/` 目录
  36. ## 验证状态
  37. 使用 skill-creator 框架验证通过:
  38. - 结构验证: 10/10 PASS
  39. - 功能断言: 46/46 PASS (100%)
  40. - 质量评分: 平均 6.9/10
nano-banana2/scripts/img2img.py · Bundled script · 134 lines · 1 finding marked
  1. #!/usr/bin/env python3
  2. """Nano Banana2 图生图 - 基于参考图生成风格化版本"""
  3. import argparse
  4. import base64
  5. import json
  6. import os
  7. import sys
  8. import time
  9. from pathlib import Path
  10. import requests
  11. GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY", "AIzaSyBn_AbjUeM4ZRcOOihp4Jdkt4sRdo--Kak")
  12. GEMINI_BASE = "https://generativelanguage.googleapis.com/v1beta"
  13. MODEL_IMAGE = "gemini-2.0-flash-exp-image-generation"
  14. def encode_image(image_path):
  15. """将图片转为base64"""
  16. with open(image_path, "rb") as f:
  17. return base64.b64encode(f.read()).decode("utf-8")
  18. def call_gemini_image_to_image(image_path, prompt):
  19. """调用 Gemini 图生图 API"""
  20. url = f"{GEMINI_BASE}/models/{MODEL_IMAGE}:generateContent?key={GEMINI_API_KEY}"
  21. # 读取并编码图片
  22. image_b64 = encode_image(image_path)
  23. headers = {"Content-Type": "application/json"}
  24. # 构建多模态请求(图片 + 文本)
  25. payload = {
  26. "contents": [
  27. {
  28. "parts": [
  29. {
  30. "inlineData": {
  31. "mimeType": "image/jpeg",
  32. "data": image_b64
  33. }
  34. },
  35. {
  36. "text": prompt
  37. }
  38. ]
  39. }
  40. ],
  41. "generationConfig": {
  42. "responseModalities": ["TEXT", "IMAGE"]
  43. }
  44. }
  45. resp = requests.post(url, headers=headers, json=payload, timeout=180)
  46. resp.raise_for_status()
  47. return resp.json()
  48. def process_response(data, output_dir):
  49. """处理API响应,提取文本和图片"""
  50. results = []
  51. candidates = data.get("candidates", [])
  52. if not candidates:
  53. error = data.get("error", {})
  54. print(f"API Error: {error.get('message', 'Unknown error')}", file=sys.stderr)
  55. return results
  56. parts = candidates[0].get("content", {}).get("parts", [])
  57. os.makedirs(output_dir, exist_ok=True)
  58. image_count = 0
  59. for part in parts:
  60. if "text" in part:
  61. text = part["text"]
  62. if text.strip():
  63. print(f"AI描述: {text}")
  64. results.append({"type": "text", "text": text})
  65. elif "inlineData" in part:
  66. inline = part["inlineData"]
  67. mime_type = inline.get("mimeType", "image/png")
  68. b64_data = inline.get("data", "")
  69. if b64_data:
  70. ext = "png" if "png" in mime_type else "jpg"
  71. image_count += 1
  72. filename = f"nano_banana_img_{int(time.time())}_{image_count}.{ext}"
  73. filepath = os.path.join(output_dir, filename)
  74. with open(filepath, "wb") as f:
  75. f.write(base64.b64decode(b64_data))
  76. print(f"✅ 图片已保存: {filepath}")
  77. results.append({"type": "image", "path": filepath, "mime": mime_type})
  78. return results
  79. def main():
  80. parser = argparse.ArgumentParser(description="Nano Banana2 图生图")
  81. parser.add_argument("--image", required=True, help="参考图片路径")
  82. parser.add_argument("--prompt", required=True, help="风格化提示词")
  83. parser.add_argument("--output", default="/tmp/nano_banana2_output/", help="输出目录")
  84. args = parser.parse_args()
  85. print(f"🎨 正在使用 Nano Banana 处理图片...")
  86. print(f"📸 参考图: {args.image}")
  87. print(f"💭 提示词: {args.prompt}")
  88. print("⏳ 生成中,请稍候...\n")
  89. try:
  90. data = call_gemini_image_to_image(args.image, args.prompt)
  91. results = process_response(data, args.output)
  92. # 保存结果摘要
  93. summary = {
  94. "status": "ok",
  95. "input_image": args.image,
  96. "prompt": args.prompt,
  97. "results": results
  98. }
  99. summary_path = os.path.join(args.output, "img2img_result.json")
  100. with open(summary_path, "w") as f:
  101. json.dump(summary, f, ensure_ascii=False, indent=2)
  102. print(f"\n🎉 生成完成!结果保存在: {args.output}")
  103. except Exception as e:
  104. print(f"❌ 错误: {e}", file=sys.stderr)
  105. sys.exit(1)
  106. if __name__ == "__main__":
  107. main()
nano-banana2/scripts/nano_banana2.py · Bundled script · 168 lines · 1 finding marked
  1. #!/usr/bin/env python3
  2. """Nano Banana2 / Gemini multimodal API client for OpenClaw skill.
  3. Uses Google Generative AI (Gemini) public API.
  4. Supports text generation and image generation (Gemini 2.0 Flash).
  5. """
  6. import argparse
  7. import base64
  8. import json
  9. import os
  10. import sys
  11. import time
  12. from pathlib import Path
  13. import requests
  14. GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY", "AIzaSyBn_AbjUeM4ZRcOOihp4Jdkt4sRdo--Kak")
  15. GEMINI_BASE = "https://generativelanguage.googleapis.com/v1beta"
  16. MODEL_TEXT = "gemini-2.5-flash"
  17. MODEL_IMAGE = "gemini-2.5-flash-image"
  18. VALID_RATIOS = [
  19. "21:9", "16:9", "4:3", "3:2",
  20. "1:1",
  21. "9:16", "3:4", "2:3",
  22. "5:4", "4:5",
  23. ]
  24. def call_gemini(prompt, mode="text", image_path=None):
  25. """Call Gemini API via REST. Pass image_path for img2img reference."""
  26. model = MODEL_IMAGE if mode == "image" else MODEL_TEXT
  27. url = f"{GEMINI_BASE}/models/{model}:generateContent?key={GEMINI_API_KEY}"
  28. headers = {"Content-Type": "application/json"}
  29. parts = []
  30. if image_path:
  31. import mimetypes
  32. mime = mimetypes.guess_type(image_path)[0] or "image/jpeg"
  33. with open(image_path, "rb") as img_f:
  34. b64 = base64.b64encode(img_f.read()).decode()
  35. parts.append({"inlineData": {"mimeType": mime, "data": b64}})
  36. parts.append({"text": prompt})
  37. payload = {
  38. "contents": [{"parts": parts}],
  39. "generationConfig": {}
  40. }
  41. if mode == "image":
  42. payload["generationConfig"]["responseModalities"] = ["TEXT", "IMAGE"]
  43. resp = requests.post(url, headers=headers, json=payload, timeout=120)
  44. resp.raise_for_status()
  45. return resp.json()
  46. def process_response(data, output_dir):
  47. """Process Gemini API response, extract text and save images."""
  48. results = []
  49. candidates = data.get("candidates", [])
  50. if not candidates:
  51. error = data.get("error", {})
  52. if error:
  53. print(f"API Error: {error.get('message', 'Unknown error')}", file=sys.stderr)
  54. else:
  55. print("No response from API.", file=sys.stderr)
  56. return results
  57. parts = candidates[0].get("content", {}).get("parts", [])
  58. os.makedirs(output_dir, exist_ok=True)
  59. image_count = 0
  60. for part in parts:
  61. if "text" in part:
  62. text = part["text"]
  63. if text.strip():
  64. print(text, end="")
  65. results.append({"type": "text", "text": text})
  66. elif "inlineData" in part:
  67. inline = part["inlineData"]
  68. mime_type = inline.get("mimeType", "image/png")
  69. b64_data = inline.get("data", "")
  70. if b64_data:
  71. ext = "png" if "png" in mime_type else "jpg"
  72. image_count += 1
  73. filename = f"gemini_{int(time.time())}_{image_count}.{ext}"
  74. filepath = os.path.join(output_dir, filename)
  75. with open(filepath, "wb") as f:
  76. f.write(base64.b64decode(b64_data))
  77. print(f"\n[Image saved: {filepath}]")
  78. results.append({"type": "image", "path": filepath, "mime": mime_type})
  79. print() # Final newline
  80. return results
  81. def main():
  82. parser = argparse.ArgumentParser(description="Gemini Multimodal API Client")
  83. parser.add_argument("--mode", choices=["text", "image"], default="text",
  84. help="Generation mode: text or image")
  85. parser.add_argument("--prompt", required=True, help="User prompt")
  86. parser.add_argument("--aspect-ratio", default="1:1",
  87. help=f"Image aspect ratio (hint only). Options: {', '.join(VALID_RATIOS)}")
  88. parser.add_argument("--output", default="/root/.openclaw/media/nano_banana2_output/",
  89. help="Output directory for generated images")
  90. parser.add_argument("--image", default=None, help="Input image path for img2img (reference image)")
  91. parser.add_argument("--system", default=None, help="Optional system prompt")
  92. parser.add_argument("--model", default=None, help="Override model name")
  93. args = parser.parse_args()
  94. # Build prompt
  95. full_prompt = args.prompt
  96. if args.mode == "image" and args.aspect_ratio != "1:1":
  97. full_prompt = f"{args.prompt} (aspect ratio: {args.aspect_ratio})"
  98. if args.model:
  99. global MODEL_TEXT, MODEL_IMAGE
  100. MODEL_TEXT = args.model
  101. MODEL_IMAGE = args.model
  102. try:
  103. data = call_gemini(full_prompt, mode=args.mode, image_path=args.image)
  104. results = process_response(data, args.output)
  105. # Write summary
  106. usage = data.get("usageMetadata", {})
  107. summary = {
  108. "status": "ok",
  109. "mode": args.mode,
  110. "model": MODEL_IMAGE if args.mode == "image" else MODEL_TEXT,
  111. "results": results,
  112. "usage": {
  113. "prompt_tokens": usage.get("promptTokenCount", 0),
  114. "completion_tokens": usage.get("candidatesTokenCount", 0),
  115. "total_tokens": usage.get("totalTokenCount", 0),
  116. },
  117. }
  118. summary_path = os.path.join(args.output, "last_result.json")
  119. os.makedirs(args.output, exist_ok=True)
  120. with open(summary_path, "w") as f:
  121. json.dump(summary, f, ensure_ascii=False, indent=2)
  122. except requests.exceptions.HTTPError as e:
  123. body = ""
  124. if e.response is not None:
  125. body = e.response.text[:500]
  126. print(f"API Error: {e}\n{body}", file=sys.stderr)
  127. sys.exit(1)
  128. except requests.exceptions.RequestException as e:
  129. print(f"Network Error: {e}", file=sys.stderr)
  130. sys.exit(1)
  131. except Exception as e:
  132. print(f"Error: {e}", file=sys.stderr)
  133. sys.exit(1)
  134. if __name__ == "__main__":
  135. main()

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.