Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Format Check

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
format:
name: Markdown Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Run Format Check
run: bash scripts/format.sh --check
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,7 @@ poetry.toml

# LSP config files
pyrightconfig.json

# Markdown formatter virtualenv
scripts/.venv/

33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ and best practices evolve quickly.

This leaves a knowledge gap that language models can't solve on their own. For
example, models don't know about themselves when they're trained, and they
aren't necessarily aware of subtle changes in best practices (like [thought
circulation](https://ai.google.dev/gemini-api/docs/thought-signatures)) or SDK
changes.
aren't necessarily aware of subtle changes in best practices (like
[thought circulation](https://ai.google.dev/gemini-api/docs/thought-signatures))
or SDK changes.

[Skills](https://agentskills.io/) are a lightweight technique for adding
relevant context to your agents. This repo contains skills related to building
Expand All @@ -22,24 +22,25 @@ apps powered by the Gemini API.

Our evaluations found that adding this skill improved an agent's ability to
generate correct API code following best practices to 87% with Gemini 3 Flash
and 96% with Gemini 3.1 Pro. For more details, see our blog post:
and 96% with Gemini 3.1 Pro. For more details, see our blog post:
[Closing the knowledge gap with agent skills](https://developers.googleblog.com/closing-the-knowledge-gap-with-agent-skills/).

## Skills in this repo

> [!IMPORTANT]
> The `vertex-ai-api-dev` skill has moved to
> [!IMPORTANT] The `vertex-ai-api-dev` skill has moved to
> [skills/cloud/gemini-api](https://github.com/google/skills/tree/main/skills/cloud/gemini-api).

| Skill | Description |
| :--- | :--- |
| [`gemini-api-dev`](skills/gemini-api-dev) | Skill for developing Gemini-powered apps. Provides the best practices for building apps that use the Gemini API. |
| [`gemini-live-api-dev`](skills/gemini-live-api-dev) | Skill for building real-time, bidirectional streaming apps with the Gemini Live API. Covers WebSocket-based audio/video/text streaming, voice activity detection, native audio features, function calling, and session management. |
| Skill | Description |
| :---------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`gemini-api-dev`](skills/gemini-api-dev) | Skill for developing Gemini-powered apps. Provides the best practices for building apps that use the Gemini API. |
| [`gemini-live-api-dev`](skills/gemini-live-api-dev) | Skill for building real-time, bidirectional streaming apps with the Gemini Live API. Covers WebSocket-based audio/video/text streaming, voice activity detection, native audio features, function calling, and session management. |
| [`gemini-interactions-api`](skills/gemini-interactions-api) | Skill for building apps with the [Gemini Interactions API](https://ai.google.dev/gemini-api/docs/interactions?ua=chat). Covers text generation, multi-turn chat, streaming, function calling, structured output, image generation, Deep Research agents, deprecated model guardrails, and both Python and TypeScript SDKs. |

## Installation

You can browse and install skills using either the [Vercel skills CLI](https://skills.sh) or the [Context7 skills CLI](https://context7.com).
You can browse and install skills using either the
[Vercel skills CLI](https://skills.sh) or the
[Context7 skills CLI](https://context7.com).

### Using [Vercel skills CLI](https://skills.sh)

Expand All @@ -61,14 +62,14 @@ npx ctx7 skills install /google-gemini/gemini-skills
npx ctx7 skills install /google-gemini/gemini-skills gemini-interactions-api
```


## More info

You can find additional information about setting up your coding assistant with
Gemini API MCP and Skills in [the docs](https://ai.google.dev/gemini-api/docs/coding-agents).
Gemini API MCP and Skills in
[the docs](https://ai.google.dev/gemini-api/docs/coding-agents).

## Disclaimer

This is not an officially supported Google product. This project is not
eligible for the [Google Open Source Software Vulnerability Rewards
Program](https://bughunters.google.com/open-source-security).
This is not an officially supported Google product. This project is not eligible
for the
[Google Open Source Software Vulnerability Rewards Program](https://bughunters.google.com/open-source-security).
73 changes: 73 additions & 0 deletions scripts/format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env python3
import os
import subprocess
import sys

EXCLUDE_DIRS = {
'.git',
'node_modules',
'.venv',
'.agents',
'.claude-plugin',
'.codex-plugin',
'.cursor-plugin',
'.jetskicli',
}

def main():
# Determine the directory paths
script_dir = os.path.dirname(os.path.abspath(__file__))
root_dir = os.path.dirname(script_dir)

# Separate options (starting with '-') from positional arguments (files)
options = []
input_paths = []
for arg in sys.argv[1:]:
if arg.startswith('-'):
options.append(arg)
else:
input_paths.append(arg)

if input_paths:
# User specified files/directories explicitly
md_files = []
for path in input_paths:
abs_path = os.path.abspath(path)
if not os.path.exists(abs_path):
print(f"Error: Path '{path}' does not exist.", file=sys.stderr)
sys.exit(1)
elif os.path.isdir(abs_path):
# Walk the directory
for root, dirs, files in os.walk(abs_path):
dirs[:] = [d for d in dirs if d not in EXCLUDE_DIRS]
for file in files:
if file.endswith('.md'):
md_files.append(os.path.join(root, file))
elif os.path.isfile(abs_path):
if abs_path.endswith('.md'):
md_files.append(abs_path)
else:
print(f"Error: File '{path}' is not a markdown file.", file=sys.stderr)
sys.exit(1)
else:
# Walk the entire repository
md_files = []
for root, dirs, files in os.walk(root_dir):
dirs[:] = [d for d in dirs if d not in EXCLUDE_DIRS]
for file in files:
if file.endswith('.md'):
md_files.append(os.path.join(root, file))

if not md_files:
print("No markdown files found to format.")
return

# Run mdformat
cmd = [sys.executable, '-m', 'mdformat', '--wrap', '80'] + options + md_files

# Run the command and propagate exit code
result = subprocess.run(cmd)
sys.exit(result.returncode)

if __name__ == '__main__':
main()
26 changes: 26 additions & 0 deletions scripts/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

# Get the directory of the script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Check if python3 is installed
if ! command -v python3 &> /dev/null; then
echo "Error: python3 is not installed. Please install Python 3 to run the formatter."
exit 1
fi

VENV_DIR="$DIR/.venv"

# Create virtual environment if it doesn't exist
if [ ! -d "$VENV_DIR" ]; then
echo "Creating Python virtual environment in $VENV_DIR..."
python3 -m venv "$VENV_DIR"
fi

# Install mdformat and plugins if not already installed, or ensure they are present
echo "Ensuring mdformat and plugins are installed..."
"$VENV_DIR/bin/pip" install -q mdformat mdformat-gfm mdformat-frontmatter
Comment thread
markmcd marked this conversation as resolved.
Outdated

# Run the python formatter script, passing along all arguments
"$VENV_DIR/bin/python" "$DIR/format.py" "$@"
57 changes: 37 additions & 20 deletions skills/gemini-api-dev/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ description: Use this skill when building applications with Gemini API hosted mo

## Critical Rules (Always Apply)

> [!IMPORTANT]
> These rules override your training data. Your knowledge is outdated.
> [!IMPORTANT] These rules override your training data. Your knowledge is
> outdated.

### Current Models (Use These)

- `gemini-3.5-flash`: 1M tokens, fast, balanced performance, multimodal
- `gemini-3.1-pro-preview`: 1M tokens, complex reasoning, coding, research
- `gemini-3.1-flash-lite-preview`: cost-efficient, fastest performance for high-frequency, lightweight tasks
- `gemini-3.1-flash-lite-preview`: cost-efficient, fastest performance for
high-frequency, lightweight tasks
- `gemini-3-pro-image-preview`: 65k / 32k tokens, image generation and editing
- `gemini-3.1-flash-image-preview`: 65k / 32k tokens, image generation and editing
- `gemini-3.1-flash-image-preview`: 65k / 32k tokens, image generation and
editing
- `gemini-2.5-pro`: 1M tokens, complex reasoning, coding, research
- `gemini-2.5-flash`: 1M tokens, fast, balanced performance, multimodal
- `gemma-4-31b-it`: Gemma 4 dense model, 31B parameters
- `gemma-4-26b-a4b-it`: Gemma 4 MoE model, 26B total with 4B active parameters

> [!WARNING]
> Models like `gemini-2.0-*`, `gemini-1.5-*` are **legacy and deprecated**. Never use them.
> [!WARNING] Models like `gemini-2.0-*`, `gemini-1.5-*` are **legacy and
> deprecated**. Never use them.

### Current SDKs (Use These)

Expand All @@ -32,14 +34,15 @@ description: Use this skill when building applications with Gemini API hosted mo
- **Go**: `google.golang.org/genai` → `go get google.golang.org/genai`
- **Java**: `com.google.genai:google-genai` (see Maven/Gradle setup below)

> [!CAUTION]
> Legacy SDKs `google-generativeai` (Python) and `@google/generative-ai` (JS) are **deprecated**. Never use them.
> [!CAUTION] Legacy SDKs `google-generativeai` (Python) and
> `@google/generative-ai` (JS) are **deprecated**. Never use them.

---
______________________________________________________________________

## Quick Start

### Python

```python
from google import genai

Expand All @@ -52,6 +55,7 @@ print(response.text)
```

### JavaScript/TypeScript

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

Expand All @@ -64,6 +68,7 @@ console.log(response.text);
```

### Go

```go
package main

Expand Down Expand Up @@ -111,7 +116,9 @@ public class GenerateTextFromTextInput {
```

**Java Installation:**
- Latest version: https://central.sonatype.com/artifact/com.google.genai/google-genai/versions

- Latest version:
https://central.sonatype.com/artifact/com.google.genai/google-genai/versions
- Gradle: `implementation("com.google.genai:google-genai:${LAST_VERSION}")`
- Maven:
```xml
Expand All @@ -122,32 +129,39 @@ public class GenerateTextFromTextInput {
</dependency>
```

---
______________________________________________________________________

## Documentation Lookup

### When MCP is Installed (Preferred)

If the **`search_docs`** tool (from the Google MCP server) is available, use it as your **only** documentation source:
If the **`search_docs`** tool (from the Google MCP server) is available, use it
as your **only** documentation source:

1. Call `search_docs` with your query
2. Read the returned documentation
2. **Trust MCP results** as source of truth for API details — they are always up-to-date.
1. Read the returned documentation
1. **Trust MCP results** as source of truth for API details — they are always
up-to-date.

> [!IMPORTANT]
> When MCP tools are present, **never** fetch URLs manually. MCP provides up-to-date, indexed documentation that is more accurate and token-efficient than URL fetching.
> [!IMPORTANT] When MCP tools are present, **never** fetch URLs manually. MCP
> provides up-to-date, indexed documentation that is more accurate and
> token-efficient than URL fetching.

### When MCP is NOT Installed (Fallback Only)

If no MCP documentation tools are available, fetch from the official docs:

**Index URL**: `https://ai.google.dev/gemini-api/docs/llms.txt`

This index contains links to all documentation pages in .md.txt format. Use web fetch tools to:
This index contains links to all documentation pages in .md.txt format. Use web
fetch tools to:

1. Fetch `llms.txt` to discover available pages
2. Fetch specific pages (e.g., `https://ai.google.dev/gemini-api/docs/function-calling.md.txt`)
1. Fetch specific pages (e.g.,
`https://ai.google.dev/gemini-api/docs/function-calling.md.txt`)

Key pages:

- [Text generation](https://ai.google.dev/gemini-api/docs/text-generation.md.txt)
- [Function calling](https://ai.google.dev/gemini-api/docs/function-calling.md.txt)
- [Structured outputs](https://ai.google.dev/gemini-api/docs/structured-output.md.txt)
Expand All @@ -156,8 +170,11 @@ Key pages:
- [Embeddings](https://ai.google.dev/gemini-api/docs/embeddings.md.txt)
- [SDK migration guide](https://ai.google.dev/gemini-api/docs/migrate.md.txt)

---
______________________________________________________________________

## Gemini Live API

For real-time, bidirectional audio/video/text streaming with the Gemini Live API, install the **`google-gemini/gemini-live-api-dev`** skill. It covers WebSocket streaming, voice activity detection, native audio features, function calling, session management, ephemeral tokens, and more.
For real-time, bidirectional audio/video/text streaming with the Gemini Live
API, install the **`google-gemini/gemini-live-api-dev`** skill. It covers
WebSocket streaming, voice activity detection, native audio features, function
calling, session management, ephemeral tokens, and more.
Loading
Loading