💡 摘要
一个通过调用Google Gemini图像生成API,根据文本提示生成图像的技能。
🎯 适合人群
需要UI资源的前端开发人员创建文档的技术写作者可视化概念的产品经理寻求快速模型的设计师
🤖 AI 吐槽: “它只是一个API调用的薄包装,提供了将提示词变成PNG文件的最低限度功能。”
安全分析低风险
风险:通过环境变量暴露API密钥,可能在日志或子进程中泄露。脚本执行外部网络调用;受损的API密钥或端点可能导致未经授权的图像生成或成本滥用。缓解措施:实施密钥管理系统,并尽可能在服务端验证/限制提示词。
name: imagen description: | Generate images using Google Gemini's image generation capabilities. Use this skill when the user needs to create, generate, or produce images for any purpose including UI mockups, icons, illustrations, diagrams, concept art, placeholder images, or visual representations.
Imagen - AI Image Generation Skill
Overview
This skill generates images using Google Gemini's image generation model (gemini-3-pro-image-preview). It enables seamless image creation during any Claude Code session - whether you're building frontend UIs, creating documentation, or need visual representations of concepts.
Cross-Platform: Works on Windows, macOS, and Linux.
When to Use This Skill
Automatically activate this skill when:
- User requests image generation (e.g., "generate an image of...", "create a picture...")
- Frontend development requires placeholder or actual images
- Documentation needs illustrations or diagrams
- Visualizing concepts, architectures, or ideas
- Creating icons, logos, or UI assets
- Any task where an AI-generated image would be helpful
How It Works
- Takes a text prompt describing the desired image
- Calls Google Gemini API with image generation configuration
- Saves the generated image to a specified location (defaults to current directory)
- Returns the file path for use in your project
Usage
Python (Cross-Platform - Recommended)
# Basic usage python scripts/generate_image.py "A futuristic city skyline at sunset" # With custom output path python scripts/generate_image.py "A minimalist app icon for a music player" "./assets/icons/music-icon.png" # With custom size python scripts/generate_image.py --size 2K "High resolution landscape" "./wallpaper.png"
Requirements
GEMINI_API_KEYenvironment variable must be set- Python 3.6+ (uses standard library only, no pip install needed)
Output
Generated images are saved as PNG files. The script returns:
- Success: Path to the generated image
- Failure: Error message with details
Examples
Frontend Development
User: "I need a hero image for my landing page - something abstract and tech-focused"
-> Generates and saves image, provides path for use in HTML/CSS
Documentation
User: "Create a diagram showing microservices architecture"
-> Generates visual representation, ready for README or docs
UI Assets
User: "Generate a placeholder avatar image for the user profile component"
-> Creates image in appropriate size for component use
五维分析
清晰度8/10
创新性5/10
实用性9/10
完整性7/10
可维护性8/10
优缺点分析
优点
- 功能简单,目的单一。
- 使用强大、最先进的模型(Gemini)。
- 无需外部Python依赖。
缺点
- 完全依赖单一外部API及其成本/可用性。
- 缺乏图像编辑或风格控制等高级功能。
- 自述文件暗示的自动激活对智能体来说可能过于武断。
相关技能
免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。
版权归原作者所有 sanjay3290.
