Get the FREE Ultimate OpenClaw Setup Guide →

gemini

Scanned
npx machina-cli add skill addsalt1t/evoca/gemini --openclaw
Files (1)
SKILL.md
2.8 KB

Gemini CLI Skill

Running a Task

  1. Read defaults: Read defaults.json (in skill base directory) using Read tool.

    • Defaults exist → use directly. Resolve alias to full name and print: [Gemini] model: <FULL_NAME> | approval: <MODE> | background: <BOOL>
    • Alias → full name mapping: autoauto (routed), progemini-3-pro-preview, flashgemini-3-flash-preview, flash-litegemini-2.5-flash-lite
    • Missing/invalid → ask user via AskUserQuestion for model, approval_mode, background.
    • User overrides in message (e.g., "use pro", "plan mode") → apply over defaults.
  2. Assemble command. Always capture output: > /tmp/gemini_output.md 2>&1

    • Headless flags: -p "<prompt>" | -m <MODEL> | --approval-mode <MODE> | -r <SESSION> | -s (sandbox) | -o <FORMAT> | -e <EXTENSIONS> | --include-directories <DIRS>
    • Approval: analysis/review → plan. editing → auto_edit. full autonomy → yolo (requires user confirmation).
    • CRITICAL: --approval-mode default causes approval prompts in headless and will fail. Must use plan, auto_edit, or yolo.
    • Unknown flag errors → read references/commands.md.
  3. Execute.

    • Background ("background": true, default): Run with run_in_background: true on Bash tool → immediately TaskOutput with block: false (startup check: if already completed with non-zero exit, stop and report error) → then TaskOutput with block: true → Read /tmp/gemini_output.md. Mid-run: TaskOutput block: false for progress, TaskStop to abort.
    • Foreground ("background": false): Run directly with timeout: 300000.
  4. Summarize outcome. Inform user they can resume with "gemini resume".

Changing Defaults

When user says "gemini config", "change gemini settings", or "change gemini defaults":

  1. Show current defaults.json.
  2. Ask via AskUserQuestion which settings to change.
  3. Write updated values to defaults.json in skill base directory.

Error Handling

  • Non-zero exit: stop and report, ask before retrying.
  • Always capture stderr: Use 2>&1 to include errors. Never use 2>/dev/null.
  • Before --approval-mode yolo: confirm with user via AskUserQuestion.

References

Source

git clone https://github.com/addsalt1t/evoca/blob/main/plugins/gemini/skills/gemini/SKILL.mdView on GitHub

Overview

Gemini CLI Skill lets you run Gemini for code analysis, refactoring, and automated edits. It reads defaults.json to select the model, resolves aliases, builds a command with the correct flags, and can run in foreground or background, then summarizes the outcome for easy resumption.

How This Skill Works

The skill reads defaults.json in the skill base, maps aliases to full model names, and prompts if defaults are missing. It assembles a Gemini command with flags (-p, -m, --approval-mode, -r, -s, -o, -e, --include-directories) and handles approval modes (plan, auto_edit, yolo). It executes either in background (with run_in_background) or foreground, writes output to /tmp/gemini_output.md, and provides a summary with an option to resume via gemini resume.

When to Use It

  • You want to run Gemini for code analysis or automated refactoring on a project.
  • You need automated editing using plan mode for analysis or yolo for full automation with user confirmation.
  • You prefer running Gemini in the background to monitor progress and fetch results later.
  • You need to inspect or change the current defaults via gemini config and update defaults.json.
  • You want to resume a previously started Gemini task with gemini resume.

Quick Start

  1. Step 1: Read defaults.json and determine the model, approval mode, and background preference.
  2. Step 2: Assemble the command with appropriate flags (e.g., -p "<prompt>", -m <MODEL>, --approval-mode <MODE>, -r <SESSION>).
  3. Step 3: Execute in background or foreground, then read /tmp/gemini_output.md and use gemini resume to continue if needed.

Best Practices

  • Always capture both stdout and stderr with 2>&1 to prevent missing errors.
  • Read defaults.json first; apply alias mappings (e.g., auto → auto (routed)) before running.
  • Avoid using --approval-mode default in headless runs; use plan, auto_edit, or yolo with confirmation.
  • For long tasks, prefer background execution and check /tmp/gemini_output.md for progress.
  • Verify and test changes in a sandbox environment before applying broad edits.

Example Use Cases

  • Analyze a codebase using the default model from defaults.json with plan mode and capture output to /tmp/gemini_output.md.
  • Run automated edits on a patch by invoking Gemini with -m <model> and --approval-mode auto_edit, then review the resulting /tmp/gemini_output.md.
  • Start a background Gemini task to refactor multiple files and periodically read /tmp/gemini_output.md for progress.
  • Modify the default model via gemini config to gemini-3-pro-preview and save the updated defaults.json.
  • Resume a previously paused session with gemini resume and continue the task from where it left off.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers