Run Gemini CLI for interactive or non-interactive AI tasks, code generation, and agentic workflows
Install
npx skillscat add gswangg/gemini-cli Install via the SkillsCat registry.
SKILL.md
Gemini CLI
Gemini CLI for interactive and non-interactive AI tasks. Use -p for non-interactive mode.
Preferred Defaults
Unless otherwise specified, use these settings:
gemini -m gemini-3-pro-preview -p "your prompt"-m gemini-3-pro-preview- Preferred model-p- Non-interactive prompt mode
Basic Usage
# Non-interactive with prompt
gemini -p "your prompt here"
# Read prompt from stdin
echo "your prompt" | gemini -p ""
# Interactive mode
gemini
# Interactive with initial prompt
gemini -i "start with this prompt"
# Positional prompt (one-shot)
gemini "your query here"Key Options
Model Selection
-m, --model <MODEL> # Specify model (e.g., "gemini-3-pro-preview")Approval Modes
-y, --yolo # Auto-approve all tool calls
--approval-mode <MODE> # Set approval mode| Mode | Description |
|---|---|
default |
Prompt for approval |
auto_edit |
Auto-approve edit tools |
yolo |
Auto-approve all tools |
plan |
Read-only mode |
Sandbox
-s, --sandbox # Run in sandbox modeSession Management
-r, --resume <ID> # Resume session ("latest" or index number)
--list-sessions # List available sessions
--delete-session <ID> # Delete session by indexOutput Format
-o, --output-format <FORMAT>| Format | Description |
|---|---|
text |
Plain text output (default) |
json |
JSON with session_id, response, and stats |
stream-json |
Streaming JSONL events |
Workspace
--include-directories <DIR> # Additional directories to include (comma-separated or multiple flags)Extensions and Tools
-e, --extensions <EXT> # Specific extensions to use (default: all)
-l, --list-extensions # List available extensions
--allowed-tools <TOOLS> # Tools allowed without confirmation
--allowed-mcp-server-names <NAMES> # Allowed MCP server namesOther Options
-d, --debug # Debug mode (F12 opens debug console)
--screen-reader # Enable screen reader accessibilityOutput Formats
JSON Output (-o json)
Returns object with:
session_id- Session UUIDresponse- Final response textstats- Token usage and tool call stats per model
Stream JSON Output (-o stream-json)
Streaming JSONL events:
| Event Type | Description |
|---|---|
init |
Session started, includes session_id and model |
message |
User or assistant message with role and content |
result |
Final result with status and stats |
Common Patterns
Default Invocation
gemini -m gemini-3-pro-preview -p "your task"With YOLO Mode
gemini -m gemini-3-pro-preview -y -p "your task"With Output Capture
gemini -m gemini-3-pro-preview -p "your task" -o json > result.jsonResume Latest Session
gemini -r latestInclude Additional Directories
gemini -m gemini-3-pro-preview --include-directories /path/to/other -p "your task"Subcommands
gemini mcp # Manage MCP servers
gemini extensions <cmd> # Manage extensions
gemini skills <cmd> # Manage agent skills
gemini hooks <cmd> # Manage hooksNotes
- Use
-pfor non-interactive/scripted usage - Use
-ito start interactive with an initial prompt - Positional arguments are treated as one-shot queries
- Session resume uses index numbers from
--list-sessionsor "latest"