gemini-cli
npx machina-cli add skill yu-iskw/coding-agent-skills/gemini-cli --openclawexecuting-gemini
Purpose
Use this skill to perform coding, research, or automation tasks using the gemini CLI. It maps requests to Gemini's native approval modes to balance automation with security.
Permission Tiers
| Tier | Gemini Mode | Capability | Approval Required | Typical Tasks |
|---|---|---|---|---|
| 0 | plan | Read-only access, analysis, research. | No | Code review, audits, web research. |
| 1 | auto_edit | Auto-approves file edits; prompts for shell. | Yes | Refactoring, documentation, lint fixes. |
| 2 | yolo | Auto-approves ALL tools (edits + shell). | Yes (High Risk) | CI/CD, complex builds, automated testing. |
Implementation Workflow
1. Quota Verification (Optional but Recommended)
Before initiating tasks, verify the remaining request quota to avoid session suspension.
- Tools: Check Google AI Studio or Google Cloud project dashboard for current usage.
- Constraints:
- Free/Unpaid: 250 requests/day, 10 requests/minute.
- Paid/Enterprise: 1500-2000 requests/day, 120 requests/minute.
2. Analyze & Classify
Analyze the user's intent to determine the required permission tier.
- Tier 0 (Plan): Does the task only involve reading code or searching for information?
- Tier 1 (Auto-Edit): Does the task involve modifying files but no command execution?
- Tier 2 (YOLO): Does the task require running tests, build scripts, or managing dependencies autonomously?
2. Approval Protocol
If the task maps to Tier 1 or Tier 2, you MUST obtain user approval before executing the gemini command.
Use the AskQuestion tool to confirm:
"I've detected that this task requires [Auto-Edit/YOLO] permissions to [modify files/run shell commands]. OK to proceed?"
3. Execution
Execute gemini using the mode determined by the tier. If resuming a session, you can check /stats within the interactive prompt for token usage.
# Tier 0 (Plan)
gemini -p "<prompt>" --approval-mode plan --sandbox
# Tier 1 (Auto-Edit)
gemini -p "<prompt>" --approval-mode auto_edit
# Tier 2 (YOLO)
gemini -p "<prompt>" --approval-mode yolo
Security Rules:
- NEVER use
--approval-mode yolowithout explicit confirmation of the risks. - ALWAYS use the most restrictive mode possible (prefer
plan). - If you are unsure, default to
planand escalate only ifgeminireports it cannot complete the task.
Configuration
This skill leverages native gemini CLI flags to enforce the permission tiers. No additional configuration files are required.
Examples
Refer to references/usage-examples.md for concrete scenarios.
Source
git clone https://github.com/yu-iskw/coding-agent-skills/blob/main/skills/gemini-cli/SKILL.mdView on GitHub Overview
This skill uses the Gemini CLI to perform coding, research, or automation tasks. It automatically selects the safest approval mode (plan, auto_edit, or yolo) based on the task type to balance automation with security.
How This Skill Works
It analyzes the user's intent to map the task to a permission tier, prompting for approval before Tier 1 or Tier 2 actions. It then executes gemini with the chosen mode using the -p prompt flag and the corresponding --approval-mode setting, and provides guidance for resuming sessions via /stats when needed.
When to Use It
- Read-only code analysis or information research without editing files.
- Modifying source files or docs with automated edits after user approval.
- Running tests, builds, or managing dependencies with automatic approval after confirmation.
- Tackling high-risk automation tasks that require explicit confirmation before using the YOLO mode.
- Resuming a session and monitoring token usage via the interactive prompt and /stats.
Quick Start
- Step 1: Analyze the task and classify it into plan, auto_edit, or yolo based on risk and edits required.
- Step 2: If auto_edit or yolo is needed, obtain user approval using the AskQuestion prompt before proceeding.
- Step 3: Run gemini with the chosen mode, for example: gemini -p "<prompt>" --approval-mode plan --sandbox (plan), gemini -p "<prompt>" --approval-mode auto_edit, or gemini -p "<prompt>" --approval-mode yolo.
Best Practices
- Start with plan mode for uncertain tasks to minimize risk.
- Obtain explicit user approval for auto_edit and yolo before proceeding.
- Verify your quota and session limits before long-running tasks.
- Prefer the most restrictive mode possible and escalate if completion is not feasible.
- Review gemini output and monitor token usage via /stats after execution.
Example Use Cases
- Perform a read-only code review and web research using plan mode.
- Refactor a function by auto_edit after receiving user consent.
- Update documentation and fix minor lint issues with automated edits after approval.
- Execute a full test/build pipeline in yolo mode with explicit confirmation due to high risk.
- Resume an ongoing session and check token usage with the /stats prompt.