Skip to content
Back to skills

2598 Deprecated Patterns 22cc34bd

ASecurity

Common mistakes Claude makes when generating Gemini API code. Check this BEFORE writing any Gemini code. Source: curated from `~/Documents/google-gemini-context/CLAUDE.md` ---

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 11, 2026
developmentjavascriptpythongojavabashapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2598-deprecated-patterns_22cc34bd --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2598 Deprecated Patterns 22cc34bd?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2598 Deprecated Patterns 22cc34bd
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2598-deprecated-patterns-22cc34bd/badge)](https://www.skillsdirectory.com/skills/tools-only-2598-deprecated-patterns-22cc34bd)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# Deprecated Patterns

Common mistakes Claude makes when generating Gemini API code. Check this BEFORE writing any Gemini code.

Source: curated from `~/Documents/google-gemini-context/CLAUDE.md`

---

## Package Names

| Language | Wrong (old) | Correct (current) |
|----------|-------------|-------------------|
| JavaScript | `@google/generative-ai` | `@google/genai` |
| Python | `google-generativeai` or `google.generativeai` | `google-genai` |

## Imports

### JavaScript
```javascript
// WRONG
import { GoogleGenerativeAI } from "@google/generative-ai";

// CORRECT
import { GoogleGenAI } from "@google/genai";
```

### Python
```python
# WRONG
import google.generativeai as genai
genai.configure(api_key=os.environ["GEMINI_API_KEY"])

# CORRECT
from google import genai
client = genai.Client()  # auto-reads GEMINI_API_KEY
```

## Initialisation

### JavaScript
```javascript
// WRONG - old pattern
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
const model = genAI.getGenerativeModel({ model: "gemini-pro" });
const result = await model.generateContent("prompt");

// CORRECT - new pattern
const ai = new GoogleGenAI({});  // auto-reads GEMINI_API_KEY
const response = await ai.models.generateContent({
  model: "gemini-2.5-flash",
  contents: "prompt"
});
```

### Python
```python
# WRONG - old pattern
genai.configure(api_key=os.environ["GEMINI_API_KEY"])
model = genai.GenerativeModel("gemini-pro")
response = model.generate_content("prompt")

# CORRECT - new pattern
client = genai.Client()  # auto-reads GEMINI_API_KEY
response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="prompt"
)
```

## Model IDs

| Wrong (deprecated) | Correct (current) |
|--------------------|-------------------|
| `gemini-pro` | `gemini-2.5-flash` |
| `gemini-pro-vision` | `gemini-2.5-flash` (unified multimodal) |
| `gemini-2.0-flash-exp` | `gemini-2.0-flash` |
| `gemini-1.5-pro-002` | `gemini-2.5-pro` |

Default recommendation: `gemini-2.5-flash` for most tasks, `gemini-2.5-pro` for complex reasoning.

## Chat API

### JavaScript
```javascript
// WRONG - old pattern
const chat = model.startChat();
const result = await chat.sendMessage("Hello");

// CORRECT - new pattern
const chat = await ai.chats.create({ model: "gemini-2.5-flash" });
const result = await chat.send("Hello");
```

### Python
```python
# WRONG - old streaming parameter
response = model.generate_content("prompt", stream=True)

# CORRECT - config-based streaming
response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="prompt",
    config={"stream": True}
)
```

## Safety Categories

Claude consistently forgets the 5th category and uses the wrong name for the 4th:

```python
# WRONG - 4 categories, wrong name
categories = [
    "HARM_CATEGORY_HARASSMENT",
    "HARM_CATEGORY_HATE_SPEECH",
    "HARM_CATEGORY_SEXUALLY_EXPLICIT",
    "HARM_CATEGORY_DANGEROUS_CONTENT"       # wrong: no _CONTENT
]

# CORRECT - 5 categories
categories = [
    "HARM_CATEGORY_HARASSMENT",
    "HARM_CATEGORY_HATE_SPEECH",
    "HARM_CATEGORY_SEXUALLY_EXPLICIT",
    "HARM_CATEGORY_DANGEROUS",               # no _CONTENT suffix
    "HARM_CATEGORY_CIVIC_INTEGRITY"          # don't forget this one
]
```

## REST API Headers

```bash
# WRONG - Claude often capitalises this
-H "X-Goog-Api-Key: $GEMINI_API_KEY"

# CORRECT - lowercase
-H "x-goog-api-key: $GEMINI_API_KEY"
```

## Parameter Names

| Wrong (old) | Correct (current) |
|-------------|-------------------|
| `generationConfig` | `config` |
| `safetySettings` (as constructor param) | `config.safety_settings` |
| `stream=True` (as method param) | `config={"stream": True}` |

## Rate Limits

- There are NO daily limits -- only per-minute (RPM, TPM)
- Claude sometimes invents "1,500 requests per day" -- this is wrong
- Free tier: per-model RPM/TPM limits only

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.