| name | gemini |
| description | Gemini CLI integration |
Gemini CLI Skill Guide
Running a Task
- Model Selection:
- By default, use the latest Preview model (omit
-mflag) - Only ask the user (via
AskUserQuestion) which specific model to use if the task requires a particular model
- By default, use the latest Preview model (omit
- Select the approval mode based on the task:
default: For read-only analysis (prompt for all tool approvals)auto_edit: For editing tasks (auto-approve edit tools)yolo: For full automation (auto-approve all tools)
- Assemble the command with the appropriate options:
-m, --model <MODEL>--approval-mode <default|auto_edit|yolo>-s, --sandbox(if sandbox environment is needed)--allowed-tools <tool1,tool2>(to allow specific tools without confirmation)--include-directories <dir1,dir2>(to include additional directories)
- For non-interactive prompts, use positional arguments or stdin:
gemini "your prompt here"(one-shot mode)echo "your prompt" | gemini(stdin mode)
- For interactive sessions, use
-i, --prompt-interactive:gemini -i "initial prompt"(starts interactive mode after executing prompt)
- Run the command, capture stdout, and summarize the outcome for the user.
- After Gemini completes, inform the user: "You can resume this Gemini session at any time by saying 'gemini resume' or asking me to continue with additional analysis or changes."
Quick Reference
| Use case | Approval mode | Key flags |
|---|---|---|
| Read-only review or analysis | default |
--approval-mode default |
| Apply local edits | auto_edit |
--approval-mode auto_edit |
| Full automation | yolo |
--approval-mode yolo or -y |
| Resume most recent session | Inherited from original | --resume latest |
| Resume specific session | Inherited from original | --resume <index> |
| List available sessions | N/A | --list-sessions |
| Interactive mode | As needed | -i "prompt" |
| Sandbox environment | As needed | -s or --sandbox |
Session Management
- Resume latest session:
gemini --resume latest "new prompt" - Resume specific session:
gemini --resume 5 "new prompt"(use session index) - List sessions:
gemini --list-sessions - Delete session:
gemini --delete-session <index> - Resumed sessions automatically inherit the model and approval mode from the original session.
Following Up
- After every
geminicommand, immediately useAskUserQuestionto confirm next steps, collect clarifications, or decide whether to resume the session. - When resuming, use
gemini --resume latest "new prompt"to continue the previous conversation. - Restate the chosen model and approval mode when proposing follow-up actions.
Check available models with gemini --help or user configuration.
Error Handling
- Stop and report failures whenever a
geminicommand exits non-zero; request direction before retrying. - Before using high-impact flags (
-y/--yolo,--approval-mode yolo), ask the user for permission usingAskUserQuestionunless already given. - When output includes warnings or partial results, summarize them and ask how to adjust using
AskUserQuestion.
Extensions and MCP Servers
- By default, Disable all extensions (including MCP):
gemini --extension ''(empty string) - List available extensions:
gemini --list-extensions - Use specific extensions:
gemini -e extension1,extension2 "prompt" - Manage MCP servers:
gemini mcp add/remove/list - Allow specific MCP servers:
--allowed-mcp-server-names server1,server2
Prompting Best Practices
For advanced prompting strategies to improve response quality and accuracy, refer to @references/prompting-guide.md
Topics covered:
- Core Strategies: Clear instructions, few-shot vs zero-shot prompts, adding context, using prefixes, breaking down prompts
- Response Formatting: System instructions, completion strategies
- Model Parameters: Temperature, topK, topP, stop sequences
- Gemini Best Practices: Structured prompting templates, enhancing reasoning, self-critique
- Iteration Strategies: Rephrasing, analogous tasks, reordering content
- Common Pitfalls: What to avoid and how to handle fallback responses
When to consult: When you need to craft complex prompts, improve response quality, or leverage Gemini's advanced reasoning capabilities.
Prompt Crafting Workflow
Before executing a gemini command, ensure the prompt is well-structured:
- Clarify requirements first: If the user's request is ambiguous or requires decisions (e.g., choice of approach, scope, constraints), use
AskUserQuestionto gather necessary information before crafting the prompt. - Structure the prompt: Apply appropriate strategies from the prompting guide:
- Add context if needed (e.g., relevant code, logs, documentation)
- Use few-shot examples for format consistency
- Define constraints explicitly
- Use XML/Markdown structure with clear sections
- Execute and iterate: Run the command, then use
AskUserQuestionto confirm next steps or gather feedback for prompt refinement.