gemini-api-dev
Skill36 starsChanged 6 months agoMITView on GitHub
Direct Gemini API development with google-genai (Python) and @google/genai (TypeScript). Use when building multimodal applications, function calling, structured output, context caching, embeddings, or code execution with Gemini models — without the ADK framework overhead.
- Reads credentials
- Installs packages
5 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- google-gemini/gemini-skillstheir own version, first seen Sep 23, 2026
- PracticalSwan/agent-skillstheir own version, first seen Sep 14, 2026
- danielvogler/ai-skills-libraryedited, first seen Jun 3, 2026
- Fandry96/k3-agentic-skillsedited, first seen May 12, 2026
- JetBrains/skillsedited, first seen Apr 28, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 3
- JetBrains/skills★ 36011% same
- Fandry96/k3-agentic-skills★ 2715% same
- danielvogler/ai-skills-library★ 012% same
Wrote their own version · 2
- google-gemini/gemini-skills★ 4.2ksame name
- PracticalSwan/agent-skills★ 18same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository157 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- a2ui-angularSkill
- accessibility-auditSkill
- adk-deploy-guideSkill
- adk-dev-guideSkill
- adk-eval-guideSkill
- adk-observability-guideSkill
- agentic-ai-coding-standardSkill
- agentic-ai-devSkill
- ai-auditSkill
- ai-chatSkill
- ai-decision-recordSkill
- ai-incident-responseSkill
- ai-launch-checkSkill
- ai-playbookSkill
- angular-best-practicesSkill
- angularSkill
- angular-spaSkill
- angular-ui-patternsSkill
- api-design-principlesSkill
- app-store-optimizationSkill
- architect-reviewSkill
- architecture-decision-recordsSkill
- architecture-designSkill
- asc-cli-usageSkill
- asc-crash-triageSkill
- asc-id-resolverSkill
- asc-release-flowSkill
- asc-signing-setupSkill
- asc-submission-healthSkill
- asc-testflight-orchestrationSkill
- browser-testingSkill
- changelog-generatorSkill
- claude-actions-auditorSkill
- clean-codeSkill
- codebase-onboardingSkill
- code-explainerSkill
- code-reviewerSkill
- code-simplifierSkill
- comment-analyzerSkill
- database-schema-designerSkill
- ddd-architectSkill
- decision-frameworksSkill
- dedup-code-agentSkill
- deployment-ci-cdSkill
- design-systemSkill
- dockerSkill
- documentation-generationSkill
- domain-finderSkill
- error-detectiveSkill
- eval-guideSkill
- feature-forgeSkill
- firebase-basicsSkill
- firebase-hosting-basicsSkill
- fixing-accessibilitySkill
- fixing-motion-performanceSkill
- flutter-animationsSkill
- flutter-genuiSkill
- flutter-mobileSkill
- flutter-security-expertSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 125
Invalid API key (401): Check GOOGLE_API_KEY env var — never hardcode keys.
- Very specific: line 126
Model not found: Verify model ID against models.md.txt — model names change between releases.
- Distinctive: line 127
Payload too large: Check 2MB limit for inline data.
- Distinctive: line 148
After writing Gemini API integration code, dispatch:
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Iron Law
ALWAYS FETCH CURRENT API DOCS BEFORE WRITING CODE — fetch https://ai.google.dev/gemini-api/docs/llms.txt first, then the specific capability page. Never generate Gemini API calls from memory; the API evolves rapidly.
Gemini API Development — Direct API (google-genai / @google/genai)
When to Use This Skill vs google-adk
| Use Case | This Skill | google-adk skill |
| Direct model API calls | ✅ | ❌ |
| Multimodal (image/audio/video) | ✅ | Partial |
| Embeddings API | ✅ | ❌ |
| Context caching | ✅ | ❌ |
| Code execution sandbox | ✅ | ❌ |
| Building structured AI agents | ❌ | ✅ |
| Session management / memory | ❌ | ✅ |
| Multi-agent orchestration | ❌ | ✅ |
Current Models (as of 2026-03-15)
gemini-3.1-flash— 1M tokens, fast, balanced, multimodal. Default for most tasks.gemini-3.1-pro— 1M tokens, complex reasoning, coding, researchgemini-3.1-pro-image— Image generation and editing
Legacy models are deprecated:
gemini-2.5-*,gemini-2.0-*,gemini-1.5-*— do not use.
SDKs
- Python:
google-genai—uv add google-genai - TypeScript/NestJS:
@google/genai—npm install @google/genai
Legacy SDKs are deprecated:
google-generativeai(Python) and@google/generative-ai(JS) — do not use.
Quick Start
Python
from google import genai
client = genai.Client() # uses GOOGLE_API_KEY env var
response = client.models.generate_content(
model="gemini-3.1-flash",
contents="Explain quantum computing"
)
print(response.text)TypeScript (NestJS)
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({}); // uses GOOGLE_API_KEY env var
const response = await ai.models.generateContent({
model: "gemini-3.1-flash",
contents: "Explain quantum computing"
});
console.log(response.text);Key Capabilities
| Capability | When to Use | Doc Page |
| Text generation | Chat, completion, summarization | text-generation.md.txt |
| Multimodal | Process images, audio, video, documents | image-understanding.md.txt |
| Function calling | Let the model invoke your functions | function-calling.md.txt |
| Structured output | Generate valid JSON matching schema | structured-output.md.txt |
| Code execution | Run Python in sandboxed environment | fetch from llms.txt |
| Context caching | Cache large contexts for cost efficiency | fetch from llms.txt |
| Embeddings | Semantic search, similarity | embeddings.md.txt |
Documentation Sources
Always fetch before writing code — the Gemini API evolves rapidly; never rely on memory.
| Source | URL | Purpose |
| Doc index | https://ai.google.dev/gemini-api/docs/llms.txt | Discover all available doc pages |
| Models | https://ai.google.dev/gemini-api/docs/models.md.txt | Current model IDs and capabilities |
| Function calling | https://ai.google.dev/gemini-api/docs/function-calling.md.txt | Tool use patterns |
| Structured output | https://ai.google.dev/gemini-api/docs/structured-output.md.txt | JSON schema output |
| Embeddings | https://ai.google.dev/gemini-api/docs/embeddings.md.txt | Embedding API |
| Text generation | https://ai.google.dev/gemini-api/docs/text-generation.md.txt | Generation parameters |
| Image understanding | https://ai.google.dev/gemini-api/docs/image-understanding.md.txt | Multimodal inputs |
| SDK migration | https://ai.google.dev/gemini-api/docs/migrate.md.txt | Migrate from legacy SDKs |
| REST API spec | https://generativelanguage.googleapis.com/$discovery/rest?version=v1beta | Authoritative API schema |
Common Commands
# Python setup
uv add google-genai
# TypeScript setup
npm install @google/genai
# Set API key (get from Google AI Studio: aistudio.google.com)
export GOOGLE_API_KEY=your_key_here
# Verify SDK version
python -c "import google.genai; print(google.genai.__version__)"
node -e "const {GoogleGenAI}=require('@google/genai'); console.log('ok')"Error Handling
Fetch
https://ai.google.dev/gemini-api/docs/error-codes.md.txtfor current error code reference.
Rate limits (429): Implement exponential backoff — do not retry immediately.
Invalid API key (401): Check GOOGLE_API_KEY env var — never hardcode keys.
Model not found: Verify model ID against models.md.txt — model names change between releases.
Payload too large: Check 2MB limit for inline data; use File API for larger inputs.
# Python — retry with backoff on rate limit
import time
from google.api_core import retry
from google import genai
client = genai.Client()
@retry.Retry(predicate=retry.if_transient_error)
def generate_with_retry(prompt: str) -> str:
response = client.models.generate_content(
model="gemini-3.1-flash",
contents=prompt,
)
return response.textPost-Code Review
After writing Gemini API integration code, dispatch:
security-reviewer— API key handling, no keys in code, input sanitization before sending to modelcode-reviewer— general quality, error handling completeness
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

