Back to search
ai-ecommerce-agent-skills
SkillGitHub
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
Markdown
[](/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)
- # AI 电商 Agent Skills
- OpenClaw AI Agent 的电商设计技能包,包含生图、电商设计、竞品分析、审美记忆等完整工作流。
- ## 技能清单
- | 技能 | 说明 |
- |------|------|
- | `nano-banana2` | Gemini 多模态 AI — 文生图、图生图、Vision 分析 |
- | `ecommerce-designer` | 电商美工助手 — 详情页、海报、Banner、社媒封面 |
- | `design-pipeline` | 美工全流程 — 从参考店铺到成品设计的自动化工作流 |
- | `store-teardown` | 店铺视觉拆解 — 分析竞品配色、排版、摄影风格 |
- | `taobao` | 电商比价 — 淘宝/京东/拼多多/抖音/快手商品搜索 |
- | `ui-ux-pro-max` | UI/UX 设计智能 — BM25 搜索 8 大设计领域 |
- | `upload-media` | 媒体上传 — 即梦(Jimeng) VOD 平台上传 |
- | `xhs-note-creator` | 小红书笔记 — Markdown 到图片卡片渲染+发布 |
- | `stock-analyst` | 美港股分析 — 盘前指标+量化模型+组合追踪 |
- | `pitfall-experience` | 踩坑知识库 — 自动记录和检索历史问题解决方案 |
- ## 审美记忆系统
- `aesthetic-memory/` 目录包含品牌审美知识库:
- - `aesthetic.md` — 审美工作记忆操作手册 (Preflight → Solidify)
- - `aesthetic-fragments.md` — 11 条单条审美经验 (含 7 条负面碎片)
- - `aesthetic-patterns.md` — 3 个可复用的风格模式 (含 Prompt 模板)
- - `brand-seek-within.md` — SEEK WITHIN 品牌完整档案
- - `brand-1747.md` — 1747 大话国潮品牌档案
- ## Workspace 配置
- `workspace-config/` 目录包含 Agent 运行时配置:
- - `AGENTS.md` — 主指令文件 (Preflight、自检协议、行为红线)
- - `SOUL.md` — Agent 人格定义
- - `IDENTITY.md` — Agent 身份
- - `TOOLS.md` — 工具链笔记
- - `MEMORY.md` — 长期记忆索引
- - `USER.md` — 用户档案
- ## 依赖
- - Python 3.10+
- - Playwright (chromium)
- - Gemini API Key
- - 各技能的 Python 依赖见对应 `scripts/` 目录
- ## 验证状态
- 使用 skill-creator 框架验证通过:
- - 结构验证: 10/10 PASS
- - 功能断言: 46/46 PASS (100%)
- - 质量评分: 平均 6.9/10
nano-banana2/scripts/img2img.py · Bundled script · 134 lines · 1 finding marked
- #!/usr/bin/env python3
- """Nano Banana2 图生图 - 基于参考图生成风格化版本"""
- import argparse
- import base64
- import json
- import os
- import sys
- import time
- from pathlib import Path
- import requests
- GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY", "AIzaSyBn_AbjUeM4ZRcOOihp4Jdkt4sRdo--Kak")
- Critical: Contains what looks like a hardcoded Google API key
- Line 14 on GitHub
- GEMINI_BASE = "https://generativelanguage.googleapis.com/v1beta"
- MODEL_IMAGE = "gemini-2.0-flash-exp-image-generation"
- def encode_image(image_path):
- """将图片转为base64"""
- with open(image_path, "rb") as f:
- return base64.b64encode(f.read()).decode("utf-8")
- def call_gemini_image_to_image(image_path, prompt):
- """调用 Gemini 图生图 API"""
- url = f"{GEMINI_BASE}/models/{MODEL_IMAGE}:generateContent?key={GEMINI_API_KEY}"
- # 读取并编码图片
- image_b64 = encode_image(image_path)
- headers = {"Content-Type": "application/json"}
- # 构建多模态请求(图片 + 文本)
- payload = {
- "contents": [
- {
- "parts": [
- {
- "inlineData": {
- "mimeType": "image/jpeg",
- "data": image_b64
- }
- },
- {
- "text": prompt
- }
- ]
- }
- ],
- "generationConfig": {
- "responseModalities": ["TEXT", "IMAGE"]
- }
- }
- resp = requests.post(url, headers=headers, json=payload, timeout=180)
- resp.raise_for_status()
- return resp.json()
- def process_response(data, output_dir):
- """处理API响应,提取文本和图片"""
- results = []
- candidates = data.get("candidates", [])
- if not candidates:
- error = data.get("error", {})
- print(f"API Error: {error.get('message', 'Unknown error')}", file=sys.stderr)
- return results
- parts = candidates[0].get("content", {}).get("parts", [])
- os.makedirs(output_dir, exist_ok=True)
- image_count = 0
- for part in parts:
- if "text" in part:
- text = part["text"]
- if text.strip():
- print(f"AI描述: {text}")
- results.append({"type": "text", "text": text})
- elif "inlineData" in part:
- inline = part["inlineData"]
- mime_type = inline.get("mimeType", "image/png")
- b64_data = inline.get("data", "")
- if b64_data:
- ext = "png" if "png" in mime_type else "jpg"
- image_count += 1
- filename = f"nano_banana_img_{int(time.time())}_{image_count}.{ext}"
- filepath = os.path.join(output_dir, filename)
- with open(filepath, "wb") as f:
- f.write(base64.b64decode(b64_data))
- print(f"✅ 图片已保存: {filepath}")
- results.append({"type": "image", "path": filepath, "mime": mime_type})
- return results
- def main():
- parser = argparse.ArgumentParser(description="Nano Banana2 图生图")
- parser.add_argument("--image", required=True, help="参考图片路径")
- parser.add_argument("--prompt", required=True, help="风格化提示词")
- parser.add_argument("--output", default="/tmp/nano_banana2_output/", help="输出目录")
- args = parser.parse_args()
- print(f"🎨 正在使用 Nano Banana 处理图片...")
- print(f"📸 参考图: {args.image}")
- print(f"💭 提示词: {args.prompt}")
- print("⏳ 生成中,请稍候...\n")
- try:
- data = call_gemini_image_to_image(args.image, args.prompt)
- results = process_response(data, args.output)
- # 保存结果摘要
- summary = {
- "status": "ok",
- "input_image": args.image,
- "prompt": args.prompt,
- "results": results
- }
- summary_path = os.path.join(args.output, "img2img_result.json")
- with open(summary_path, "w") as f:
- json.dump(summary, f, ensure_ascii=False, indent=2)
- print(f"\n🎉 生成完成!结果保存在: {args.output}")
- except Exception as e:
- print(f"❌ 错误: {e}", file=sys.stderr)
- sys.exit(1)
- if __name__ == "__main__":
- main()
nano-banana2/scripts/nano_banana2.py · Bundled script · 168 lines · 1 finding marked
- #!/usr/bin/env python3
- """Nano Banana2 / Gemini multimodal API client for OpenClaw skill.
- Uses Google Generative AI (Gemini) public API.
- Supports text generation and image generation (Gemini 2.0 Flash).
- """
- import argparse
- import base64
- import json
- import os
- import sys
- import time
- from pathlib import Path
- import requests
- GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY", "AIzaSyBn_AbjUeM4ZRcOOihp4Jdkt4sRdo--Kak")
- Critical: Contains what looks like a hardcoded Google API key
- Line 18 on GitHub
- GEMINI_BASE = "https://generativelanguage.googleapis.com/v1beta"
- MODEL_TEXT = "gemini-2.5-flash"
- MODEL_IMAGE = "gemini-2.5-flash-image"
- VALID_RATIOS = [
- "21:9", "16:9", "4:3", "3:2",
- "1:1",
- "9:16", "3:4", "2:3",
- "5:4", "4:5",
- ]
- def call_gemini(prompt, mode="text", image_path=None):
- """Call Gemini API via REST. Pass image_path for img2img reference."""
- model = MODEL_IMAGE if mode == "image" else MODEL_TEXT
- url = f"{GEMINI_BASE}/models/{model}:generateContent?key={GEMINI_API_KEY}"
- headers = {"Content-Type": "application/json"}
- parts = []
- if image_path:
- import mimetypes
- mime = mimetypes.guess_type(image_path)[0] or "image/jpeg"
- with open(image_path, "rb") as img_f:
- b64 = base64.b64encode(img_f.read()).decode()
- parts.append({"inlineData": {"mimeType": mime, "data": b64}})
- parts.append({"text": prompt})
- payload = {
- "contents": [{"parts": parts}],
- "generationConfig": {}
- }
- if mode == "image":
- payload["generationConfig"]["responseModalities"] = ["TEXT", "IMAGE"]
- resp = requests.post(url, headers=headers, json=payload, timeout=120)
- resp.raise_for_status()
- return resp.json()
- def process_response(data, output_dir):
- """Process Gemini API response, extract text and save images."""
- results = []
- candidates = data.get("candidates", [])
- if not candidates:
- error = data.get("error", {})
- if error:
- print(f"API Error: {error.get('message', 'Unknown error')}", file=sys.stderr)
- else:
- print("No response from API.", file=sys.stderr)
- return results
- parts = candidates[0].get("content", {}).get("parts", [])
- os.makedirs(output_dir, exist_ok=True)
- image_count = 0
- for part in parts:
- if "text" in part:
- text = part["text"]
- if text.strip():
- print(text, end="")
- results.append({"type": "text", "text": text})
- elif "inlineData" in part:
- inline = part["inlineData"]
- mime_type = inline.get("mimeType", "image/png")
- b64_data = inline.get("data", "")
- if b64_data:
- ext = "png" if "png" in mime_type else "jpg"
- image_count += 1
- filename = f"gemini_{int(time.time())}_{image_count}.{ext}"
- filepath = os.path.join(output_dir, filename)
- with open(filepath, "wb") as f:
- f.write(base64.b64decode(b64_data))
- print(f"\n[Image saved: {filepath}]")
- results.append({"type": "image", "path": filepath, "mime": mime_type})
- print() # Final newline
- return results
- def main():
- parser = argparse.ArgumentParser(description="Gemini Multimodal API Client")
- parser.add_argument("--mode", choices=["text", "image"], default="text",
- help="Generation mode: text or image")
- parser.add_argument("--prompt", required=True, help="User prompt")
- parser.add_argument("--aspect-ratio", default="1:1",
- help=f"Image aspect ratio (hint only). Options: {', '.join(VALID_RATIOS)}")
- parser.add_argument("--output", default="/root/.openclaw/media/nano_banana2_output/",
- help="Output directory for generated images")
- parser.add_argument("--image", default=None, help="Input image path for img2img (reference image)")
- parser.add_argument("--system", default=None, help="Optional system prompt")
- parser.add_argument("--model", default=None, help="Override model name")
- args = parser.parse_args()
- # Build prompt
- full_prompt = args.prompt
- if args.mode == "image" and args.aspect_ratio != "1:1":
- full_prompt = f"{args.prompt} (aspect ratio: {args.aspect_ratio})"
- if args.model:
- global MODEL_TEXT, MODEL_IMAGE
- MODEL_TEXT = args.model
- MODEL_IMAGE = args.model
- try:
- data = call_gemini(full_prompt, mode=args.mode, image_path=args.image)
- results = process_response(data, args.output)
- # Write summary
- usage = data.get("usageMetadata", {})
- summary = {
- "status": "ok",
- "mode": args.mode,
- "model": MODEL_IMAGE if args.mode == "image" else MODEL_TEXT,
- "results": results,
- "usage": {
- "prompt_tokens": usage.get("promptTokenCount", 0),
- "completion_tokens": usage.get("candidatesTokenCount", 0),
- "total_tokens": usage.get("totalTokenCount", 0),
- },
- }
- summary_path = os.path.join(args.output, "last_result.json")
- os.makedirs(args.output, exist_ok=True)
- with open(summary_path, "w") as f:
- json.dump(summary, f, ensure_ascii=False, indent=2)
- except requests.exceptions.HTTPError as e:
- body = ""
- if e.response is not None:
- body = e.response.text[:500]
- print(f"API Error: {e}\n{body}", file=sys.stderr)
- sys.exit(1)
- except requests.exceptions.RequestException as e:
- print(f"Network Error: {e}", file=sys.stderr)
- sys.exit(1)
- except Exception as e:
- print(f"Error: {e}", file=sys.stderr)
- sys.exit(1)
- if __name__ == "__main__":
- main()
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.