npx skills add https://github.com/softaworks/agent-toolkit --skill gemini切勿在后台或非交互式 shell(如 Claude Code 工具调用)中使用 --approval-mode default。它将无限期挂起,等待无法提供的批准提示。
对于自动化/后台审查:
--approval-mode yolo 进行完全自动化执行timeout 300 gemini ...--approval-mode defaultGemini 挂起的症状:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
修复挂起的进程:
# 检查是否挂起
ps aux | grep gemini | grep -v grep
# 必要时终止
pkill -9 -f "gemini.*gemini-3-pro-preview"
通过 AskUserQuestion 在单个提示中询问用户使用哪个模型。可用模型:
gemini-3-pro-preview ⭐(旗舰模型,最适合编码和复杂推理,软件工程能力比 2.5 Pro 强 35%)gemini-3-flash(亚秒级延迟,从 3 Pro 蒸馏而来,最适合速度关键型任务)gemini-2.5-pro(传统选项,强大的全方位性能)gemini-2.5-flash(传统选项,具有成本效益且具备思考能力)gemini-2.5-flash-lite(传统选项,处理速度最快)根据任务选择批准模式:
default:提示批准(⚠️ 仅适用于交互式终端会话)auto_edit:仅自动批准编辑工具(用于带有建议的代码审查)yolo:自动批准所有工具(✅ 后台/自动化任务必需)使用适当的选项组装命令:
-m, --model <MODEL> - 模型选择--approval-mode <default|auto_edit|yolo> - 控制工具批准-y, --yolo - --approval-mode yolo 的替代方案-i, --prompt-interactive "prompt" - 执行提示并继续交互--include-directories <DIR> - 要包含在工作空间中的额外目录-s, --sandbox - 在沙盒模式下运行以实现隔离对于后台/自动化任务,务必使用 --approval-mode yolo 或添加超时包装。切勿在非交互式 shell 中使用 default。
运行命令并捕获输出。对于后台/自动化模式:
# 推荐:对后台任务使用 yolo
gemini -m gemini-3-pro-preview --approval-mode yolo "Review this codebase for security issues"
# 或使用超时(5 分钟限制)
timeout 300 gemini -m gemini-3-pro-preview --approval-mode yolo "Review this codebase"
对于带有初始提示的交互式会话:
gemini -m gemini-3-pro-preview -i "Review the authentication system" --approval-mode auto_edit
Gemini 完成后,通知用户:"Gemini 分析已完成。您可以启动新的 Gemini 会话进行后续分析,或继续探索发现结果。"
| 使用场景 | 批准模式 | 关键标志 |
|---|---|---|
| 后台代码审查 | yolo ✅ | -m gemini-3-pro-preview --approval-mode yolo |
| 后台分析 | yolo ✅ | -m gemini-3-pro-preview --approval-mode yolo |
| 带超时的后台任务 | yolo ✅ | timeout 300 gemini -m gemini-3-pro-preview --approval-mode yolo |
| 交互式代码审查 | default | -m gemini-3-pro-preview --approval-mode default(仅限交互式终端) |
| 带自动编辑的代码审查 | auto_edit | -m gemini-3-pro-preview --approval-mode auto_edit |
| 自动化重构 | yolo | -m gemini-3-pro-preview --approval-mode yolo |
| 速度关键型后台任务 | yolo ✅ | -m gemini-3-flash --approval-mode yolo |
| 成本优化的后台任务 | yolo ✅ | -m gemini-2.5-flash --approval-mode yolo |
| 多目录分析 | yolo(如果是后台任务) | --include-directories <DIR1> --include-directories <DIR2> |
| 带提示的交互式会话 | auto_edit 或 default | -i "prompt" --approval-mode <mode> |
| 模型 | 最适合 | 上下文窗口 | 关键特性 |
|---|---|---|---|
gemini-3-pro-preview ⭐ | 旗舰模型:复杂推理、编码、代理任务 | 1M 输入 / 64k 输出 | Vibe coding, 76.2% SWE-bench, $2-4/M 输入 |
gemini-3-flash | 亚秒级延迟,速度关键型应用 | 1M 输入 / 64k 输出 | 从 3 Pro 蒸馏而来,TPU 优化 |
gemini-2.5-pro | 传统:强大的全方位性能 | 1M 输入 / 65k 输出 | 思考模式,成熟的稳定性 |
gemini-2.5-flash | 传统:成本效益高,高吞吐量任务 | 1M 输入 / 65k 输出 | 最佳价格($0.15/M),思考模式 |
gemini-2.5-flash-lite | 传统:处理速度最快,高吞吐量 | 1M 输入 / 65k 输出 | 最大速度,最小延迟 |
Gemini 3 优势:软件工程准确率提高 35%,在 SWE-bench(76.2%)、GPQA Diamond(91.9%)和 WebDev Arena(1487 Elo)上达到最先进水平。知识截止日期:2025 年 1 月。
即将推出:gemini-3-deep-think,用于具有增强思考能力的超复杂推理。
# 用于后台执行(Claude Code、CI/CD 等)
gemini -m gemini-3-pro-preview --approval-mode yolo \
"Perform a comprehensive code review focusing on:
1. Security vulnerabilities
2. Performance issues
3. Code quality and maintainability
4. Best practices violations"
# 带超时安全机制(5 分钟)
timeout 300 gemini -m gemini-3-pro-preview --approval-mode yolo \
"Perform a comprehensive code review..."
# 用于后台执行
gemini -m gemini-3-pro-preview --approval-mode yolo \
"Review this architectural plan for:
1. Scalability concerns
2. Missing components
3. Integration challenges
4. Alternative approaches"
# 用于后台执行
gemini -m gemini-3-pro-preview --approval-mode yolo \
"Analyze the entire codebase to understand:
1. Overall architecture
2. Key patterns and conventions
3. Potential technical debt
4. Refactoring opportunities"
# 仅在交互式终端中使用 default 模式
gemini -m gemini-3-pro-preview --approval-mode default \
"Review the authentication flow for security issues"
AskUserQuestion 来确认后续步骤或收集澄清信息。gemini --version 或 Gemini 命令以非零状态退出时,停止并报告失败。--approval-mode yolo、-y、--sandbox)之前,除非已获得许可,否则使用 AskUserQuestion 询问用户。AskUserQuestion 询问如何调整。# 检查挂起的进程
ps aux | grep -E "gemini.*gemini-3" | grep -v grep
# 寻找以下症状:
# - 进程运行 20 分钟以上
# - CPU 使用率为 0%
# - 进程状态为 'S'(休眠)
# - 无网络连接
# 获取详细的进程信息
ps -o pid,etime,pcpu,stat,command -p <PID>
# 检查网络活动
lsof -p <PID> 2>/dev/null | grep -E "(TCP|ESTABLISHED)" | wc -l
# 如果结果为 0,则进程已挂起
# 终止挂起的 Gemini 进程
pkill -9 -f "gemini.*gemini-3-pro-preview"
# 或终止特定的 PID
kill -9 <PID>
# 验证清理
ps aux | grep gemini | grep -v grep
--approval-mode yolotimeout 300 gemini ...--approval-mode defaultps 监控首次运行以确保进程完成gemini-3-pro-preview 进行复杂推理、编码任务和最高分析质量(推荐默认)gemini-3-flash 处理需要亚秒级响应时间的速度关键型任务gemini-2.5-flash 进行成本优化的高吞吐量处理需要 Gemini CLI v0.16.0 或更高版本以支持 Gemini 3 模型。检查版本:gemini --version
每周安装次数
572
代码仓库
GitHub 星标数
1.2K
首次出现
Jan 20, 2026
安全审计
安装于
gemini-cli417
cursor417
codex416
claude-code416
opencode399
cline397
NEVER use--approval-mode default in background or non-interactive shells (like Claude Code tool calls). It will hang indefinitely waiting for approval prompts that cannot be provided.
For automated/background reviews:
--approval-mode yolo for fully automated executiontimeout 300 gemini ...--approval-mode default without interactive terminalSymptoms of hung Gemini:
Fix hung process:
# Check if hung
ps aux | grep gemini | grep -v grep
# Kill if necessary
pkill -9 -f "gemini.*gemini-3-pro-preview"
Ask the user (via AskUserQuestion) which model to use in a single prompt. Available models:
gemini-3-pro-preview ⭐ (flagship model, best for coding & complex reasoning, 35% better at software engineering than 2.5 Pro)gemini-3-flash (sub-second latency, distilled from 3 Pro, best for speed-critical tasks)gemini-2.5-pro (legacy option, strong all-around performance)gemini-2.5-flash (legacy option, cost-efficient with thinking capabilities)gemini-2.5-flash-lite (legacy option, fastest processing)Select the approval mode based on the task:
default: Prompt for approval (⚠️ ONLY for interactive terminal sessions)| Use case | Approval mode | Key flags |
|---|---|---|
| Background code review | yolo ✅ | -m gemini-3-pro-preview --approval-mode yolo |
| Background analysis | yolo ✅ | -m gemini-3-pro-preview --approval-mode yolo |
| Background with timeout | yolo ✅ | timeout 300 gemini -m gemini-3-pro-preview --approval-mode yolo |
| Model | Best for | Context window | Key features |
|---|---|---|---|
gemini-3-pro-preview ⭐ | Flagship model : Complex reasoning, coding, agentic tasks | 1M input / 64k output | Vibe coding, 76.2% SWE-bench, $2-4/M input |
gemini-3-flash | Sub-second latency, speed-critical applications | 1M input / 64k output | Distilled from 3 Pro, TPU-optimized |
gemini-2.5-pro | Legacy: Strong all-around performance | 1M input / 65k output | Thinking mode, mature stability |
gemini-2.5-flash |
Gemini 3 Advantages : 35% higher accuracy in software engineering, state-of-the-art on SWE-bench (76.2%), GPQA Diamond (91.9%), and WebDev Arena (1487 Elo). Knowledge cutoff: January 2025.
Coming Soon : gemini-3-deep-think for ultra-complex reasoning with enhanced thinking capabilities.
# For background execution (Claude Code, CI/CD, etc.)
gemini -m gemini-3-pro-preview --approval-mode yolo \
"Perform a comprehensive code review focusing on:
1. Security vulnerabilities
2. Performance issues
3. Code quality and maintainability
4. Best practices violations"
# With timeout safety (5 minutes)
timeout 300 gemini -m gemini-3-pro-preview --approval-mode yolo \
"Perform a comprehensive code review..."
# For background execution
gemini -m gemini-3-pro-preview --approval-mode yolo \
"Review this architectural plan for:
1. Scalability concerns
2. Missing components
3. Integration challenges
4. Alternative approaches"
# For background execution
gemini -m gemini-3-pro-preview --approval-mode yolo \
"Analyze the entire codebase to understand:
1. Overall architecture
2. Key patterns and conventions
3. Potential technical debt
4. Refactoring opportunities"
# ONLY use default mode in interactive terminal
gemini -m gemini-3-pro-preview --approval-mode default \
"Review the authentication flow for security issues"
AskUserQuestion after each Gemini command to confirm next steps or gather clarifications.gemini --version or a Gemini command exits non-zero.--approval-mode yolo, -y, --sandbox), ask the user for permission using AskUserQuestion unless already granted.AskUserQuestion.# Check for hung processes
ps aux | grep -E "gemini.*gemini-3" | grep -v grep
# Look for these symptoms:
# - Process running 20+ minutes
# - CPU usage at 0%
# - Process state 'S' (sleeping)
# - No network connections
# Get detailed process info
ps -o pid,etime,pcpu,stat,command -p <PID>
# Check network activity
lsof -p <PID> 2>/dev/null | grep -E "(TCP|ESTABLISHED)" | wc -l
# If result is 0, process is hung
# Kill hung Gemini processes
pkill -9 -f "gemini.*gemini-3-pro-preview"
# Or kill specific PID
kill -9 <PID>
# Verify cleanup
ps aux | grep gemini | grep -v grep
--approval-mode yolo for background/automated taskstimeout 300 gemini ...--approval-mode default in non-interactive shellsps to ensure process completesgemini-3-pro-preview for complex reasoning, coding tasks, and maximum analysis quality (recommended default)gemini-3-flash for speed-critical tasks requiring sub-second response timesgemini-2.5-flash for cost-optimized high-volume processingRequires Gemini CLI v0.16.0 or later for Gemini 3 model support. Check version: gemini --version
Weekly Installs
572
Repository
GitHub Stars
1.2K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
gemini-cli417
cursor417
codex416
claude-code416
opencode399
cline397
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
136,300 周安装
OpenAPI 转 TypeScript 工具 - 自动生成 API 接口与类型守卫
563 周安装
数据库模式设计器 - 内置最佳实践,自动生成生产级SQL/NoSQL数据库架构
564 周安装
Rust Unsafe代码检查器 - 安全使用Unsafe Rust的完整指南与最佳实践
564 周安装
.NET并发编程模式指南:async/await、Channels、Akka.NET选择决策树
565 周安装
韩语语法检查器 - 基于国立国语院标准的拼写、空格、语法、标点错误检测与纠正
565 周安装
技能安全扫描器 - 检测Claude技能安全漏洞,防范提示注入与恶意代码
565 周安装
auto_edit: Auto-approve edit tools only (for code reviews with suggestions)yolo: Auto-approve all tools (✅ REQUIRED for background/automated tasks)Assemble the command with appropriate options:
-m, --model <MODEL> - Model selection--approval-mode <default|auto_edit|yolo> - Control tool approval-y, --yolo - Alternative to --approval-mode yolo-i, --prompt-interactive "prompt" - Execute prompt and continue interactively--include-directories <DIR> - Additional directories to include in workspace-s, --sandbox - Run in sandbox mode for isolationFor background/automated tasks, ALWAYS use--approval-mode yolo or add timeout wrapper. NEVER use default in non-interactive shells.
Run the command and capture the output. For background/automated mode:
# Recommended: Use yolo for background tasks
gemini -m gemini-3-pro-preview --approval-mode yolo "Review this codebase for security issues"
# Or with timeout (5 min limit)
timeout 300 gemini -m gemini-3-pro-preview --approval-mode yolo "Review this codebase"
For interactive sessions with an initial prompt:
gemini -m gemini-3-pro-preview -i "Review the authentication system" --approval-mode auto_edit
After Gemini completes , inform the user: "The Gemini analysis is complete. You can start a new Gemini session for follow-up analysis or continue exploring the findings."
| Interactive code review |
default |
-m gemini-3-pro-preview --approval-mode default (interactive terminal only) |
| Code review with auto-edits | auto_edit | -m gemini-3-pro-preview --approval-mode auto_edit |
| Automated refactoring | yolo | -m gemini-3-pro-preview --approval-mode yolo |
| Speed-critical background | yolo ✅ | -m gemini-3-flash --approval-mode yolo |
| Cost-optimized background | yolo ✅ | -m gemini-2.5-flash --approval-mode yolo |
| Multi-directory analysis | yolo (if background) | --include-directories <DIR1> --include-directories <DIR2> |
| Interactive with prompt | auto_edit or default | -i "prompt" --approval-mode <mode> |
| Legacy: Cost-efficient, high-volume tasks |
| 1M input / 65k output |
| Best price ($0.15/M), thinking mode |
gemini-2.5-flash-lite | Legacy: Fastest processing, high throughput | 1M input / 65k output | Maximum speed, minimal latency |