Gemini CLI Skill Guide
Running a Task
- Ask the user (via
AskUserQuestion) which model to use (see list below). - ALWAYS use non-interactive mode with
-pand ALWAYS YOLO mode (-yor--approval-mode yolo). - Assemble the command with the appropriate options:
-m, --model <MODEL>(optional, uses the default model if not specified)-y, --yoloMANDATORY (auto-approves all actions)-p, --prompt "<PROMPT>"MANDATORY (non-interactive mode)--allowed-tools <TOOLS>(optional, to specify allowed tools)-r, --resume <latest|INDEX>to resume a session
- To continue a previous session, use
gemini -r latestorgemini -r <INDEX>. - Run the command, capture stdout/stderr, and summarize the result for the user.
- After running Gemini, inform the user: "You can resume this Gemini session at any time by saying 'gemini resume' or using
gemini -r latest."
Available Gemini Models
gemini-3-pro-preview- The world's best model for multimodal understanding, most powerful for coding and agentsgemini-2.5-pro- Advanced reasoning model, excellent for complex problems in code, math, and sciencegemini-2.5-flash- Best performance-to-price ratio, versatile, ideal for large-scale processinggemini-2.5-flash-lite- Fastest Flash model, optimized for cost-effectiveness and high throughput
Quick Reference
| Use Case | Mode | Key Flags |
|---|---|---|
| Direct prompt (default) | Non-interactive YOLO | gemini -y -p "your prompt" |
| With specific model | Non-interactive YOLO | gemini -m gemini-3-pro-preview -y -p "prompt" |
| Resume recent session | Resume YOLO | gemini -r latest -y -p "new prompt" |
| Resume specific session | Resume YOLO | gemini -r 5 -y -p "new prompt" |
| List sessions | Utility | gemini --list-sessions |
| Use specific extensions | With extensions YOLO | gemini -e ext1 ext2 -y -p "prompt" |
| Screen reader mode | Accessibility YOLO | gemini --screen-reader -y -p "prompt" |
Follow-up
- After each
geminicommand, immediately useAskUserQuestionto confirm next steps, gather details, or decide to resume withgemini -r latest -y -p "new prompt". - When resuming, the session automatically retains the context, model, and parameters of the original session.
- Restate the chosen model when proposing follow-up actions.
- Always remind that YOLO mode (
-y) is mandatory for all commands.
Error Handling
- Stop and report failures whenever
gemini --versionor ageminicommand returns a non-zero exit code; ask for direction before retrying. - YOLO mode (
-y) is always used by default - no additional permission is needed. - When output includes warnings or partial results, summarize them and ask how to adjust via
AskUserQuestion.
Output Formats
- text (default): Readable text output
- json: Structured JSON output
- stream-json: Streaming JSON output
Use -o, --output-format <FORMAT> to specify the output format.