xiaohongshu
xiaohongshu
invoking-gemini
Invokes Google Gemini models for structured outputs, multi-modal tasks, and Google-specific features. Use when users request Gemini, structured JSON output, Google API integration, or cost-effective parallel processing.
Full skill instructions
Delegate tasks to Google's Gemini models when they offer advantages over Claude.
Structured outputs:
Cost optimization:
Google ecosystem:
Multi-modal tasks:
gemini-2.0-flash-exp (Recommended):
gemini-1.5-pro:
gemini-1.5-flash:
See references/models.md for full model details.
Prerequisites:
Install google-generativeai:
uv pip install google-generativeai pydantic
Configure API key via project knowledge file:
Option 1 (recommended): Individual file
GOOGLE_API_KEY.txtAIzaSy...)Option 2: Combined file
API_CREDENTIALS.json{
"google_api_key": "AIzaSy..."
}
Get your API key: https://console.cloud.google.com/apis/credentials
Import the client:
import sys
sys.path.append('/mnt/skills/invoking-gemini/scripts')
from gemini_client import invoke_gemini
# Simple prompt
response = invoke_gemini(
prompt="Explain quantum computing in 3 bullet points",
model="gemini-2.0-flash-exp"
)
print(response)
Use Pydantic models for guaranteed JSON Schema compliance:
from pydantic import BaseModel, Field
from gemini_client import invoke_with_structured_output
class BookAnalysis(BaseModel):
title: str
genre: str = Field(description="Primary genre")
key_themes: list[str] = Field(max_length=5)
rating: int = Field(ge=1, le=5)
result = invoke_with_structured_output(
prompt="Analyze the book '1984' by George Orwell",
pydantic_model=BookAnalysis
)
# result is a BookAnalysis instance
print(result.title) # "1984"
print(result.genre) # "Dystopian Fiction"
Advantages over Claude:
Process multiple prompts concurrently:
from gemini_client import invoke_parallel
prompts = [
"Summarize the plot of Hamlet",
"Summarize the plot of Macbeth",
"Summarize the plot of Othello"
]
results = invoke_parallel(
prompts=prompts,
model="gemini-2.0-flash-exp"
)
for prompt, result in zip(prompts, results):
print(f"Q: {prompt[:30]}...")
print(f"A: {result[:100]}...\n")
Use cases:
The client handles common errors:
from gemini_client import invoke_gemini
response = invoke_gemini(
prompt="Your prompt here",
model="gemini-2.0-flash-exp"
)
if response is None:
print("Error: API call failed")
# Check project knowledge file for valid google_api_key
Common issues:
response = invoke_gemini(
prompt="Write a haiku",
model="gemini-2.0-flash-exp",
temperature=0.9,
max_output_tokens=100,
top_p=0.95
)
# Image analysis with structured output
from pydantic import BaseModel
class ImageDescription(BaseModel):
objects: list[str]
scene: str
colors: list[str]
result = invoke_with_structured_output(
prompt="Describe this image",
pydantic_model=ImageDescription,
image_path="/mnt/user-data/uploads/photo.jpg"
)
See references/advanced.md for more patterns.
Use Gemini when:
Use Claude when:
Use both:
Gemini Flash is cost-effective for sub-tasks:
# Claude (you) plans the approach
# Gemini executes structured extractions
data_points = []
for file in uploaded_files:
# Gemini extracts structured data
result = invoke_with_structured_output(
prompt=f"Extract contact info from {file}",
pydantic_model=ContactInfo
)
data_points.append(result)
# Claude synthesizes results
# ... your analysis here ...
Not suitable for:
Token limits:
Rate limits:
See references/examples.md for:
"API key not configured":
GOOGLE_API_KEY.txt with your API keyAPI_CREDENTIALS.json: {"google_api_key": "AIzaSy..."}Import errors:
uv pip install google-generativeai pydantic
Schema validation failures:
Approximate pricing (as of 2024):
Gemini 2.0 Flash:
Claude Sonnet:
For 1000 simple extraction tasks (100 tokens each):
Strategy: Use Claude for complex reasoning, Gemini for high-volume simple tasks.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience