google-ai-studio

star 0

Orchestrates Gemini models via Google AI Studio and Gemini CLI for reasoning, code generation, multimodal analysis, and automated workflows. Use when user says "Gemini", "Google AI", "Gemini CLI", "prompt engineering", "model selection", "context window", "multimodal", "image analysis", "large context", "schedule Gemini", or needs AI model orchestration beyond Claude.

Bobby44-max By Bobby44-max schedule Updated 3/10/2026

name: google-ai-studio description: Orchestrates Gemini models via Google AI Studio and Gemini CLI for reasoning, code generation, multimodal analysis, and automated workflows. Use when user says "Gemini", "Google AI", "Gemini CLI", "prompt engineering", "model selection", "context window", "multimodal", "image analysis", "large context", "schedule Gemini", or needs AI model orchestration beyond Claude. compatibility: Requires Google AI Studio API key (GEMINI_API_KEY). Supports Gemini 2.0 Pro (long-horizon) and Flash (rapid tasks). Gemini CLI for terminal workflows. Integrates with knowledge-harvester for grounded prompting and n8n for scheduled automation. metadata: author: Apex AI Fleet version: 3.0.0 category: ai-orchestration tags: [gemini, google-ai, prompt-engineering, multimodal, model-selection, reasoning, gemini-cli, automation]

Google AI Studio: Model Orchestration and Gemini CLI

Enables orchestration of Gemini models for specialized tasks. Selects the right model for the right task horizon. Includes Gemini CLI setup for terminal-based AI workflows and n8n-scheduled automation.

Instructions

Step 1: Classify the Task Horizon

Match the task to the right model:

Task Type Model Why
Long-horizon planning, complex architecture Gemini 2.0 Pro Deep reasoning, large context
Rapid prototyping, simple refactors Gemini 2.0 Flash Speed + cost optimized
Image generation/editing Imagen 3 Native visual generation
Screenshot/UI analysis Gemini 2.0 Pro Multimodal spatial reasoning
Data extraction at scale Gemini 2.0 Flash High throughput, low latency
Marketing content batch generation Gemini 2.0 Flash Speed for scheduled workflows
Codebase-wide analysis Gemini 2.0 Pro 1M+ token context window

Step 2: Gemini CLI Setup

Install and authenticate the CLI for terminal-based workflows:

# Install the Google Generative AI SDK
npm install -g @google/generative-ai

# Set your API key
export GEMINI_API_KEY="your-api-key-from-ai-studio"

# Add to shell profile for persistence
echo 'export GEMINI_API_KEY="your-api-key"' >> ~/.bashrc
source ~/.bashrc

# Verify connection
gemini "Respond with 'Connected' if you can read this"

To get an API key:

  1. Go to Google AI Studio (aistudio.google.com)
  2. Click "Get API Key"
  3. Create key in your GCP project (see google-workspace-setup skill)
  4. Copy and set as environment variable

Step 3: Construct the Prompt

Follow these prompt engineering standards:

  1. System instruction: Define the role, constraints, and output format
  2. Context grounding: Include relevant docs from knowledge/tool-docs/
  3. Task specification: Clear, unambiguous instruction
  4. Output format: Specify JSON, Markdown, code, or other format explicitly
  5. Thinking enabled: Use thinking levels to verify reasoning before execution

Prompt structure:

System: You are [role] specializing in [domain].
Context: [Relevant grounding documents]
Task: [Specific instruction]
Output: [Expected format and constraints]

For Gemini CLI, pipe context directly:

# Ground with project DNA
cat mygenie_dna.md | gemini "Based on this project context, [task]"

# Analyze code
cat site/app/api/leads/route.ts | gemini "Review this API route for security issues"

# Multi-file analysis
find site/app/api -name "*.ts" -exec cat {} + | gemini "Identify inconsistencies across these API routes"

Step 4: Execute and Validate

  1. Send the prompt to the selected model
  2. Enable thinking/reasoning traces for complex tasks
  3. Validate output against expected format
  4. Cross-reference factual claims against knowledge base
  5. Retry with refined prompt if output quality is insufficient

Step 5: Scheduled Automation via n8n

Set up Gemini to run on a schedule through n8n:

Schedule Task Model n8n Workflow
Daily 6AM Industry news digest Flash Cron → HTTP Request (Gemini API) → Slack
Monday 8AM Weekly content batch Flash Cron → Gemini → Save to Drive
Wednesday Blog outline from calendar Pro Cron → Read Calendar → Gemini → Draft
Friday 4PM Analytics review Pro Cron → GA4 API → Gemini Analysis → Slack

n8n HTTP node configuration for Gemini API:

{
  "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json"
  },
  "qs": {
    "key": "{{$credentials.geminiApiKey}}"
  },
  "body": {
    "contents": [
      {
        "parts": [
          {"text": "Your prompt here"}
        ]
      }
    ]
  }
}

Step 6: Context Window Management

For large codebase analysis:

  1. Estimate token count before sending (rough guide: 1 token per 4 chars)
  2. Use the full context window for repository-wide reasoning
  3. Chunk large inputs if they exceed model limits
  4. Prioritize most relevant files first in the context

Examples

Example 1: Codebase Architecture Review

User says: "Analyze our entire codebase structure with Gemini"

Actions:

  1. Select Gemini 2.0 Pro (needs deep reasoning + large context)
  2. Gather all source files into context
  3. Prompt for architecture analysis with specific focus areas
  4. Return structured findings with recommendations Result: Comprehensive architecture review with actionable insights

Example 2: Automated Marketing Pipeline

User says: "Set up Gemini to generate our weekly marketing content"

Actions:

  1. Configure Gemini CLI with marketing-specific system prompts
  2. Create n8n workflow with Monday 8AM cron trigger
  3. Workflow fetches this week's theme from content calendar
  4. Calls Gemini API with LinkedIn post generation prompt
  5. Saves drafts to Google Drive for human review
  6. Sends Slack notification with preview links Result: Weekly content generated automatically, queued for approval

Example 3: Rapid Data Extraction

User says: "Extract pricing data from these 50 competitor pages"

Actions:

  1. Select Gemini 2.0 Flash (high throughput task)
  2. Batch URLs for parallel processing
  3. Define extraction schema (product, price, features)
  4. Validate extracted data for completeness Result: Structured pricing dataset in JSON format

Troubleshooting

Model Returns Low-Quality Output

  • Add more context grounding from knowledge/tool-docs/
  • Be more specific in the task instruction
  • Enable thinking mode for complex reasoning tasks
  • Try upgrading from Flash to Pro for the task

Gemini CLI Not Responding

  • Verify API key: echo $GEMINI_API_KEY
  • Test API directly with curl (see google-workspace-setup troubleshooting)
  • Check GCP Console for quota/billing issues
  • Ensure the Generative Language API is enabled in your GCP project

Context Window Exceeded

  • Prioritize the most relevant files/sections
  • Summarize less critical context before including
  • Split into multiple prompts with carry-forward summaries

Rate Limiting

  • Implement exponential backoff on retries
  • Use Flash for bulk operations to stay within quotas
  • Queue requests through n8n for managed throughput
  • Check your quota tier in GCP Console > APIs > Quotas

n8n Scheduled Workflow Fails

  • Verify API key is stored in n8n Credentials (not hardcoded)
  • Check the HTTP node response body for error messages
  • Ensure the Gemini API URL and model name are correct
  • Monitor n8n execution history for timeout issues
Install via CLI
npx skills add https://github.com/Bobby44-max/-my-genie-commerce --skill google-ai-studio
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator