| description |
|---|
Delegate a coding task to Google Gemini agent for autonomous execution |
You are delegating a coding task to Gemini CLI. Gemini will analyze and execute the task.
- Identify the task from conversation context
- Read CLAUDE.md and inject context directly into the prompt
- Execute Gemini and report results
Review the conversation history and identify:
- What coding task does the user want accomplished?
- What files/areas of the codebase are involved?
- What does "done" look like?
Restate the task clearly. If unclear, ask the user to clarify.
- Read CLAUDE.md if it exists - extract relevant project context
- Use Read/Grep/Glob to find relevant code patterns
- Note any conventions or styles to follow
Write a detailed task specification that INCLUDES the CLAUDE.md context directly:
# Project Context
[Paste relevant sections from CLAUDE.md here]
# Task
[Clear description based on conversation context]
# Relevant Files
[List key files Gemini should know about]
# Requirements
- [specific requirement 1]
- [specific requirement 2]
# Success Criteria
- [how to know it's done correctly]
Please analyze this task and provide:
1. Your implementation approach
2. The code changes needed
3. Any risks or considerations
Do NOT:
- Tell Gemini how to implement (let it decide)
- Over-constrain the solution
DO:
- Include CLAUDE.md context directly in the prompt
- Be specific about requirements
- State clear success criteria
Run Gemini with your formulated task using a heredoc for shell safety:
gemini <<'EOF'
YOUR_TASK_WITH_CONTEXT_HERE
EOFAlternative if heredoc fails:
gemini "YOUR_TASK_WITH_CONTEXT_HERE"If Gemini provides code changes:
- Review the suggested changes
- Use Edit/Write tools to apply them
- Run any relevant tests or builds
[The task you identified from context]
[Summary of CLAUDE.md context you included]
- Analysis/approach
- Code changes proposed
- Risks identified
- Files created/modified
- Summary of changes
- Did it meet the success criteria?
- Any issues encountered?
- Any remaining tasks
- Things to review
If Gemini fails with auth error:
Please set GEMINI_API_KEY in your environment:
export GEMINI_API_KEY="your-key-here"
# Add to ~/.zshrc for persistence
If Gemini times out or returns partial output, report what was received and suggest retry.
- YOU identify the task from conversation context
- Inject CLAUDE.md content DIRECTLY into the prompt
- Unlike Codex, Gemini doesn't auto-apply changes - YOU must apply them
- If Gemini fails, report what happened and suggest fixes