gemini
Scannednpx machina-cli add skill addsalt1t/evoca/gemini --openclawGemini CLI Skill
Running a Task
-
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:
auto→auto (routed),pro→gemini-3-pro-preview,flash→gemini-3-flash-preview,flash-lite→gemini-2.5-flash-lite - Missing/invalid → ask user via
AskUserQuestionfor model, approval_mode, background. - User overrides in message (e.g., "use pro", "plan mode") → apply over defaults.
- Defaults exist → use directly. Resolve alias to full name and print:
-
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 defaultcauses approval prompts in headless and will fail. Must useplan,auto_edit, oryolo. - Unknown flag errors → read references/commands.md.
- Headless flags:
-
Execute.
- Background (
"background": true, default): Run withrun_in_background: trueon Bash tool → immediatelyTaskOutputwithblock: false(startup check: if already completed with non-zero exit, stop and report error) → thenTaskOutputwithblock: true→ Read/tmp/gemini_output.md. Mid-run:TaskOutputblock: falsefor progress,TaskStopto abort. - Foreground (
"background": false): Run directly withtimeout: 300000.
- Background (
-
Summarize outcome. Inform user they can resume with "gemini resume".
Changing Defaults
When user says "gemini config", "change gemini settings", or "change gemini defaults":
- Show current
defaults.json. - Ask via
AskUserQuestionwhich settings to change. - Write updated values to
defaults.jsonin skill base directory.
Error Handling
- Non-zero exit: stop and report, ask before retrying.
- Always capture stderr: Use
2>&1to include errors. Never use2>/dev/null. - Before
--approval-mode yolo: confirm with user viaAskUserQuestion.
References
- Commands, flags, models: references/commands.md
- Sessions, MCP, extensions, skills, hooks, config: references/management.md
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
- Step 1: Read defaults.json and determine the model, approval mode, and background preference.
- Step 2: Assemble the command with appropriate flags (e.g., -p "<prompt>", -m <MODEL>, --approval-mode <MODE>, -r <SESSION>).
- 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.