Main Site ↗

gemini-cli

by forayconsulting16917GitHub

Integrates Google's Gemini CLI into Claude's workflow for code generation, review, and web research. Provides specific commands for different tasks, handles rate limits, and explains how to process Gemini's JSON output. Useful for getting a second AI opinion or current web information.

Unlock Deep Analysis

Use AI to visualize the workflow and generate a realistic output preview for this skill.

Powered by Fastest LLM

Target Audience

Developers who want to use both Claude and Gemini for code tasks, especially those needing web search or a second AI opinion

7/10Security

Low security risk, safe to use

9
Clarity
8
Practicality
7
Quality
8
Maintainability
8
Innovation
Integration
ai-integrationcode-generationweb-searchcode-reviewmulti-model
Compatible Agents
Claude Code
Claude Code
~/.claude/skills/
Codex CLI
Codex CLI
~/.codex/skills/
Gemini CLI
Gemini CLI
~/.gemini/skills/
O
OpenCode
~/.opencode/skills/
O
OpenClaw
~/.openclaw/skills/
GitHub Copilot
GitHub Copilot
~/.copilot/skills/
Cursor
Cursor
~/.cursor/skills/
W
Windsurf
~/.codeium/windsurf/skills/
C
Cline
~/.cline/skills/
R
Roo Code
~/.roo/skills/
K
Kiro
~/.kiro/skills/
J
Junie
~/.junie/skills/
A
Augment Code
~/.augment/skills/
W
Warp
~/.warp/skills/
G
Goose
~/.config/goose/skills/
SKILL.md

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:

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:

gemini --version

If not installed:

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

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

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

Or use it inline:

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

To find your API key:

3. Verify Installation

gemini --version
gemini --help

Quick Start

Interactive Shell (Ask Gemini Questions)

gemini chat

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

Query a Codebase

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

Generate from Image

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

Generate from PDF

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

Automate a Workflow

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

Get Help

gemini --help
gemini <command> --help

Common Commands

Interactive

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

Code Analysis

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

Code Generation

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

Batch Operations

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:

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

--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

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

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

Tips & Tricks

  1. Use with your codebase:

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

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

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

    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:

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

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

Source: https://github.com/forayconsulting/gemini_cli_skill

Content curated from original sources, copyright belongs to authors

Grade A
7.8AI Score
Best Practices
Checking...
Try this Skill

User Rating

USER RATING

0UP
0DOWN
Loading files...

WORKS WITH

Claude Code
Claude
Codex CLI
Codex
Gemini CLI
Gemini
O
OpenCode
O
OpenClaw
GitHub Copilot
Copilot
Cursor
Cursor
W
Windsurf
C
Cline
R
Roo
K
Kiro
J
Junie
A
Augment
W
Warp
G
Goose