双子命令行

gemini-cli

by bigbubbaagent-bot

Gemini CLI tool for building, debugging & deploying with AI. Use when querying codebases, generating apps from images/PDFs, automating workflows, or performing AI-powered code tasks from the command line.

3.7k效率与工作流未扫描2026年3月23日

安装

claude skill add --url github.com/openclaw/skills/tree/main/skills/bigbubbaagent-bot/gemini-cli

文档

Gemini CLI Skill

A comprehensive guide for using the Gemini CLI tool to build, debug & deploy with AI directly from the command line.

What It Does

Gemini CLI enables command-line access to Google's Gemini models for:

  • Query Codebases — Analyze and understand large codebases
  • Generate from Images — Create code, docs, or apps from screenshot/images
  • Generate from PDFs — Extract and build from PDF documents
  • Automate Workflows — Chain AI tasks for complex automation
  • Interactive Shell — Chat with Gemini about your project
  • Debugging — Get AI-powered debugging and code review

Perfect for developers who want to leverage AI without leaving the terminal.

⚠️ Trust Model & Security Declaration

Metadata Declaration:

  • Type: AI CLI tool (Google-managed, official)
  • External Binary: gemini (official Google package)
  • Manages Credentials: No (credentials stored locally as env var)
  • Credential Storage: Environment variable (GEMINI_API_KEY)
  • Capabilities: Code analysis, generation, automation
  • Limitations: Requires internet, API quota limits apply

Authentication Model:

This tool uses your Gemini API Key passed as an environment variable:

bash
GEMINI_API_KEY=<your-key> gemini <command>

Key Points:

  • ✅ Official Google tool (not third-party)
  • ✅ Credentials stored as environment variable (not in tool)
  • ✅ You control scope: set env var only when needed
  • ✅ No persistent credential storage in ~/.gemini/ directory
  • ✅ Direct calls to Gemini API endpoints (googleapis.com)

What This Skill Does:

  • ✅ Queries your codebase and documents with Gemini models
  • ✅ Generates code/apps from images and PDFs
  • ✅ Runs automated workflows using AI
  • ✅ Provides interactive debugging and code review
  • ❌ Does NOT store credentials
  • ❌ Does NOT cache sensitive data
  • ❌ Does NOT modify your system beyond running commands

Requirements

Binaries (required):

  • gemini — Gemini CLI tool (installed via npm)
  • node — Node.js 20.0.0+ (usually pre-installed)

Credentials (environment variable):

  • GEMINI_API_KEY — Your Gemini API key from Google AI Studio or Google Cloud

System Requirements:

  • macOS 15+, Windows 11 24H2+, or Ubuntu 20.04+
  • 4GB+ RAM (casual usage), 16GB+ (power usage with large codebases)
  • Internet connection required

Optional:

  • bash, zsh, or PowerShell — Any modern shell

Installation & Setup

1. Check Installation

Gemini CLI is usually pre-installed:

bash
gemini --version

If not installed:

bash
npm install -g @google/gemini-cli
# OR
brew install gemini-cli

2. Set API Key (One-time per session)

bash
export GEMINI_API_KEY="<your-api-key>"

Or use it inline:

bash
GEMINI_API_KEY="<your-api-key>" gemini <command>

To find your API key:

3. Verify Installation

bash
gemini --version
gemini --help

Quick Start

Interactive Shell (Ask Gemini Questions)

bash
gemini chat

Then type your questions about code, architecture, debugging, etc.

Query a Codebase

bash
gemini code --prompt "What does this function do?" <file-or-directory>

Generate from Image

bash
gemini create --from-image ./screenshot.png --prompt "Create a React component from this design"

Generate from PDF

bash
gemini create --from-pdf ./document.pdf --prompt "Create an API spec based on this document"

Automate a Workflow

bash
gemini workflow --steps "1) analyze code, 2) identify issues, 3) suggest fixes"

Get Help

bash
gemini --help
gemini <command> --help

Common Commands

Interactive

bash
gemini chat                    # Start interactive chat
gemini chat --context ./src    # Chat with codebase context

Code Analysis

bash
gemini code --prompt "analyze" ./file.js
gemini code --explain ./function.ts
gemini code --review ./pull_request.patch

Code Generation

bash
gemini create --from-image ./design.png
gemini create --from-pdf ./spec.pdf
gemini create --template react --prompt "counter app"

Batch Operations

bash
gemini batch --input ./tasks.json --output ./results.json

Configuration

  • API Key: Set via GEMINI_API_KEY environment variable
  • Temp Storage: Uses system temp directory (auto-cleaned)
  • No persistent config: Unlike mirocli, Gemini CLI doesn't store auth locally

