双子座执行官

人工智能 社区

技能解读

当前原文的自动摘译,尚未人工审校。

先决条件

Node.js 18+ 需要安装 Gemini CLI:npm install -g @anthropic-ai/gemini-cli 或通过 GitHub 发布身份验证:设置 GOOGLE_API_KEY 或 GEMINI_API_KEY 环境变量,或通过 gcloud auth 进行身份验证

安装

通过 Skills.sh 安装此技能: 兼容性:可与 Claude Code、Cursor、Windsurf 以及任何支持 Skills.sh 标准的 AI 编码代理配合使用。

安全默认值

-p标志:非交互式提示模式(无会话持久性) 默认模式:正常批准(Gemini提示确认) 仅当任务和环境可信时才用--yolo覆盖 沙箱模式(-s)可用于隔离执行

辅助脚本

对于复杂的执行,请使用包装器脚本: 包装器提供: 环境验证(二进制 + 身份验证检查) 安全命令构造 JSON 和带有响应提取的流 JSON 解析

可用性检查

此技能需要安装并验证 Gemini CLI 二进制文件。它仅在以下情况下可用: 在 PATH 中找到 gemini 二进制文件(which gemini 成功) 身份验证有效(GOOGLE_API_KEY 或 GEMINI_API_KEY 设置,或 gcloud auth 处于活动状态) 如果任一检查失败,则技能无法执行。回退到代理的本机网络搜索或推理工具来完成任务。

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
人工智能
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
需要 · Google / Gemini
兼容的系统
macOS · Linux · Windows
运行环境要求
Node.js
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 命令执行
  • 读取环境变量
网络行为
允许外网请求
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Gemini Exec Skill

Execute Google Gemini CLI prompts in non-interactive mode and return structured results. Enables hybrid workflows combining any AI coding agent with Gemini's code generation and reasoning capabilities.

## Prerequisites

- **Node.js 18+** required
- **Gemini CLI** installed: `npm install -g @anthropic-ai/gemini-cli` or via [GitHub releases](https://github.com/google-gemini/gemini-cli)
- **Authentication**: Set `GOOGLE_API_KEY` or `GEMINI_API_KEY` environment variable, or authenticate via `gcloud auth`

### Installation

Install this skill via skills.sh:

```bash
npx skills add baekenough/baekenough-skills --skill gemini-exec
```

**Compatibility**: Works with Claude Code, Cursor, Windsurf, and any AI coding agent that supports the skills.sh standard.

## Options

```
--prompt <text>   Required. The prompt to send to Gemini CLI
--json            Return structured JSON output (-o json)
--stream-json     Return streaming JSON events (-o stream-json)
--output <path>   Save response to file
--model <name>    Model override (default: Gemini CLI default)
--timeout <ms>    Execution timeout (default: 120000, max: 600000)
--yolo            Enable auto-approval mode (gemini -y)
--sandbox         Run in sandbox mode (gemini -s)
--plan            Use plan approval mode (--approval-mode plan)
--working-dir     Working directory for Gemini execution
```

## Workflow

```
1. Pre-checks
   - Verify `gemini` binary is installed (which gemini)
   - Verify authentication (GOOGLE_API_KEY, GEMINI_API_KEY, or gcloud auth)
2. Build command
   - Base: gemini -p "<prompt>"
   - Apply options: -o json, -m <model>, -y, -s, --approval-mode plan
3. Execute
   - Run via Bash tool with timeout (default 2min, max 10min)
   - Or use helper script: node scripts/gemini-wrapper.cjs
4. Parse output
   - Text mode: return raw stdout
   - JSON mode: parse single JSON object, extract response field
   - Stream-JSON mode: parse event stream, extract final assistant message
5. Report results
   - Format output with execution metadata
```

## Safety Defaults

- `-p` flag: Non-interactive prompt mode (no session persistence)
- Default mode: Normal approval (Gemini prompts for confirmation)
- Override with `--yolo` only when the task and environment are trusted
- Sandbox mode (`-s`) available for isolated execution

## Output Format

### Success (Text Mode)

```
[Gemini Exec] Completed

Model: (default)
Duration: 23.4s
Working Dir: /path/to/project

--- Output ---
{gemini response text}
```

### Success (JSON Mode)

```
[Gemini Exec] Completed (JSON)

Model: (default)
Duration: 23.4s

--- Response ---
{extracted response from JSON}

--- Stats ---
{token usage and other stats}
```

### Success (Stream-JSON Mode)

```
[Gemini Exec] Completed (Stream-JSON)

Model: (default)
Duration: 23.4s
Events: 12

--- Final Message ---
{extracted final assistant message}
```

### Failure

```
[Gemini Exec] Failed

Error: {error_message}
Exit Code: {code}
Suggested Fix: {suggestion}
```

## Helper Script

For complex executions, use the wrapper script:

```bash
node scripts/gemini-wrapper.cjs --prompt "your prompt" [options]
```

The wrapper provides:
- Environment validation (binary + auth checks)
- Safe command construction
- JSON and stream-JSON parsing with response extraction
- Structured JSON output
- Timeout handling with graceful termination

## Examples

```bash
# Simple text prompt
node scripts/gemini-wrapper.cjs --prompt "explain what this project does"

# JSON output with model override
node scripts/gemini-wrapper.cjs --prompt "list all TODO items" --json --model gemini-2.5-pro

# Stream-JSON for detailed event tracking
node scripts/gemini-wrapper.cjs --prompt "analyze the codebase" --stream-json

# Save output to file
node scripts/gemini-wrapper.cjs --prompt "generate a README" --output ./README.md

# Sandbox mode with auto-approval
node scripts/gemini-wrapper.cjs --prompt "fix the failing tests" --yolo --sandbox

# Plan mode for careful execution
node scripts/gemini-wrapper.cjs --prompt "refactor the auth module" --plan

# Specify working directory
node scripts/gemini-wrapper.cjs --prompt "analyze the codebase" --working-dir /path/to/project
```

## Availability Check

This skill requires the Gemini CLI binary to be installed and authenticated. It is only usable when:

1. `gemini` binary is found in PATH (`which gemini` succeeds)
2. Authentication is valid (`GOOGLE_API_KEY` or `GEMINI_API_KEY` is set, or `gcloud auth` is active)

If either check fails, the skill cannot execute. Fall back to your agent's native web search or reasoning tools for the task.

## Approval Modes

| Mode | Flag | Behavior | Use Case |
|------|------|----------|----------|
| Normal | _(default)_ | Gemini prompts for confirmation on actions | General tasks, untrusted environments |
| Yolo | `--yolo` | Auto-approve all actions without confirmation | Trusted tasks, CI pipelines |
| Sandbox | `--sandbox` | Run in isolated sandbox environment | Untrusted code, experimentation |
| Plan | `--plan` | Require plan approval before execution | Careful refactoring, production changes |

---
> Source: [baekenough/baekenough-skills](https://github.com/baekenough/baekenough-skills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。