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 performi...
clawhub install gemini-cliπ About This Skill
name: gemini-cli description: 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. required_binaries: - gemini - node required_credentials: - gemini_api_key metadata: openclaw: type: ai-cli-tool trust_model: google-api-managed requires: binaries: - gemini - node system_tools: - bash credentials: gemini_api_key: Gemini API Key from Google AI Studio or Google Cloud install: - id: gemini-cli package: "@google/gemini-cli" kind: npm command: npm install -g @google/gemini-cli required: true - id: node package: nodejs kind: system command: Usually pre-installed or via brew/apt required: true security: external_binary: true binary_name: gemini manages_credentials: false credential_storage: environment-variable credential_scope: local-process capabilities: - query-codebases - generate-from-images - generate-from-pdfs - automate-workflows - ai-powered-debugging - interactive-ai-shell limitations: - requires-internet-connection - requires-valid-gemini-api-key - rate-limited-by-google-quotas
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:
Perfect for developers who want to leverage AI without leaving the terminal.
β οΈ Trust Model & Security Declaration
Metadata Declaration:
gemini (official Google package)Authentication Model:
This tool uses your Gemini API Key passed as an environment variable:
GEMINI_API_KEY= gemini
Key Points:
What This Skill Does:
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 CloudSystem Requirements:
Optional:
bash, zsh, or PowerShell β Any modern shellInstallation & 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=""
Or use it inline:
GEMINI_API_KEY="" gemini
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?"
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 --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
GEMINI_API_KEY environment variableTo persist API key across sessions (optional):
Add to your ~/.bashrc, ~/.zshrc, or equivalent:
export GEMINI_API_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 # Pass API key directly (overrides env var)
--model # Specify Gemini model (default: gemini-2.5-pro)
Help & Documentation
gemini --help # Global help
gemini --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
| Task | Gemini CLI | Cursor/IDE | Web 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)
π‘ Examples
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?"
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 --help
βοΈ Configuration
GEMINI_API_KEY environment variableTo persist API key across sessions (optional):
Add to your ~/.bashrc, ~/.zshrc, or equivalent:
export GEMINI_API_KEY=""
β οΈ Security warning: Only do this if your shell profile is secure and not synced to public repos.