diff --git a/docs/skills/SKILLS-INDEX.md b/docs/skills/SKILLS-INDEX.md index 889f8a1..5c09934 100644 --- a/docs/skills/SKILLS-INDEX.md +++ b/docs/skills/SKILLS-INDEX.md @@ -283,6 +283,30 @@ --- +### gemini-tools (collection) +**Location:** `docs/skills/gemini-tools/` +**Source:** skill.fish (melodic-software, stared, dnvriend) +**Triggers:** Gemini, second opinion, consultant, image generation, web search, fact verification + +**Purpose:** Google Gemini integration tools + +**What It Covers:** +- **gemini-consultant.md** — Second opinion with web search + vision (includes consult.py) +- **gemini-second-opinion.md** — Independent technical analysis +- **gemini-image-generation.md** — AI image generation with nano-banana CLI + +**Prerequisites:** +- Requires `GEMINI_API_KEY` environment variable +- API key from https://aistudio.google.com/app/apikey + +**Read This When:** +- Need real-time web information +- Validating architecture decisions +- Cross-checking Claude's analysis +- Generating marketing images/thumbnails + +--- + ### minecraft-bukkit-pro **Location:** `docs/skills/minecraft-bukkit-pro/SKILL.md` **Source:** skill.fish (sickn33/antigravity-awesome-skills) @@ -393,6 +417,12 @@ docs/skills/ │ └── SKILL.md ├── gemini-consultation/ │ └── SKILL.md +├── gemini-tools/ +│ ├── README.md +│ ├── consult.py +│ ├── gemini-consultant.md +│ ├── gemini-image-generation.md +│ └── gemini-second-opinion.md ├── minecraft-bukkit-pro/ │ └── SKILL.md ├── minecraft-mod-dev/ diff --git a/docs/skills/gemini-tools/README.md b/docs/skills/gemini-tools/README.md new file mode 100644 index 0000000..3576bcf --- /dev/null +++ b/docs/skills/gemini-tools/README.md @@ -0,0 +1,123 @@ +# Gemini Tools Collection + +Skills for integrating Google Gemini into Firefrost workflows. + +**Requirement:** `GEMINI_API_KEY` environment variable must be set. +**API Key:** https://aistudio.google.com/app/apikey + +--- + +## Available Tools + +| Tool | File | Purpose | +|------|------|---------| +| Gemini Consultant | `gemini-consultant.md` | Second opinion with web search + vision | +| Gemini Second Opinion | `gemini-second-opinion.md` | Independent technical analysis | +| Gemini Image Generation | `gemini-image-generation.md` | AI image generation with nano-banana CLI | + +--- + +## Gemini Consultant + +**Best for:** Real-time web information, fact verification, image analysis + +```bash +# With web search (default) +uv run consult.py "What's the latest NeoForge version?" + +# With context +uv run consult.py "What could cause this error?" -c "TypeError: Cannot read property 'map' of undefined" + +# Analyze an image +uv run consult.py "What's in this image?" -i screenshot.png + +# Without web search +uv run consult.py "Explain the CAP theorem" --no-search +``` + +**Python script included:** `consult.py` + +--- + +## Gemini Second Opinion + +**Best for:** Architectural decisions, code reviews, plan validation + +```bash +gemini "REVIEW MODE: [your question]" --output-format json +``` + +**Use cases:** +- Validate a plan before executing +- Cross-check Claude's analysis +- Architecture decisions (GraphQL vs REST, microservices vs monolith) +- Security assessment validation + +--- + +## Gemini Image Generation (Nano Banana) + +**Best for:** Generating images, thumbnails, marketing assets + +```bash +# Generate image +gemini-nano-banana-tool generate "A cat wearing a wizard hat" -o cat.png + +# AI-optimize prompt first +gemini-nano-banana-tool promptgen "wizard cat" | gemini-nano-banana-tool generate -o cat.png -s + +# Different aspect ratios +gemini-nano-banana-tool generate "YouTube thumbnail" -o thumb.png -a 16:9 +gemini-nano-banana-tool generate "Instagram story" -o story.png -a 9:16 +``` + +**Cost estimates:** +- Flash: ~$0.039/image +- Pro 1K/2K: ~$0.134/image +- Pro 4K: ~$0.24/image + +--- + +## Firefrost Integration + +### Existing Workflow +Our `gemini-consultation` skill already provides structured consultation patterns. +These tools complement it with: + +1. **Real-time web search** — Verify latest versions, docs, news +2. **Independent analysis** — "Two AI perspectives catch more issues than one" +3. **Image generation** — Marketing assets, thumbnails, social media graphics + +### When to Use Each + +| Situation | Tool | +|-----------|------| +| Need current info (versions, docs) | Gemini Consultant | +| Validate architecture decisions | Gemini Second Opinion | +| Review Claude's security analysis | Gemini Second Opinion | +| Create marketing graphics | Gemini Image Generation | +| Generate thumbnails/banners | Gemini Image Generation | +| Structured consultation with handoff | `gemini-consultation` skill | + +--- + +## Setup + +1. Get API key: https://aistudio.google.com/app/apikey +2. Set environment variable: + ```bash + export GEMINI_API_KEY='your-api-key' + ``` +3. For nano-banana tool: + ```bash + git clone https://github.com/dnvriend/gemini-nano-banana-tool.git + cd gemini-nano-banana-tool + uv tool install . + ``` + +--- + +**Source:** skill.fish (melodic-software, stared, dnvriend) +**Added:** 2026-04-09 by Chronicler #73 + +**Fire + Frost + Foundation = Where Love Builds Legacy** 💙🔥❄️ diff --git a/docs/skills/gemini-tools/consult.py b/docs/skills/gemini-tools/consult.py new file mode 100644 index 0000000..10de21d --- /dev/null +++ b/docs/skills/gemini-tools/consult.py @@ -0,0 +1,145 @@ +# /// script +# dependencies = ["google-genai"] +# /// +""" +Gemini Consultant - Get a second opinion from Gemini 3 Pro with Google Search grounding and vision. + +Usage: + uv run consult.py "your question here" + uv run consult.py "your question" -c "additional context" + uv run consult.py "What's in this image?" -i image.png +""" + +import argparse +import mimetypes +import sys +from pathlib import Path + +from google import genai +from google.genai import types + + +def get_mime_type(file_path: str) -> str: + """Get MIME type for an image file.""" + mime_type, _ = mimetypes.guess_type(file_path) + if mime_type and mime_type.startswith("image/"): + return mime_type + # Default fallback based on extension + ext = Path(file_path).suffix.lower() + mime_map = { + ".png": "image/png", + ".jpg": "image/jpeg", + ".jpeg": "image/jpeg", + ".gif": "image/gif", + ".webp": "image/webp", + ".heic": "image/heic", + ".heif": "image/heif", + } + return mime_map.get(ext, "image/jpeg") + + +def main(): + parser = argparse.ArgumentParser( + description="Consult Gemini 3 Pro with Google Search grounding and vision" + ) + parser.add_argument("question", help="The question to ask Gemini") + parser.add_argument( + "-c", "--context", help="Additional context to include with the question" + ) + parser.add_argument( + "-i", + "--image", + action="append", + dest="images", + help="Image file(s) to analyze (can be used multiple times)", + ) + parser.add_argument( + "--media-resolution", + choices=["low", "medium", "high", "ultra_high"], + default="medium", + help="Image resolution for analysis: low (280 tokens), medium (560), high (1120), ultra_high (default: medium)", + ) + parser.add_argument( + "--no-search", + action="store_true", + help="Disable Google Search grounding (use pure model knowledge)", + ) + parser.add_argument( + "--thinking", + choices=["low", "high"], + default="high", + help="Thinking level: 'low' for faster responses, 'high' for deeper reasoning (default: high)", + ) + args = parser.parse_args() + + client = genai.Client() + + # Build the contents list + contents = [] + + # Add images if provided + if args.images: + for image_path in args.images: + path = Path(image_path) + if not path.exists(): + print(f"Error: Image file not found: {image_path}", file=sys.stderr) + sys.exit(1) + with open(path, "rb") as f: + image_bytes = f.read() + mime_type = get_mime_type(image_path) + contents.append( + types.Part.from_bytes(data=image_bytes, mime_type=mime_type) + ) + print(f"Including image: {image_path} ({mime_type})") + + # Build the text prompt + if args.context: + text_prompt = f"Context:\n{args.context}\n\nQuestion: {args.question}" + else: + text_prompt = args.question + + contents.append(text_prompt) + + # Configure options + config_kwargs = { + "thinking_config": types.ThinkingConfig(thinking_level=args.thinking) + } + if not args.no_search: + config_kwargs["tools"] = [{"google_search": {}}] + + print(f"Consulting Gemini 3 Pro (thinking: {args.thinking})...") + if not args.no_search: + print("(with Google Search grounding enabled)") + print("-" * 50) + + response = client.models.generate_content( + model="gemini-3-pro-preview", + contents=contents, + config=types.GenerateContentConfig(**config_kwargs), + ) + + # Extract and print the response + if response.candidates and response.candidates[0].content.parts: + for part in response.candidates[0].content.parts: + if hasattr(part, "text") and part.text: + print(part.text) + else: + print("No response received from the model.", file=sys.stderr) + sys.exit(1) + + # Print grounding metadata if available + if hasattr(response, "candidates") and response.candidates: + candidate = response.candidates[0] + if hasattr(candidate, "grounding_metadata") and candidate.grounding_metadata: + metadata = candidate.grounding_metadata + if hasattr(metadata, "search_entry_point") and metadata.search_entry_point: + print("\n" + "-" * 50) + print("Sources:") + if hasattr(metadata, "grounding_chunks") and metadata.grounding_chunks: + for chunk in metadata.grounding_chunks: + if hasattr(chunk, "web") and chunk.web: + print(f" - {chunk.web.title}: {chunk.web.uri}") + + +if __name__ == "__main__": + main() diff --git a/docs/skills/gemini-tools/gemini-consultant.md b/docs/skills/gemini-tools/gemini-consultant.md new file mode 100644 index 0000000..e290799 --- /dev/null +++ b/docs/skills/gemini-tools/gemini-consultant.md @@ -0,0 +1,86 @@ +--- +name: gemini-consultant +description: Get a second opinion from Gemini 3 Pro with Google Search grounding and vision. Use when you need real-time web information, want to verify facts, need a different perspective on a technical question, want to consult another AI model, or need to analyze images. +allowed-tools: Bash, Read +--- + +# Gemini Consultant + +Get a second opinion from Google's Gemini 3 Pro (`gemini-3-pro-preview`) with real-time Google Search grounding and vision capabilities. + +## Prerequisites + +The user must have `GEMINI_API_KEY` environment variable set with a valid Google AI API key. + +## Usage + +The script is located in the same directory as this SKILL.md file. Run it with `uv run`: + +```bash +uv run /path/to/skills/gemini-consultant/consult.py "your question here" +``` + +When this skill is invoked, locate `consult.py` in the skill directory and run it. + +### Parameters + +| Parameter | Required | Description | +|-----------|----------|-------------| +| `question` | Yes | The question to ask Gemini | +| `-c`, `--context` | No | Additional context to include (code snippets, background info) | +| `-i`, `--image` | No | Image file(s) to analyze (can be used multiple times) | +| `--media-resolution` | No | Image resolution: `low` (280 tokens), `medium` (560, default), `high` (1120), `ultra_high` | +| `--no-search` | No | Disable Google Search grounding (use pure model knowledge) | +| `--thinking` | No | Reasoning depth: `low` (faster) or `high` (deeper, default) | + +### Examples + +Simple question with web search: +```bash +uv run consult.py "What is the latest version of Python and its new features?" +``` + +Question with context: +```bash +uv run consult.py "What could cause this error?" -c "TypeError: Cannot read property 'map' of undefined" +``` + +Fast response without deep reasoning: +```bash +uv run consult.py "Quick summary of REST vs GraphQL" --thinking low +``` + +Without web search (pure model knowledge): +```bash +uv run consult.py "Explain the CAP theorem" --no-search +``` + +Analyze an image: +```bash +uv run consult.py "What's in this image?" -i screenshot.png +``` + +Analyze multiple images: +```bash +uv run consult.py "Compare these two diagrams" -i diagram1.png -i diagram2.png +``` + +High-resolution image analysis (for fine text or small details): +```bash +uv run consult.py "Read the text in this image" -i document.png --media-resolution high +``` + +## When to Use + +- **Real-time information**: Current events, latest releases, recent updates +- **Fact verification**: Double-check information with web sources +- **Second opinion**: Get an alternative perspective on technical decisions +- **Web research**: Find current documentation, tutorials, or solutions +- **Image analysis**: Analyze screenshots, diagrams, photos, or any visual content +- **Compare images**: Analyze multiple images together + +## Output + +The script prints: +- The model's response +- Sources/citations from Google Search (when grounding is enabled) diff --git a/docs/skills/gemini-tools/gemini-image-generation.md b/docs/skills/gemini-tools/gemini-image-generation.md new file mode 100644 index 0000000..e8121f8 --- /dev/null +++ b/docs/skills/gemini-tools/gemini-image-generation.md @@ -0,0 +1,436 @@ +# Gemini Nano Banana Tool Skill + +Professional CLI for Google Gemini image generation with AI-powered prompt optimization, cost tracking, and multi-turn conversations. + +## Quick Reference + +```bash +# AI prompt optimization +gemini-nano-banana-tool promptgen "simple description" + +# Generate image (both commands work) +gemini-nano-banana-tool generate "detailed prompt" -o output.png +gemini-nano-banana-tool generate-image "detailed prompt" -o output.png + +# Multi-turn refinement +gemini-nano-banana-tool generate-conversation "prompt" -o output.png -f conv.json + +# Discovery +gemini-nano-banana-tool list-models +gemini-nano-banana-tool list-aspect-ratios +``` + +## Core Capabilities + +### 1. AI Prompt Generation + +Transform simple descriptions into detailed, optimized prompts: + +```bash +# Basic usage +gemini-nano-banana-tool promptgen "wizard cat" + +# With template for specialized prompts +gemini-nano-banana-tool promptgen "wizard cat" --template character + +# Pipeline: optimize then generate +gemini-nano-banana-tool promptgen "cyberpunk city" --template scene | \ + gemini-nano-banana-tool generate -o city.png --stdin -a 16:9 +``` + +**Available Templates**: +- `photography` - Technical camera details, lighting +- `character` - Pose, attire, expression +- `scene` - Foreground/midground/background +- `food` - Plating, garnish, lighting +- `abstract` - Shapes, colors, patterns +- `logo` - Typography, symbolism + +### 2. Text-to-Image Generation + +Generate images from prompts with flexible input (use `generate` or `generate-image` interchangeably): + +```bash +# From positional argument (both commands work) +gemini-nano-banana-tool generate "A cat wearing a wizard hat" -o cat.png +gemini-nano-banana-tool generate-image "A cat wearing a wizard hat" -o cat.png + +# From file +gemini-nano-banana-tool generate -f prompt.txt -o output.png + +# From stdin (piping) +echo "Beautiful sunset" | gemini-nano-banana-tool generate -o sunset.png -s +``` + +### 3. Image Editing with References + +Edit existing images using natural language: + +```bash +# Single reference +gemini-nano-banana-tool generate "Add a birthday hat" -o edited.png -i photo.jpg + +# Multiple references (up to 3 for Flash, 14 for Pro) +gemini-nano-banana-tool generate "Combine these elements" -o result.png \ + -i ref1.jpg -i ref2.jpg -i ref3.jpg +``` + +### 4. Multi-Turn Conversations + +Progressive image refinement across multiple turns: + +```bash +# Turn 1: Initial image +gemini-nano-banana-tool generate-conversation \ + "Modern living room with large windows" \ + -o room-v1.png -f interior.json -a 16:9 + +# Turn 2: Add furniture (previous image auto-referenced) +gemini-nano-banana-tool generate-conversation \ + "Add gray sofa and wooden coffee table" \ + -o room-v2.png -f interior.json + +# Turn 3: Adjust lighting +gemini-nano-banana-tool generate-conversation \ + "Make lighting warmer, add floor lamp" \ + -o room-v3.png -f interior.json +``` + +### 5. Aspect Ratios + +10 supported aspect ratios for different platforms: + +```bash +# Square (Instagram post) +gemini-nano-banana-tool generate "Design" -o square.png -a 1:1 + +# Widescreen (YouTube thumbnail) +gemini-nano-banana-tool generate "Scene" -o wide.png -a 16:9 + +# Vertical (Instagram story) +gemini-nano-banana-tool generate "Portrait" -o vertical.png -a 9:16 + +# Cinematic (ultra-wide) +gemini-nano-banana-tool generate "Panorama" -o cinema.png -a 21:9 +``` + +**All Ratios**: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 4:5, 5:4 + +### 6. Model Selection + +Choose between Flash (fast, cost-effective) and Pro (high quality): + +```bash +# Flash model (default) - Fast, cost-effective +gemini-nano-banana-tool generate "Prompt" -o output.png + +# Pro model - Higher quality +gemini-nano-banana-tool generate "Prompt" -o output.png \ + -m gemini-3-pro-image-preview + +# Pro with 4K resolution - Maximum quality +gemini-nano-banana-tool generate "Prompt" -o output.png \ + -m gemini-3-pro-image-preview -r 4K +``` + +### 7. Cost Tracking + +Automatic cost calculation based on actual token usage: + +```json +{ + "output_path": "output.png", + "model": "gemini-2.5-flash-image", + "token_count": 1295, + "estimated_cost_usd": 0.0389, + "resolution": "1344x768" +} +``` + +**Typical Costs**: +- Flash: ~$0.039 per image +- Pro 1K/2K: ~$0.134 per image +- Pro 4K: ~$0.24 per image + +### 8. Verbosity Levels + +Multi-level logging for debugging: + +```bash +# Normal (warnings only) +gemini-nano-banana-tool generate "test" -o output.png + +# Info (-v) - High-level operations +gemini-nano-banana-tool generate "test" -o output.png -v + +# Debug (-vv) - Detailed validation +gemini-nano-banana-tool generate "test" -o output.png -vv + +# Trace (-vvv) - Full HTTP logs +gemini-nano-banana-tool generate "test" -o output.png -vvv +``` + +## Authentication + +### Gemini Developer API (Recommended) + +```bash +export GEMINI_API_KEY='your-api-key' +``` + +Get API key: https://aistudio.google.com/app/apikey + +### Vertex AI (Enterprise) + +```bash +export GOOGLE_GENAI_USE_VERTEXAI=true +export GOOGLE_CLOUD_PROJECT='your-project-id' +export GOOGLE_CLOUD_LOCATION='us-central1' + +# Authenticate +gcloud auth application-default login +``` + +## Common Workflows + +### Workflow 1: Quick Generation + +```bash +# Optimize prompt and generate in one pipeline +gemini-nano-banana-tool promptgen "wizard in magical library" | \ + gemini-nano-banana-tool generate -o wizard.png -s -a 16:9 +``` + +### Workflow 2: Batch Processing + +```bash +# Generate multiple variations +for style in "photorealistic" "artistic" "minimalist"; do + gemini-nano-banana-tool generate \ + "A cat in $style style" \ + -o "cat-$style.png" \ + -a 1:1 +done +``` + +### Workflow 3: Progressive Refinement + +```bash +# Generate base image +gemini-nano-banana-tool generate "Product photo of headphones" \ + -o product-v1.png -a 1:1 + +# Refine with conversation mode +gemini-nano-banana-tool generate-conversation \ + "Rotate to show left side" \ + -o product-v2.png -f product.json + +gemini-nano-banana-tool generate-conversation \ + "Change background to dark gradient" \ + -o product-v3.png -f product.json +``` + +### Workflow 4: Template-Based Generation + +```bash +# Generate food photography +gemini-nano-banana-tool promptgen "pasta carbonara" --template food \ + -o pasta-prompt.txt + +# Use saved prompt +gemini-nano-banana-tool generate -f pasta-prompt.txt \ + -o pasta.png -a 4:3 + +# Generate character design +gemini-nano-banana-tool promptgen "space explorer" --template character | \ + gemini-nano-banana-tool generate -o explorer.png -s -a 2:3 +``` + +## Use Cases + +### Content Creation + +- Social media posts and stories +- Marketing materials and ads +- Blog post illustrations +- YouTube thumbnails + +### E-commerce + +- Product photography variations +- Lifestyle product shots +- Fashion combinations +- Product on model composites + +### Design & Prototyping + +- Concept art exploration +- UI/UX mockups +- Logo design iterations +- Brand visual exploration + +### Professional Assets + +- High-quality 4K renders +- Professional photography +- Print-ready materials +- Commercial content + +## Output Format + +All commands return structured JSON: + +```json +{ + "output_path": "output.png", + "model": "gemini-2.5-flash-image", + "aspect_ratio": "16:9", + "resolution": "1344x768", + "resolution_quality": "1K", + "reference_image_count": 0, + "token_count": 1295, + "estimated_cost_usd": 0.0389, + "metadata": { + "finish_reason": "STOP", + "safety_ratings": null + } +} +``` + +## Error Handling + +The tool provides actionable error messages: + +```bash +# Missing API key +Error: API key required. Set GEMINI_API_KEY or use --api-key option. +Get API key from https://aistudio.google.com/app/apikey + +# Too many reference images +Error: Maximum 3 reference images allowed (Flash model). +Use Pro model for up to 14 reference images. + +# Invalid aspect ratio +Error: Invalid aspect ratio '16:10'. +Use 'gemini-nano-banana-tool list-aspect-ratios' to see supported ratios. +``` + +## Shell Completion + +Enable tab completion for faster usage: + +```bash +# Bash +eval "$(gemini-nano-banana-tool completion bash)" + +# Zsh +eval "$(gemini-nano-banana-tool completion zsh)" + +# Fish +gemini-nano-banana-tool completion fish > \ + ~/.config/fish/completions/gemini-nano-banana-tool.fish +``` + +## Cost Optimization + +### Choose the Right Model + +**Use Flash for**: +- Prototyping and testing +- High-volume generation +- Cost-sensitive projects +- Quick iterations + +**Use Pro for**: +- Final production images +- Complex scenes with detail +- Professional/commercial work +- Higher resolution needs + +### Optimize Prompts + +```bash +# Use promptgen to reduce trial-and-error +gemini-nano-banana-tool promptgen "your idea" --template photography \ + -o prompt.txt + +# Reuse successful prompts +gemini-nano-banana-tool generate -f prompt.txt -o v1.png -a 1:1 +gemini-nano-banana-tool generate -f prompt.txt -o v2.png -a 16:9 +``` + +### Use Conversation Mode + +```bash +# Refine instead of regenerating from scratch +gemini-nano-banana-tool generate-conversation \ + "Initial prompt" -o v1.png -f conv.json + +gemini-nano-banana-tool generate-conversation \ + "Small adjustment" -o v2.png -f conv.json +``` + +## Library Usage + +Import and use programmatically: + +```python +from gemini_nano_banana_tool import create_client, generate_image, generate_prompt + +# Create client (reuse for multiple operations) +client = create_client() + +# Generate optimized prompt +prompt_result = generate_prompt( + client=client, + description="wizard cat", + template="character" +) + +# Generate image +image_result = generate_image( + client=client, + prompt=prompt_result['prompt'], + output_path="wizard-cat.png", + aspect_ratio="16:9" +) + +print(f"Cost: ${image_result['estimated_cost_usd']:.4f}") +``` + +## Resources + +- **Documentation**: README.md and CLAUDE.md in project root +- **API Setup**: references/api-setup-pricing.md +- **Prompting Guide**: references/prompting-guide.md (if available) +- **Examples**: references/examples.md (if available) +- **Official Gemini Docs**: https://ai.google.dev/gemini-api/docs/image-generation +- **API Key**: https://aistudio.google.com/app/apikey + +## Installation + +```bash +# Clone repository +git clone https://github.com/dnvriend/gemini-nano-banana-tool.git +cd gemini-nano-banana-tool + +# Install with uv +uv tool install . + +# Verify +gemini-nano-banana-tool --version +gemini-nano-banana-tool --help +``` + +## Support + +For issues or questions: +- GitHub Issues: https://github.com/dnvriend/gemini-nano-banana-tool/issues +- Documentation: Check README.md and CLAUDE.md +- API Documentation: https://ai.google.dev/gemini-api/docs + +--- + +**Generated with Claude Code** + +This skill provides comprehensive access to Google Gemini's image generation capabilities through a professional, agent-friendly CLI with automatic cost tracking, AI prompt optimization, and multi-turn conversation support. diff --git a/docs/skills/gemini-tools/gemini-second-opinion.md b/docs/skills/gemini-tools/gemini-second-opinion.md new file mode 100644 index 0000000..6cdc290 --- /dev/null +++ b/docs/skills/gemini-tools/gemini-second-opinion.md @@ -0,0 +1,135 @@ +--- +name: gemini-second-opinion +description: Get Gemini's independent analysis on recent context or specified topic +argument-hint: [topic or context to review] +allowed-tools: Bash +--- + +# Gemini Second Opinion Command + +Get Gemini's independent perspective on a topic, plan, or piece of work. + +## Usage + +```text +/google-ecosystem:gemini-second-opinion [topic] +``` + +## Arguments + +- `$ARGUMENTS` (optional): Topic or context to review. If empty, reviews general context. + +## Examples + +- `/google-ecosystem:gemini-second-opinion Is this database schema normalized correctly?` +- `/google-ecosystem:gemini-second-opinion Review my approach to error handling in this module` +- `/google-ecosystem:gemini-second-opinion Should I use microservices or monolith for this project?` +- `/google-ecosystem:gemini-second-opinion Validate my security assessment` + +## Execution + +### Build Review Prompt + +```bash +topic="${ARGUMENTS:-the current context}" + +prompt="REVIEW MODE (read-only): Provide an independent analysis. + +TOPIC: $topic + +Please provide: + +1. **Your Assessment**: What is your independent view on this? + +2. **Potential Issues**: What concerns or risks do you see? + +3. **Alternative Approaches**: What other options should be considered? + +4. **Recommendations**: What would you suggest? + +5. **Confidence Level**: How confident are you in this assessment? (High/Medium/Low) + +Be direct and specific. If you disagree with an apparent approach, say so clearly. + +DO NOT modify any files. This is analysis only." +``` + +### Execute Query + +```bash +result=$(gemini "$prompt" --output-format json) +``` + +### Parse Response + +```bash +response=$(echo "$result" | jq -r '.response // "No response received"') +tokens=$(echo "$result" | jq '.stats.models | to_entries | map(.value.tokens.total) | add // 0') +model=$(echo "$result" | jq -r '.stats.models | keys[0] // "unknown"') + +# Check for errors +error=$(echo "$result" | jq -r '.error.message // empty') +if [ -n "$error" ]; then + echo "Error: $error" + exit 1 +fi +``` + +## Output Format + +Present Gemini's perspective: + +```markdown +# Gemini Second Opinion + +**Topic**: {topic} +**Model**: {model} + +--- + +{response} + +--- +*Independent analysis by Gemini CLI | {tokens} tokens* +``` + +## Use Cases + +### Validate a Plan + +Before executing a significant change, get Gemini's take: + +```text +/google-ecosystem:gemini-second-opinion I'm planning to refactor auth to use JWT instead of sessions. Good idea? +``` + +### Cross-Check Analysis + +After Claude provides analysis, validate: + +```text +/google-ecosystem:gemini-second-opinion Claude identified 3 security issues in auth.ts. Are there others? +``` + +### Architecture Decision + +Get input on technical choices: + +```text +/google-ecosystem:gemini-second-opinion Should this use GraphQL or REST? +``` + +### Code Review Supplement + +Add another perspective to code reviews: + +```text +/google-ecosystem:gemini-second-opinion Is this error handling approach robust? +``` + +## Notes + +- Uses "REVIEW MODE" prefix to ensure read-only analysis +- Provides structured output with assessment, issues, alternatives +- Includes confidence level for transparency +- Two AI perspectives catch more issues than one