From gemini-plugin
当用户想通过 Google Gemini 生成文本、生成图片、或提到"Gemini"/"问问Gemini"时触发。支持文本问答和图片创建,使用浏览器自动化与 Gemini 网页交互。
How this skill is triggered — by the user, by Claude, or both
Slash command
/gemini-plugin:gemini-skillThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
通过浏览器自动化与 Google Gemini 交互,支持文本生成和图片创建。
LICENSEreferences/AUTHENTICATION.mdreferences/api_reference.mdreferences/troubleshooting.mdreferences/usage_patterns.mdrequirements.txtscripts/__init__.pyscripts/ask_gemini.pyscripts/ask_question.pyscripts/auth_manager.pyscripts/browser_session.pyscripts/browser_utils.pyscripts/cleanup_manager.pyscripts/config.pyscripts/generate_image.pyscripts/notebook_manager.pyscripts/run.pyscripts/setup_environment.py通过浏览器自动化与 Google Gemini 交互,支持文本生成和图片创建。
默认复用已有 Chrome 实例(通过 CDP 协议连接 localhost:9222)。如果 Chrome 未启动或未启用远程调试,自动回退到启动新浏览器实例。
Chrome 的 --remote-debugging-port 要求使用非默认 --user-data-dir。推荐将默认 profile 复制到独立目录:
# CDP profile 路径
CDP_PROFILE="$HOME/chrome-cdp-profile"
# 如果 CDP profile 不存在,从默认 profile 复制(保留登录状态、扩展、书签)
if [ ! -d "$CDP_PROFILE" ]; then
cp -a "$HOME/Library/Application Support/Google/Chrome" "$CDP_PROFILE" # macOS
# cp -a "$HOME/.config/google-chrome" "$CDP_PROFILE" # Linux
rm -f "$CDP_PROFILE"/Singleton* # 清除锁文件
fi
# 启动 Chrome(macOS)
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
--user-data-dir="$CDP_PROFILE"
# 启动 Chrome(Linux)
# google-chrome --remote-debugging-port=9222 --user-data-dir="$CDP_PROFILE"
Agent 自动处理:如果用户要求使用 CDP 但 ~/chrome-cdp-profile 不存在,Agent 应自动执行以下步骤:
killall "Google Chrome" / killall chrome)~/chrome-cdp-profileSingleton*)curl -s http://localhost:9222/json/version)复用已有实例时,用户的 Google 登录会话直接可用,无需单独认证。
所有命令必须通过 python scripts/run.py [脚本名] 执行,不可直接调用脚本。
run.py 自动处理:创建 .venv -> 安装依赖 -> 激活环境 -> 执行脚本。
python scripts/run.py auth_manager.py status
python scripts/run.py auth_manager.py setup
浏览器会自动打开,用户需手动登录 Google 账号。告知用户:"浏览器窗口将打开,请登录 Google 账号"。
python scripts/run.py ask_gemini.py --question "你的问题"
python scripts/run.py ask_gemini.py --question "..." --show-browser # 调试模式
参数:
--question(必需):要问 Gemini 的问题--show-browser:显示浏览器窗口用于调试python scripts/run.py generate_image.py --prompt "图片描述"
python scripts/run.py generate_image.py --prompt "..." --output ./my_images
python scripts/run.py generate_image.py --prompt "..." --headless
python scripts/run.py generate_image.py --prompt "..." --debug
参数:
--prompt(必需):图片描述--output:输出目录(默认当前目录)--headless:隐藏浏览器运行--debug:调试模式输出格式:gemini_image_1_[时间戳].png
python scripts/run.py auth_manager.py setup # 初始设置(浏览器可见)
python scripts/run.py auth_manager.py status # 检查状态
python scripts/run.py auth_manager.py reauth # 重新认证
python scripts/run.py auth_manager.py clear # 清除认证
用户请求 → 检查 CDP(curl localhost:9222) → 未就绪则准备 CDP profile 并启动 Chrome → 执行对应脚本 → 返回结果
→ CDP 不可用时回退:检查认证(status) → 未认证则 setup → 执行脚本
所有数据存储在 ~/.claude/skills/gemini-skill/data/:
auth_info.json - 认证状态browser_state/ - 浏览器 cookies 和会话受 .gitignore 保护,不会提交到 git。
可选 .env 文件:
HEADLESS=false
SHOW_BROWSER=false
STEALTH_ENABLED=true
TYPING_WPM_MIN=160
TYPING_WPM_MAX=240
PAGE_LOAD_TIMEOUT=30000
详细信息请查阅 references/ 目录:
api_reference.md - 所有脚本的详细 API 文档troubleshooting.md - 常见问题和解决方案usage_patterns.md - 使用模式和工作流示例AUTHENTICATION.md - 认证架构的技术细节If you encounter any issues with this plugin, please report them following our Support Guide. Your feedback helps improve the community experience!
npx claudepluginhub istarwyh/agent-plugins --plugin gemini-pluginGenerates images and text from prompts using Google Gemini Web. Supports reference image uploads, multi-turn sessions, and experimental video generation as backend for other skills.
Generates images and text via a reverse-engineered Gemini Web API. Supports text generation, image generation from prompts, vision input from reference images, and multi-turn conversations.
Generates images and text via reverse-engineered Gemini Web API. Supports text generation, image generation from prompts, reference images for vision input, and multi-turn conversations.