To persist API key across sessions (optional):

Add to your ~/.bashrc, ~/.zshrc, or equivalent:

bash
export GEMINI_API_KEY="<your-key>"

⚠️ Security warning: Only do this if your shell profile is secure and not synced to public repos.

Global Options

bash
--version              # Show version
--help                # Show help
--verbose             # Verbose output
--api-key <key>       # Pass API key directly (overrides env var)
--model <model>       # Specify Gemini model (default: gemini-2.5-pro)

Help & Documentation

bash
gemini --help                  # Global help
gemini <command> --help        # Command-specific help

Official Docs: https://geminicli.com/docs

Tips & Tricks

  1. Use with your codebase:

    bash
    cd /path/to/your/project
    gemini chat --context ./src
    
  2. Chain commands:

    bash
    gemini code --review ./changes.patch | tee review.txt
    
  3. Batch process files:

    bash
    for file in src/*.js; do
      gemini code --explain "$file" > "docs/${file}.md"
    done
    
  4. Store prompts in files:

    bash
    cat prompt.txt | gemini chat
    

When to Use Gemini CLI vs Other Tools

TaskGemini CLICursor/IDEWeb UI
Quick code questions✅ Fast✅ Integrated❌ Context switch
Large codebase analysis✅ Better✅ Native❌ Limited
Generate from images✅ Works✅ Works✅ Works
Batch automation✅ Perfect❌ Manual❌ Manual
Interactive chat✅ Terminal✅ IDE✅ Browser
Scripting workflows✅ Yes❌ No❌ No

Status & Next Steps

✅ Installation: Pre-installed (v0.28.2)

✅ Configuration: Ready to use with GEMINI_API_KEY environment variable

✅ Authentication: Set env var before use (no interactive steps needed)

Testing: Run gemini --help to verify installation

Usage: Set API key and start using:

bash
export GEMINI_API_KEY="your-key-here"
gemini chat

Setup Date: 2026-03-14
Status: Ready (no authentication required — env var based)

相关 Skills

表格处理

by anthropics

Universal
热门

围绕 .xlsx、.xlsm、.csv、.tsv 做读写、修复、清洗、格式整理、公式计算与格式转换,适合修改现有表格、生成新报表或把杂乱数据整理成交付级电子表格。

做 Excel/CSV 相关任务很省心,能直接读写、修复、清洗和格式转换,尤其擅长把乱七八糟的表格整理成交付级文件。

效率与工作流
未扫描109.6k

PDF处理

by anthropics

Universal
热门

遇到 PDF 读写、文本表格提取、合并拆分、旋转加水印、表单填写或加解密时直接用它,也能提取图片、生成新 PDF,并把扫描件通过 OCR 变成可搜索文档。

PDF杂活别再来回切工具了,文本表格提取、合并拆分到OCR识别一次搞定,连扫描件也能变可搜索。

效率与工作流
未扫描109.6k

Word文档

by anthropics

Universal
热门

覆盖Word/.docx文档的创建、读取、编辑与重排,适合生成报告、备忘录、信函和模板,也能处理目录、页眉页脚、页码、图片替换、查找替换、修订批注及内容提取整理。

搞定 .docx 的创建、改写与精排版,目录、批量替换、批注修订和图片更新都能自动化,做正式文档尤其省心。

效率与工作流
未扫描109.6k

相关 MCP 服务

文件系统

编辑精选

by Anthropic

热门

Filesystem 是 MCP 官方参考服务器,让 LLM 安全读写本地文件系统。

这个服务器解决了让 Claude 直接操作本地文件的痛点,比如自动整理文档或生成代码文件。适合需要自动化文件处理的开发者,但注意它只是参考实现,生产环境需自行加固安全。

效率与工作流
82.9k

by wonderwhy-er

热门

Desktop Commander 是让 AI 直接执行终端命令、管理文件和进程的 MCP 服务器。

这工具解决了 AI 无法直接操作本地环境的痛点,适合需要自动化脚本调试或文件批量处理的开发者。它能让你用自然语言指挥终端,但权限控制需谨慎,毕竟让 AI 执行 rm -rf 可不是闹着玩的。

效率与工作流
5.8k

EdgarTools

编辑精选

by dgunning

热门

EdgarTools 是无需 API 密钥即可解析 SEC EDGAR 财报的开源 Python 库。

这个工具解决了金融数据获取的痛点——直接让 AI 读取结构化财报,比如让 Claude 分析苹果的 10-K 文件。适合量化分析师或金融开发者快速构建数据管道。但注意,它依赖 SEC 网站稳定性,高峰期可能延迟。

效率与工作流
1.9k

评论