用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/exiao/skills --skill gemini-svg命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | gemini-svg |
| description | Use when generate interactive SVG animations via Gemini. |
Generate beautiful, interactive SVG animations by sending prompts to Gemini 3.1 Pro Preview and extracting the SVG output.
Gemini 3.1 Pro Preview is exceptionally good at generating self-contained SVGs with embedded CSS animations, JavaScript interactivity, and clean visual design. It handles complex animation logic (hover states, transitions, particle effects, morphing) that other models struggle with.
Use the Gemini API key from nano-banana-pro skill config: get it from skills.entries.nano-banana-pro.apiKey in the gateway config, or set GEMINI_API_KEY in env.
Use GEMINI_API_KEY from environment. Model: gemini-3.1-pro-preview.
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-pro-preview:generateContent?key=$GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"parts": [{"text": "PROMPT_HERE"}]}],
"generationConfig": {
"temperature": 1.0,
"maxOutputTokens": 65536
}
}'
Response path: .candidates[0].content.parts[0].text
Extract the SVG block from between <svg and </svg> (inclusive). If the response wraps it in markdown code fences, strip those.
Always prepend the user's request with this system context:
Generate a single, self-contained SVG file. Requirements:
- All styles must be embedded in a <style> tag inside the SVG
- All interactivity must use inline <script> tags inside the SVG
- Use CSS animations and transitions for smooth motion
- Use clean, modern visual design with attention to detail
- Include hover states and micro-interactions where appropriate
- The SVG must work standalone when opened in a browser
- Use viewBox for responsive sizing
- Prefer clean flat UI style unless the user specifies otherwise
User request: [USER'S DESCRIPTION]
Add these modifiers to the prompt based on what the user wants:
| Want | Add to prompt |
|---|---|
| Smooth animations | "Use CSS keyframe animations with ease-in-out timing" |
| Hover effects | "Add hover state transitions with transform and opacity changes" |
| Dark theme | "Use a dark background (#1a1a2e or similar) with light elements" |
| Glowing effects | "Add CSS filter: drop-shadow with colored glow on key elements" |
| Particles | "Include floating particle effects using CSS animations with staggered delays" |
| Morphing shapes | "Use CSS or SMIL animations to morph between shapes" |
| Interactive | "Add JavaScript click/hover handlers that trigger state changes" |
| Looping | "Make all animations loop infinitely with animation-iteration-count: infinite" |
| Staggered | "Stagger animation delays across elements for a wave/cascade effect" |
python3 or jq/tmp/gemini-svg-output.svg, or user-specified path)open /tmp/gemini-svg-output.svg (macOS)Use Python for the full flow (reliable JSON handling, proper timeout):
import json, re, urllib.request, os, sys
prompt = sys.argv[1] # User's prompt with system prefix
payload = json.dumps({
"contents": [{"parts": [{"text": prompt}]}],
"generationConfig": {"temperature": 1.0, "maxOutputTokens": 65536}
})
url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-pro-preview:generateContent?key={os.environ['GEMINI_API_KEY']}"
req = urllib.request.Request(url, data=payload.encode(), headers={"Content-Type": "application/json"})
# Gemini 3.1 Pro can take 30-90s for complex SVG generation
resp = urllib.request.urlopen(req, timeout=120)
data = json.loads(resp.read())
text = data['candidates'][0]['content']['parts'][0]['text']
# Strip markdown code fences
text = re.sub(r'^```(?:svg|xml|html)?\n', '', text.strip())
text = re.sub(r'\n```\s*$', '', text.strip())
# Extract SVG
match = re.search(r'(<svg[\s\S]*?</svg>)', text)
svg = match.group(1) if match else text
output_path = sys.argv[2] if len(sys.argv) > 2 else '/tmp/gemini-svg-output.svg'
with open(output_path, ) f:
f.write(svg)
()
Important: Gemini 3.1 Pro takes 60-120 seconds for complex SVG generation. Use timeout=180 on exec calls. The sandbox may kill long-running processes; if that happens, run the Python script on the host directly or use exec with host: "gateway" if available. Always set the env var: GEMINI_API_KEY=<key from TOOLS.md>
These produce excellent results with Gemini 3.1 Pro Preview:
UI Components:
Decorative/Art:
Data Viz:
Icons/Logos:
If the first result isn't right:
/tmp/gemini-svg-[short-description].svgrsvg-convert or browser screenshot if needed