gemini-api
Patterns for using Google Gemini API with structured output, JSON mode, and proper configuration. Apply when implementing AI features, text generation, or working with Gemini models.
npx skills add majiayu000/claude-skill-registry --skill gemini-api --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Gemini API Patterns ## SDK Setup Use the `@google/genai` package with Expo Constants for API key management: ```typescript import { GoogleGenAI } from '@google/genai'; import Constants from 'expo-constants'; const genAI = new GoogleGenAI({ apiKey: Constants.expoConfig?.extra?.geminiApiKey as string }); ``` ## Available Models | Model | ID | Best For | |-------|-----|----------| | Gemini 3 Pro | `gemini-3-pro-preview` | Advanced reasoning, complex tasks | | Gemini 3 Flash | `gemini-3-flash-preview` | Balanced speed/intelligence | | Gemini 2.5 Flash | `gemini-2.5-flash` | Price-performance, scale | | Gemini 2.5 Flash-Lite | `gemini-2.5-flash-lite` | High-throughput, cost-efficient | | Gemini 2.5 Pro | `gemini-2.5-pro` | Complex reasoning, code, math | All models support 1M input tokens and 65K output tokens. ## Basic Text Generation ```typescript const response = await genAI.models.generateContent({ model: 'gemini-3-flash-preview', contents: 'Your prompt here', }); const text = response.text ?? ''; ``` ## Structured Content Format For multi-turn or complex inputs, use the full contents structure: ```typescript const response = await genAI.models.generateContent({ model: 'gemini-3-f
- SDK Setup
- Available Models
- Basic Text Generation
- Structured Content Format
- System Instructions
- JSON Mode (Structured Output)
- With JSON Schema (Zod)
- Configuration Options
- Temperature Warning
- Error Handling Pattern
- Multi-Turn Chat
- Best Practices
- Common Mistakes to Avoid
What does the gemini-api skill do?
Patterns for using Google Gemini API with structured output, JSON mode, and proper configuration. Apply when implementing AI features, text generation, or working with Gemini models.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill gemini-api --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
