AgentSkillsCN

gemini-cli

Gemini CLI使用模式参考。在通过Bash调用gemini前查阅。

SKILL.md
--- frontmatter
name: gemini-cli
description: Reference for Gemini CLI usage patterns. Consult before calling gemini via Bash.

Gemini CLI Reference

Quick reference for Gemini CLI commands.

Basic Command

bash
gemini "[prompt]" -m gemini-3-flash-preview -o text 2>&1

Common Flags

FlagPurpose
-m gemini-3-flash-previewModel selection
-o textHuman-readable output
-o jsonStructured output with stats
-r [index]Resume session by index
--allowed-toolsRestrict available tools
--list-sessionsList available sessions

Session Continuation

bash
# List sessions
gemini --list-sessions

# Resume by index
echo "follow-up prompt" | gemini -r 1 -m gemini-3-flash-preview -o text 2>&1

Bash Execution Notes

  • Use dangerouslyDisableSandbox: true for Bash calls
  • Always append 2>&1 to capture all output
  • Use timeout of 300000ms (5 min) or longer for complex tasks

Troubleshooting

EPERM errors: Gemini needs write access to ~/.gemini/tmp/ - use dangerouslyDisableSandbox: true

File access: Gemini can only read files in the workspace directory (project root)

Rate limits: Free tier is 60/min, 1000/day. CLI auto-retries with backoff.

More Information